资源简介
MSP430F149单片机电压值经AD转换后显示在COG12864带字库的液晶屏上,代码加注释

代码片段和文件信息
#include “12864.h“
#include “string.h“
#include “stdio.h“
#define DataPort P4OUT
#define WR_1 P5OUT |=BIT1
#define WR_0 P5OUT &=~BIT1
#define RS_1 P5OUT |=BIT0
#define RS_0 P5OUT &=~BIT0
#define CS_1 P5OUT |=BIT2
#define CS_0 P5OUT &=~BIT2
#define RST_1 P5OUT |=BIT5
#define RST_0 P5OUT &=~BIT5
#define PS_1 P5OUT |=BIT3
#define PS_0 P5OUT &=~BIT3
#define C86_1 P5OUT |=BIT4
#define C86_0 P5OUT &=~BIT4
unsigned char RevBuffer[256];
void ReadFlash(unsigned long addrunsigned char *rdataunsigned char count);
/*************************************/
void Delaylong(unsigned int t)
{
unsigned int ij;
for(i=0;i {
for(j=0;j<100;j++);
}
}
/************************************/
void Delayus(unsigned int US)
{
while(US--);
}
/************************************/
void DelayMs(unsigned int MS)
{
unsigned int ij;
for( i=0;i for(j=0;j<114;j++);
}
/************************************/
/**********写数据/指令**************************/
void LCD_SendByte(unsigned char DatCmd unsigned char dByte)
{
DataPort = dByte; //写入数据 写数据时先把数据放到数据线上再使能写信号
if (DatCmd == 0) //指令操作
RS_0;
else
RS_1; //数据操作
WR_0; //写操作
CS_1; //
Delayus(3); //时序调整
CS_0;
}
/********************************************************/
void SendDatCom(unsigned char dc unsigned char dat)
{
LCD_SendByte(dc dat);
}
/************************************/
void Initialize(void)
{
C86_0;
PS_1;
RST_0;
DelayMs(100); //上电后等待内部复位
DelayMs(100);
RST_1;
DelayMs(100);
DelayMs(100);
//This command turns the display ON and OFF.
SendDatCom(00xAf); //Display ON0xAF->ON;0xae->OFF
SendDatCom(00x2f);//Power Controller Set Booster circuit: ONVoltage regulator circuit: ON Voltage follower circuit: ON
/*The Electronic Volume (Double Byte Command) */
SendDatCom(00x81);//只有0x81一个命令The Electronic Volume Mode Set
SendDatCom(00x09);//Electronic Volume Register SetD5-D0(0-63)
DelayMs(5);
SendDatCom(00x27);//Select internal power supply operating mode
SendDatCom(00xA2);//0xA3或者0xA2,Sets the LCD drive voltage bias ratio 0: 1/9 bias
DelayMs(5);
//此处需将ADC Select和Common output mode select都选为反转模式
SendDatCom(00xc0);//Common output mode selectSelect COM output scan direction
//C0->NormalCOM0→COM63;C8->ReverseCOM63→COM0
SendDatCom(00xa0);//ADC Select,0xa0->Normal0xa1->Reverse正常:从左往右依次写显示数据
/*Display All Points ON/OFF
This command makes it possible to force all display points ON regardless of the content of the display data RAM.
The contents of the display data RAM are maintained when this is done.
This command takes priority over the display normal/reverse command.*/
SendDatCom(00xa4);//Display All Points ON0xa4-
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-10-29 20:23 ADC12864自己写的\
文件 7389 2013-10-29 16:37 ADC12864自己写的\12864.c
文件 417 2013-10-29 16:37 ADC12864自己写的\12864.h
文件 2571 2013-10-29 10:44 ADC12864自己写的\ADC.c
目录 0 2013-10-27 20:06 ADC12864自己写的\Debug\
目录 0 2013-10-27 20:16 ADC12864自己写的\Debug\Exe\
文件 5989 2013-10-29 20:23 ADC12864自己写的\Debug\Exe\disp.txt
目录 0 2013-10-27 20:06 ADC12864自己写的\Debug\List\
目录 0 2013-10-29 20:24 ADC12864自己写的\Debug\Obj\
文件 126 2013-10-29 20:23 ADC12864自己写的\Debug\Obj\disp.pbd
文件 60339 2013-10-29 20:23 ADC12864自己写的\Debug\Obj\main.r43
文件 3192 2013-10-29 20:24 ADC12864自己写的\disp.dep
文件 46731 2013-10-27 20:16 ADC12864自己写的\disp.ewp
文件 158 2013-10-27 20:09 ADC12864自己写的\disp.eww
文件 3968 2013-10-29 10:07 ADC12864自己写的\Flash.c
文件 432 2013-10-29 10:05 ADC12864自己写的\Flash.h
文件 567 2013-10-29 16:40 ADC12864自己写的\LED.c
文件 2972 2013-10-29 20:23 ADC12864自己写的\main.c
目录 0 2013-10-27 20:24 ADC12864自己写的\settings\
文件 2124 2013-10-29 20:22 ADC12864自己写的\settings\disp.cspy.bat
文件 63 2013-10-29 20:24 ADC12864自己写的\settings\disp.dbgdt
文件 179 2013-10-29 20:24 ADC12864自己写的\settings\disp.dni
文件 2703 2013-10-29 20:24 ADC12864自己写的\settings\disp.wsdt
文件 2363 2013-10-29 08:27 ADC12864自己写的\UART0.c
- 上一篇:ABAQUS批处理Inp文件
- 下一篇:kettle 6.1
相关资源
- 12864滚动显示汉字
- lcd12864的VHDL程序
- LCD12864滚动显示
- STM32 电子密码锁设计,LCD12864显示
- STM32 LCD12864并口驱动实验
- 使用SPCE061A的ACM12864J液晶显示模块应用
- 基于STM32F103C8单片机的晶联讯电子JL
- 台湾悠景oled 12864 ssd1309 驱动程序 并口
- DS1302+DS13B20+12864,万年历。农历
- 12864液晶Proteus模型
- Lcd12864大时钟万年历 农历生肖温度
- LCD12864驱动程序 带字库版本ST7920内含
- LCD12864驱动程序 并口通信,带字库版
- 12864多功能万年历
- STC89C52+LCD12864+18B20+1302万年历
- 12864专用图片取模软件
- 12864 接线原理图
- 0.96OLED_C51系列_IIC应答_例程
- 带字库LCD12864ST7920的Proteus仿真
- 基于mps430f149的12864液晶显示模块编程
- STM32控制SIM800c,sim900a,接收短信,
- 点阵12864 protues仿真+源码
- 海比邻的HB12864M2A液晶资料
- ST7920中文字型码表
- LX-12864B11 LCD资料
- 基于STM32的使用12864做的俄罗斯方块
- HB12864M1A
- LCD12864不带字库code
- 通过DS18B20检测环境温度,并在LCD128
- STM32+lcd12864串行方式显示贪吃蛇代码
评论
共有 条评论