Language :  english
51-based elevator program
Time: 2017-12-27
#include <#include <intrins.h> #define uchar unsigned char #define uint unsigned int sbit PA = P1 ^ 0; sbit PB = P1 ^ 1; sbit PC = P1 ^ 2; sbit PD = P1 ^ Void xianan (); void xiansan (); void xiani (); void xianwu (); void xianan (); void xianwu void xianjiu (); void xianqi (); void xianba (); void xianjiu (); void mie (); void main () while (1) for (i = 3000; i> 0; i--) if (j == 0) xianyi (); // Display "1" after entering the main program Display "1" when j = 0 Else xianjiu (); // Display the screen after executing the ascending instruction in the external interrupt 0 " // open the interrupt IT0 = 1; IT1 = 1; EX0 = 1; EX1 = 1; / / open external interrupt 0,1, respectively, control up and down}}} void mie () / / Void off (uint z) // delay function one millisecond delay uint x, y; for (x = z; x> 0; x--) for (y = };}}}}} Void jiantou (uint temp) // Up arrow The program arrow takes up 5 columns uint temp1, temp2, temp3, temp4, temp5; temp1 = 0xf7; temp1 = _crol_ (temp1, temp ); / / Cyclic shift P2 = temp1; P0 = 0xff; / / Only P2 mouth control department
Sub-cycle shift Port 0 control part of the same PA = 0 PB = 0 PC = 0 PD = 0; / / 0 column delay (3); mie (); temp2 = 0xef; temp2 = _crol_ (temp2, temp = P2FF2; temp = 0xc0; temp3 = _crol_ (temp3); , temp); P2 = temp3; P0 = 0x03; PA = 0; PB = 1; PC = 0; PD = 0; // second column delay (3); mie (); temp4 = Oxef; temp4 = _crol_ temp = 4, temp); P2 = temp4; P0 = 0xff; PA = 1; PB = 1; PC = 0; PD = 0; // 3rd column delay (3); mie (); temp5 = 0xf7; temp5 = _crol_ (temp5, temp); P2 = temp5; P0 = 0xff; PA = 0; PB = 0; PC = 1; PD = 0; // 4th column delay (3); mie ) / / Arrow down the arrow a total of five columns uint temp6, temp7, temp8, temp9, temp0; temp6 = 0xef; temp6 = _cror_ (temp6, temp); / / cyclic shift P2 = 0xff; P0 = temp6; // only part of the control of the P0 port cyclic shift P2 port control part of the same PA = 0; PB = 0; PC = 0; PD = 0; / / 0 column delay (3); mie (); temp7 = 0xf7 ; Pct = 1; pd = 0; / / the first column delay (3); mie (); temp8 = _cror_ (temp7, temp) P0 = temp8; PA = 0; PB = 1; PC = 0; PD = 0; // second column delay (3); mie (); temp9 = 0xf7;
temp9 = _cror_ (temp9, temp); P2 = 0xff; P0 = temp9; PA = 1; PB = 1; PC = 0; ; p0 = temp0; PA = 0; PB = 0; PC = 1; PD = 0; // the fourth column delay (3); mie ();} void xianyi () // Display the number "1" P2 = 0xef; P0 = 0xfb; PA = 0; PB = 0; PC = 0; PD = 1; delay (3); mie ; PD = 1; delay (3); mie (); P2 = 0xc0; P0 = 0x03;
Product Catalog
Products