51单片机矩阵键盘计算器(国外英文资料).doc
文本预览下载声明
51单片机矩阵键盘计算器(国外英文资料)
/ * * * * * * * * * * 413 summer vacation work * * * * * * * * * 12864 LCD screen, combined with the 4 * 4 matrix keyboard, simple calculator *, store address: on STC - hex2 LCD12864. C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * * * function: 1, addition and subtraction of base integers; The removal function; In division, the two decimal places are retained. The denominator is 0 wrong * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * You can only add and subtract two Numbers. It can be done with 10 digit number of effective operations
/ * * * * * * note:, according to the calculation results require more than 123 correct results, for example, please show 321, so 321 individually assigned to a particular array, to 12864 o * * / in reverse chronological order
# include reg52. H
# define uint unsigned int
# define uchar unsigned char
# define ulong unsigned long
Sbit rs = P3 ^ 7;
Sbit rw = P3 ^ 6;
Sbit e = P3 ^ 5;
Sbit PSB = P3 ^ 4; / / string and select, H = string L = and this program gives 12864 parallel output
Bit flag1 = 0; / / digital markers
Bit flag11 = 0; / / + mark bit
Bit flag12 = 0; / / tag bit
Bit flag13 = 0; / / mark bit
Bit flag14 = 0; / / mark bit
Bit flag15 = 0; / / = mark bit
Bit flag16 = 0; / / to remove a
Bit flag2 = 0; / / minus sign
Bit flag3 = 0; / / the numerator is less than the denominator, and when the result is only two valid digits, a factor of 100 has two valid digits
Bit flag4 = 0; / / the numerator is less than the denominator, and when the result is only one valid number, it is 100 times more effective
Void init (); / / initialize 16824 subfunctions
Void write_com (uchar); / / write command
Void write_dat (uchar); / / write data, which is display content
Void display1 (uchar); / / display character
Void the delete (); / / clear display
Void delay (uint); / / delay
Void keyscan (); / / keyboard scanning
Void scan
显示全部