Разработка и изготовление автомата подачи звонков

Дипломная работа - Компьютеры, программирование

Другие дипломы по предмету Компьютеры, программирование



ar n;(n=0; n<8; n++)

{(o_byte&0x80)

{c_high_sda();

}

{c_low_sda();

}c_high_scl();c_low_scl();_byte = o_byte << 1;

}c_high_sda();

}i2c_nack(void)

{c_high_sda(); // data at onec_high_scl(); // clock pulsec_low_scl();

}i2c_ack(void)

{c_low_sda(); // bring data low and clockc_high_scl();c_low_scl();c_high_sda();

}i2c_start(void)

{c_low_scl();c_high_sda();c_high_scl(); // bring SDA low while SCL is highc_low_sda();c_low_scl();

}i2c_stop(void)

{c_low_scl();c_low_sda();c_high_scl();c_high_sda(); // bring SDA high while SCL is high

// idle is SDA high and SCL high

}i2c_high_sda(void)

{

// bring SDA to high impedance_DIR = 1;

//SDA_PIN = 1;

//SDA_DIR = 0;_10us(5);

}i2c_low_sda(void)

{_PIN = 0;_DIR = 0; // output a hard logic zero_10us(5);

}i2c_high_scl(void)

{_DIR = 1; // high impedance_10us(5);

}i2c_low_scl(void)

{_PIN = 0;_DIR = 0;_10us(5);

}

// LCD routinesdelay_10us(unsigned char t)

{

#asm

#endasm

/*

#asmSTATUS, RP0_10US_1:t, FDELAY_10US_1

#endasm

*/

}delay_ms(long t) // delays t millisecs

{

{_10us(100);

} while(--t);

}

/*indikator{unsigned char m1,ch1)

{ //Вывод на индикаторы

PORTB= m1 & 0b00001111;;

PORTA=1;_ms(40);=(m1 >> 4) & 0b0111;=2;_ms(40);= ch1 & 0b00001111;;=4;_ms(40);=(ch1 >> 4) & 0b0011;=8;

//delay_ms(5);

}

*/