文档详情

AD采样以及12864液晶显示成功程序(国外英文资料).doc

发布:2017-06-08约6.74千字共21页下载文档
文本预览下载声明
AD采样以及12864液晶显示成功程序(国外英文资料) # include reg52. H # define uchar unsigned char # define uint unsigned int # define ulong unsigned long # define comm 0 / / for instructions # define dat 1 / / the data / / sbit CS = P0 ^ 5; / / sbit SID = P0 ^ 6; / / sbit SCLK = P0 ^ 7; Sbit eoc = P0 ^ 0; Sbit oe = P0 ^ 1; Sbit st = P0 ^ 2; Sbit ABC = P0 ^ 3; Cs = sbit P0 ^ 5; / / serial selection, high check Sbit sid = P0 ^ 6; / / serial data port Sbit CLK = P0 ^ 7; / / serial synchronization clock Sbit PSB = P0 ^ 4; / / H = parallel port; L = serial port; Void delay (uint x); / * void send_cmd (uchar cmd_data); Void send_data (uchar cmd_data); Void lcd_init (); Void display1 (uint x, uint y, uchar dis []); Void display2 (uint x, uint y, uchar dis); Void display_dy (uint x, uint y, uint dat); * / Uint ad0809_dy (); Uint ad0809_dl (); / / uchar keyscan () Uint a, [4]. / / uint I, add; / * delay 1ms * / Void delay (uint x) { Uint I, j; (j = 0; j x; j + +) For (I = 0; I 110; I + +); } The delay -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - Void delay2 (uint us) / / delay time { While (us --); } / * void delay1 (uint ms) { Uint I, j; For (I = 0; I ms; I + +) For (j = 0; j 15; j + +) Delay2 (1); } * / I can read and write liquid crystal -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - Void wr_lcd (uchar dat_comm, uchar content) { Uchar a, I, j; A = the content; Cs = 1; / / first selection CLK = 0; / / clock low Sid = 1; / / 5 1 For (I = 0; I 5; I + +) / / produces five rising edge, passing five data, and the clock sets low { CLK = 1; CLK = 0; } Sid = 0; / / CLK = 1; / / generate a rising edge and transfer a data CLK = 0; / / If (dat_comm) Sid = 1; / / data The else Sid = 0; / / instructions CLK = 1; / / rw completion CLK = 0; / / transfer Sid = 0; / / rs = 0, display the instruction data CLK = 1; / / CLK = 0; / / transfer 0 For (j = 0; j 2; j + +) { For (I = 0; I 4; I + +) { A = a 1; Sid = CY; / / it should be a real-time value that assigns this bit
显示全部
相似文档