各位大虾帮忙看看程序有什么问题。谢谢
使用rt12232F,有字库,并口连接,P0口已加上拉
#include "r51r.h"
#include <intrins.h>
#include <stdio.h>
#include <stdlib.h>
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
#define ture 1
#define false 0
void delay1ms(uint time){
uchar i;
uint j;
for(j=0;j<time;j++){
for(i=0;i<100;i++){
_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();
_nop_();
_nop_();}
}
}
sbit busy=P0^7;
sbit LED = P1^3;
sbit RS = P1^0;
sbit RW = P3^6;
sbit E1 = P3^7;
//sfr AUXR= 0X8E;
void LCDCMD(uchar command){
delay1ms(100);
RS = 0; RW = 0;
P0 = command;
E1 = 1; _nop_(); E1 = 0;
}
void DispData(uchar temp){
delay1ms(100);
RS = 1; RW = 0;
P0 = temp;
E1 = 1; _nop_(); E1 = 0;
}
void Test(void)
{
LCDCMD(0x30);
LCDCMD(0x06);
LCDCMD(0x0c);
LCDCMD(0x01);
LCDCMD(0x02);
LCDCMD(0x80);
DispData(0xb7);
DispData(0xb4);
}
main(){
EA=0;
delay1ms(100);
LED = 0;
delay1ms(550);
Test();
while(1)
{
LED = 0;
delay1ms(400);
LED = 1;
delay1ms(400);
}
} |