chikah dvig FRONT
{= tikd1>> 1; (tikd1 == 0) tikd1 = 8;
} ((linel) && (liner))// esli line poterena na DVUH datchikah to dvig BACK
{= tikd1 <<1; put -; (tikd1 == 0x10) tikd1 = 1;
} (! ((! linel) && (liner)))// esli line poteran na RIGHT datchike to dvig FRONT
{= tikd1>> 1; (tikd1 == 0) tikd1 = 8;
} (! ((linel) && (! liner)))// esli line poteran na LEFT datchike to dvig BACK
{= tikd1 <<1; (tikd1 == 0x10) tikd1 = 1;
}
}
{= tikd1 <<1; (tikd1 == 0x10) tikd1 = 1;
}// dvig BACK (nd2)// Right dvig
{(! ((! linel) && (! liner)))// esli line WHITE na DVUH datchikah dvig FRONT
{= tikd2 <<1; (tikd2 == 0) tikd2 = 0x10;
} ((linel) && (liner))// esli line poterena na DVUH datchikah to dvig BACK
{= tikd2>> 1; SBUF = 0x55;// zapros napravl povorot (tikd2 == 8) tikd2 = 0x80;
} (! ((! linel) && (liner)))// esli line poteran na RIGHT datchike to dvig BACK
{= tikd2>> 1; (tikd2 == 8) tikd2 = 0x80;
} (! ((linel) && (! liner)))// esli line poteran na LEFT datchike to dvig FRONT
{= tikd2 <<1; (tikd2 == 0) tikd2 = 0x10;
}
}
{= tikd2>> 1; (tikd2 == 8) tikd2 = 0x80;
}// dvig BACK = tikd1 | tikd2; [2] = put>> 8; [3] = put;
}
}
} uart0 (void) interrupt 4 using 1
{(RI) // read command
{(fdl)
{= SBUF; = 0;
} switch (SBUF)
{(0xff) {pausa = 1;} break;// stop platform (0x0f) {pausa = 0;} break;// start platform (0xf0) {napr = 0; fdl = 1 ;} break;// front (0xf1) {napr = 1; fdl = 1;} break;// back (0xf2) {napr = 2;} break;// left (0xf3) {napr = 3;} break; // right (0xE0) {SBUF = send [0]; tiksend = 1;} break; (0xFE) {fdl} break;// flag dlin
} = 0;
} (TI)// send byte
{= send [0]; + ​​+; = 0;
}
}
// -------------------- Base Text Program ----------------- ------ main (void)
{int i, j;
// ---- Setup the serial port for 9600 baud at 11.592 MHz.
# ifndef MONITOR51 = 0x50;// SCON: mode 1, 8-bit UART, enable rcvr | = 0x20;// TMOD: timer 1, mode 2, 8-bit reload, Timer 0 mode 1 16bit = 0xfd;// TH1: reload value for 9600 baud@11.0592MHz = 1;// TR1: timer 1 run = 1;/...