an>
{iware = 0; delay (100); // timeout 500mks = 1; delay (14); // timeout 70 mks (! iware)
{delay (86);// 500mks
if (iware) {fok = 1;}
}}} readiw (void) // читання IWare
{unsigned char pp, nn; = 0; for (nn = 0; nn <8; nn + +)
{iware = 0; delay (3); // start obmena bit = 1; delay (6); // +30 мкс для читання = iware; pp = pp> 1; (14); iware = 1, (3);} iw = pp; // збереження результату
}
void writeiw (void char t) // read IWare
{unsigned char pp, nn; = t; for (nn = 0; nn <8; nn + +)
{iware = 0; delay (3); = pp> 1; iware = CY; (20); iware = 1, (3);}} uart (void) interrupt 5 using 2
{if (RI)
{if (SBUF == 0xff) {fon_off = 1;} (SBUF == 0) {fon_off = 0;}} (TI) {TI = 0; (+ + step <12) = dat [step];
}
} readkey (void) interrupt 3 // INT1
{key = P2 &0x07; (key == 0) onsystem = ~ onsystem;
} I2C (unsigned char adrh, adrl)
{= 1; scl = 1; sda = 0; sda = 0; scl = 0; scl = 0; // старт обміну = 0xa0; // indeks flach pzu (rwi2c) pp = pp +1; // set reginm read (i = 0; i <8; i + +)
{scl = 0; pp = pp>> 1; sda = CY; scl = 1; scl = 1; scl = 1;} = 1; (sda) // read ACK
{scl = 0; scl = 0; scl = 0; scl = 1; scl = 1; scl = 1;} = adrh; (i = 0; i <8; i + +)
{scl = 0; pp = pp>> 1; sda = CY; scl = 1; scl = 1; scl = 1;} = 1; (sda) // read ACK
{scl = 0; scl = 0; scl = 0; scl = 1; scl = 1; scl = 1;} = adrl; adresl = adresl +8; if (CY) adresh + +; < span align = "justify">// avtoinkrement adresa (i = 0; i <8; i + +)
{scl = 0; pp = pp>> 1; sda = CY; scl = 1; scl = 1; scl = 1;} = 1; (sda) // read ACK
{scl = 0; scl = 0; scl = 0; scl = 1; scl = 1; scl = 1;} (rwi2c)
{
for (j = 0; j <8; j + +) // regim read
{pp = 0; (i = 0; i <8; i + +)
{scl = 0; scl = 0; scl = 0; scl = 1; CY = sda; pp = pp>> 1; scl = 1;} (sda) // write ACK