这个程序里面搭配了火焰检测模块,使用的是ADC0,AD转换,显示的电压值可以根据光谱亮度进行变动。网上的1602字库,大多用汇编语言编写,可移植性太低。我这个是用C语言编写的。1602的字库,你们可以看到,显示了中文“月”与“工”。
#include "iom16v.h"
#include "macros.h"
#include "led.h"
#define uint unsigned int
#define uchar unsigned char
#define D0 PORTD=PORTD&0xbf;
#define D1 PORTD=PORTD|0x40;
unsigned char const lcd1602[]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39};
unsigned char const lcd1602_yue[]={0x0e,0x0a,0x0e,0x0a,0x0e,0x0a,0x12,0x00};
unsigned char const lcd1602_gong[]={0x1f,0x04,0x04,0x04,0x04,0x04,0x1f,0x00};
uint constant1=0,a1=0,a2=0,a3=0,a4=0;
void add_gong() //自造字库“工”
{
int a,b;
for (a=0x48;a<=0x4f;a++)
{
PORTB=a;
enable_lcd()