/****************************************Copyright (c)************************************************** ** Guangzou ZLG-MCU Development Co.,LTD. ** graduate school ** http://www.zlgmcu.com ** **--------------File Info------------------------------------------------------------------------------- ** File name: main.c ** Last modified Date: 2004-09-16 ** Last Version: 1.0 ** Descriptions: The main() function example template ** **------------------------------------------------------------------------------------------------------ ** Created by: Chenmingji ** Created date: 2004-09-16 ** Version: 1.0 ** Descriptions: The original version ** **------------------------------------------------------------------------------------------------------ ** Modified by: ** Modified date: ** Version: ** Descriptions: ** ********************************************************************************************************/ #include "config.h" #define BEEP 0x400 #define RST 0x8000 #define RS 0x2000 #define CS 0x10 #define RD 0x20 #define WR 0x40 #define BUSY 0x80 #define DATA 0xFF0000
const uint8 DISP_TAB[9600] ={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, };
void SETCOM(uint32 dat) { uint32 DLB; uint32 i; DLB=dat<<16; IO0CLR=0x00FF0000; IO0SET=DLB; IO0CLR=CS; IO0SET=RS; IO0SET=RD; IO0CLR=WR; for(i=0;i<15;i++); IO0SET=WR; IO0SET=CS; } void SETDATA(uint32 dat) { uint32 DLB; uint32 i; DLB=dat<<16; IO0CLR=0x00FF0000; IO0SET=DLB; IO0CLR=CS; IO0CLR=RS; IO0SET=RD; IO0CLR=WR; for(i=0;i<15;i++); IO0SET=WR; IO0SET=CS; }
int main (void) { uint32 i; uint32 M; PINSEL0=0x00000000; IO0DIR=BEEP+RST+RS+CS+RD+WR+DATA; IO0SET=BEEP+RST+RS+CS+RD+WR+DATA; IO0SET=RST; for(;i<1000;i++); IO0CLR=RST; for(;i<10000;i++); IO0SET=RST; for(;i<10;i++); IO0SET=RD; for(;i<10;i++); IO0SET=WR; IO0SET=CS; SETCOM(0x40); SETDATA(0x30); SETDATA(0x87); SETDATA(0x07); SETDATA(0x27); SETDATA(0x30); SETDATA(0xEF); SETDATA(0x28); SETDATA(0x00); SETCOM(0x44); SETDATA(0x00); SETDATA(0x00); SETDATA(0xF0); SETDATA(0x00); SETDATA(0x40); SETDATA(0xEF); SETDATA(0x00); SETDATA(0x00); SETDATA(0x00); SETDATA(0x00); SETCOM(0x59); SETDATA(0x04); SETCOM(0x5A); SETDATA(0x00); SETCOM(0x5D); SETDATA(0x04); SETDATA(0x07); SETCOM(0x4C); while(1) { SETCOM(0x5B); SETDATA(0x0C); SETCOM(0x46); SETDATA(0x00); SETDATA(0x00); SETDATA(0x00); SETCOM(0x42); for(M=0;M<9600;M++) { SETDATA(DISP_TAB); } IO0CLR =BEEP; IO0SET=BEEP; } return 0; }
在编译运行时出现问题!
|