资 源 简 介
#include "LCD1602.h"
void LCD1602Write(UINT8 type, UINT8 data)
{
uint8_t i ;
uint16_t val, tmp = data;
if(type == CMD)
GPIO_ResetBits(LCD1602PROT, RS); //RS = 0 写指令
else
GPIO_SetBits(LCD1602PROT, RS); //RS = 1 写数据
GPIO_ResetBits(LCD1602PROT, RW); //RW = 0 ;
for(i=0; i<2; i++)
{
GPIO_SetBits(LCD1602PROT, EN); //EN = 1;
val = GPIO_ReadOutputData(LCD1602PROT);
val = (0x0FFF&val) | (((tmp>>4)&0x000F) << 12);//先送4高位
GPIO_Write(LCD1602PROT, val);
tmp <<= 4;
Delay(1);
GPIO_ResetBits(LCD1602PROT, EN); //EN = 0; 下降沿
DelayUs(5);
&