资源简介

已经测试过,绝对好使的,四个通道测输入电压,相当于四个电压表

资源截图

代码片段和文件信息

#include “stdio.h“
#include “string.h“
#include “12864.h“
unsigned char RevBuffer[256];

#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 tempBuffer[100];
/*************************************/
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++);
}

/************************************/
unsigned char LCD_ReadByte(unsigned char DatCmd)
{
  unsigned char dByte;
  if (DatCmd == 0)         //指令操作
    RS_0;
  else
    RS_1;        
  WR_1;                     //读操作
  CS_1;    
  Delayus(3);              //时序调整
  dByte = DataPort;        //读数据或者指令    
  CS_0;     
  return dByte;
}
/***********************************************************/
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;     
}
/************************************/
unsigned char LCD_readBF(void)
{      
  Delayus(1000);
  //延时一段时间等待12864不忙
  //注意:如果12864是5V工作电压,一定不要从12864读数据,
  //如果12864是3.3V工作电压,则可以从12864读数据
  //此处的检测忙标志是通过延时来实现的  
  return 1;
}
/************************************/
void SendDatCom(unsigned char dc unsigned char dat)
{
  //while(LCD_readBF());               //等待不忙为止
  LCD_SendByte(dc dat);
}

/************************************/
void Initialize(void)
{
   P4DIR |= 0xff;                            // P4.0 output
   P5DIR |= 0xff; // P5.4 output
   P6DIR |=0X01;
   P6OUT |=0X01;
  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(00x0e);//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);  
  
  //此处需将AD

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       9789  2012-04-29 10:49  ADC序列通道多次转换\12864.c

     文件        797  2012-04-06 16:01  ADC序列通道多次转换\12864.h

     文件       1461  2012-05-11 19:44  ADC序列通道多次转换\ADC.c

     文件       2979  2012-08-05 18:59  ADC序列通道多次转换\ADC.dep

     文件      13407  2012-05-25 18:51  ADC序列通道多次转换\ADC.ewd

     文件      44945  2012-05-25 18:51  ADC序列通道多次转换\ADC.ewp

     文件        157  2012-05-25 18:29  ADC序列通道多次转换\ADC.eww

     文件        307  2012-05-11 20:25  ADC序列通道多次转换\ADC.h

     文件       3331  2012-05-11 20:58  ADC序列通道多次转换\ADC12.dep

     文件      13407  2012-05-11 19:45  ADC序列通道多次转换\ADC12.ewd

     文件      44949  2012-05-11 19:45  ADC序列通道多次转换\ADC12.ewp

     文件       8531  2012-08-05 17:52  ADC序列通道多次转换\Debug\Exe\ADC.txt

     文件       8531  2012-05-11 20:25  ADC序列通道多次转换\Debug\Exe\ADC12.txt

     文件        129  2012-08-05 17:52  ADC序列通道多次转换\Debug\Obj\ADC.pbd

     文件        137  2012-05-11 20:25  ADC序列通道多次转换\Debug\Obj\ADC12.pbd

     文件      86483  2012-08-05 17:52  ADC序列通道多次转换\Debug\Obj\main.r43

     文件       3966  2010-10-11 14:45  ADC序列通道多次转换\Flash.c

     文件        432  2010-10-10 20:36  ADC序列通道多次转换\Flash.h

     文件       2404  2012-05-25 18:29  ADC序列通道多次转换\main.c

     文件       2523  2012-08-05 16:59  ADC序列通道多次转换\settings\ADC.cspy.bat

     文件         63  2012-08-05 18:59  ADC序列通道多次转换\settings\ADC.dbgdt

     文件        639  2012-08-05 18:59  ADC序列通道多次转换\settings\ADC.dni

     文件       2947  2012-08-05 18:59  ADC序列通道多次转换\settings\ADC.wsdt

     文件       2523  2012-05-11 19:45  ADC序列通道多次转换\settings\ADC12.cspy.bat

     文件         63  2012-05-11 20:58  ADC序列通道多次转换\settings\ADC12.dbgdt

     文件        639  2012-05-11 20:58  ADC序列通道多次转换\settings\ADC12.dni

     文件       2334  2012-04-28 21:36  ADC序列通道多次转换\UART0.c

     目录          0  2012-05-25 18:51  ADC序列通道多次转换\Debug\Exe

     目录          0  2012-05-11 20:59  ADC序列通道多次转换\Debug\List

     目录          0  2012-08-05 17:52  ADC序列通道多次转换\Debug\Obj

............此处省略6个文件信息

评论

共有 条评论