国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

S3C2440-AD應用

發布時間:2011-3-25 14:26    發布者:techshare
關鍵詞: AD , S3C2440
使用電位器模擬傳感器,進行模數轉化,將AD值轉化為溫度值,實時顯示在LCD上。漢字使用48*48字模,字符使用24*48字模。通過軟件PCtoLCD2002提取字模。這里主要用到ADCCON寄存器。首先要使能預分頻器,因為太快會沒轉化完,所以降低頻率,設置分頻比,然后是選擇模擬輸入通道。然后啟動AD轉換,該位在開始后自動清零,通過ECFLG位檢查是否轉化結束。ADCDAT0低10位用來存放轉化來的數據。





#include "2440addr.h"   
//垂直同步信號的脈寬、后肩和前肩      
#define VSPW       15      
#define VBPD       3      
#define VFPD       5      
//水平同步信號的脈寬、后肩和前肩      
#define HSPW       8      
#define HBPD       58      
#define HFPD      15      
#define CLKVAL 10      
#define HOZVAL 319      
#define LINEVAL 239      
#define PWREN 1      
#define MMODE 0      
#define PNRMODE 3      
#define BPPMODE 13      
#define INVVCLK 0      
#define INVVD 0      
#define INVVDEN 0      
#define U32 unsigned int      
#define M5D(n) ((n) & 0x1fffff)      
#define PAGEWIDTH 320      
#define OFFSIZE 0      
#define LCD_XSIZE 320      
#define LCD_YSIZE 240      
#define SCR_XSIZE 320      
#define SCR_YSIZE 240      
#define INVVLINE  1         
#define INVVFRAME 1           
#define BPP24BL 0      
#define BSWP 0      
#define HWSWP 0      
volatile U32 LCD_BUFFER[240][320];      
      
//48*48   
unsigned char wen[] = {                                                              //溫   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x20,0x00,0x0C,0x00,0x01,0x80,   
0x38,0x00,0x1E,0x00,0x01,0xE0,0x3F,0xFF,0xFF,0x00,0x00,0xE0,0x38,0x00,0x0C,0x00,   
0x00,0xF0,0x38,0x00,0x0C,0x00,0x00,0x70,0x38,0x00,0x0C,0x00,0x00,0x70,0xB8,0x00,   
0x0C,0x00,0x00,0x21,0x38,0x00,0x0C,0x00,0x00,0x01,0x38,0x00,0x0C,0x00,0x00,0x01,   
0x3F,0xFF,0xFC,0x00,0x00,0x02,0x38,0x00,0x0C,0x00,0x30,0x02,0x38,0x00,0x0C,0x00,   
0x1C,0x06,0x38,0x00,0x0C,0x00,0x0E,0x04,0x38,0x00,0x0C,0x00,0x0F,0x04,0x38,0x00,   
0x0C,0x00,0x07,0x08,0x38,0x00,0x0C,0x00,0x07,0x08,0x38,0x00,0x0C,0x00,0x03,0x18,   
0x3F,0xFF,0xFC,0x00,0x03,0x10,0x38,0x00,0x0C,0x00,0x00,0x30,0x38,0x00,0x0C,0x00,   
0x00,0x30,0x20,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x00,   
0x01,0x80,0x00,0x61,0xFF,0xFF,0xFF,0xC0,0x00,0xC1,0xC1,0x81,0x83,0xC0,0x00,0xC1,   
0xC1,0x81,0x83,0x80,0x01,0xC1,0xC1,0x81,0x83,0x80,0x43,0x81,0xC1,0x81,0x83,0x80,   
0x3F,0x81,0xC1,0x81,0x83,0x80,0x07,0x81,0xC1,0x81,0x83,0x80,0x03,0x01,0xC1,0x81,   
0x83,0x80,0x03,0x01,0xC1,0x81,0x83,0x80,0x03,0x01,0xC1,0x81,0x83,0x80,0x03,0x01,   
0xC1,0x81,0x83,0x80,0x07,0x01,0xC1,0x81,0x83,0x80,0x07,0x01,0xC1,0x81,0x83,0x80,   
0x07,0x01,0xC1,0x81,0x83,0x90,0x07,0x01,0xC1,0x81,0x83,0xB8,0x07,0x81,0xC1,0x81,   
0x83,0xBC,0x01,0x7E,0x3E,0x7E,0x7C,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};     
     
unsigned char du[] = {                                                               //度   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,   
0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,   
0x00,0xF0,0x00,0x00,0x01,0x00,0x00,0x70,0x00,0x40,0x01,0x80,0x00,0x60,0x00,0xE0,   
0x01,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0xC0,0x10,0x00,   
0x80,0x00,0x00,0xC0,0x1C,0x00,0xE0,0x00,0x00,0xC0,0x1E,0x00,0xF0,0x00,0x00,0xC0,   
0x1C,0x00,0xE0,0x00,0x00,0xC0,0x1C,0x00,0xE0,0x40,0x00,0xC0,0x1C,0x00,0xE0,0xE0,   
0x00,0xDF,0xFF,0xFF,0xFF,0xF0,0x00,0xC8,0x1C,0x00,0xE0,0x00,0x00,0xC0,0x1C,0x00,   
0xE0,0x00,0x01,0xC0,0x1C,0x00,0xE0,0x00,0x01,0xC0,0x1C,0x00,0xE0,0x00,0x01,0xC0,   
0x1C,0x00,0xE0,0x00,0x01,0xC0,0x1C,0x00,0xE0,0x00,0x01,0xC0,0x1F,0xFF,0xE0,0x00,   
0x01,0xC0,0x1C,0x00,0xE0,0x00,0x01,0xC0,0x10,0x00,0x80,0x00,0x01,0xC0,0x00,0x00,   
0x10,0x00,0x01,0x80,0x00,0x00,0x38,0x00,0x01,0x81,0xFF,0xFF,0xFC,0x00,0x01,0x80,   
0x08,0x00,0x78,0x00,0x01,0x80,0x0C,0x00,0x70,0x00,0x03,0x80,0x06,0x00,0xE0,0x00,   
0x03,0x00,0x03,0x01,0xC0,0x00,0x03,0x00,0x03,0x03,0xC0,0x00,0x03,0x00,0x01,0x87,   
0x80,0x00,0x03,0x00,0x00,0xCF,0x00,0x00,0x06,0x00,0x00,0x7E,0x00,0x00,0x06,0x00,   
0x00,0x3C,0x00,0x00,0x06,0x00,0x00,0x7C,0x00,0x00,0x0C,0x00,0x01,0xFF,0x00,0x00,   
0x0C,0x00,0x03,0xC7,0xE0,0x00,0x08,0x00,0x0F,0x01,0xFE,0x00,0x18,0x00,0x78,0x00,   
0x7F,0xF8,0x10,0x03,0xE0,0x00,0x1F,0xE0,0x20,0x1E,0x00,0x00,0x03,0xC0,0x20,0xE0,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};   
unsigned char s1[] = {                                                               //:   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0xE0,0x00,0x00,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,0x00,   
0x00,0x00,0x03,0xF8,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,0x00,0x00,0x00,0x01,0xF0,   
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0x00,0x03,0xF8,   
0x00,0x00,0x00,0x00,0x03,0xF8,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,0x00,0x00,0x00,   
0x01,0xF0,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};   
unsigned char s2[] = {                                                               //℃   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x98,0x00,0xFF,0x80,0x00,   
0x03,0x0C,0x03,0xFF,0xE0,0x00,0x02,0x0C,0x0F,0x80,0x38,0x80,0x02,0x0C,0x1E,0x00,   
0x0C,0x80,0x03,0x0C,0x3C,0x00,0x06,0x80,0x03,0x18,0x38,0x00,0x03,0x80,0x01,0xF8,   
0x70,0x00,0x01,0x80,0x00,0x00,0xF0,0x00,0x01,0x80,0x00,0x00,0xE0,0x00,0x01,0x80,   
0x00,0x01,0xE0,0x00,0x00,0x80,0x00,0x01,0xC0,0x00,0x00,0x80,0x00,0x01,0xC0,0x00,   
0x00,0x80,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x03,   
0xC0,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,   
0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,   
0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x01,   
0xC0,0x00,0x00,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,   
0x00,0x00,0xE0,0x00,0x00,0x80,0x00,0x00,0xF0,0x00,0x01,0x80,0x00,0x00,0x78,0x00,   
0x01,0x00,0x00,0x00,0x38,0x00,0x02,0x00,0x00,0x00,0x3C,0x00,0x0E,0x00,0x00,0x00,   
0x1F,0x00,0x38,0x00,0x00,0x00,0x0F,0xE1,0xF0,0x00,0x00,0x00,0x03,0xFF,0xC0,0x00,   
0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};   
//24*48   
unsigned char num[] = {   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                             //0   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x0F,0xFF,0xF8,0x0F,0xFF,0xF8,0x0F,0xFF,0xF0,   
0x0E,0x00,0x30,0x08,0x00,0x60,0x18,0x00,0x40,0x10,0x00,   
0xC0,0x10,0x00,0x80,0x00,0x01,0x80,0x00,0x01,0x00,0x00,   
0x03,0x00,0x00,0x02,0x00,0x00,0x06,0x00,0x00,0x04,0x00,   
0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x18,   
0x00,0x00,0x38,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,   
0x70,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x70,0x00,   
0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0xF0,   
0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x70,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                              //1   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x04,0x00,0x00,0x0C,0x00,0x00,0x1C,0x00,   
0x03,0xFC,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,   
0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,   
0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,   
0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,   
0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,   
0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,   
0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,0x00,0x00,0x1C,   
0x00,0x00,0x1C,0x00,0x00,0x3E,0x00,0x03,0xFF,0xE0,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                              //2   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x7E,0x00,0x01,0x83,0x80,0x06,0x01,0xC0,   
0x0C,0x00,0xE0,0x0C,0x00,0xE0,0x1C,0x00,0x70,0x1C,0x00,   
0x70,0x1C,0x00,0x70,0x1E,0x00,0x70,0x1E,0x00,0x70,0x0E,   
0x00,0x70,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,0x01,0xC0,   
0x00,0x01,0xC0,0x00,0x03,0x80,0x00,0x07,0x00,0x00,0x0E,   
0x00,0x00,0x1C,0x00,0x00,0x38,0x00,0x00,0x70,0x00,0x00,   
0xE0,0x00,0x01,0xC0,0x00,0x01,0x80,0x00,0x03,0x00,0x10,   
0x06,0x00,0x10,0x0C,0x00,0x30,0x18,0x00,0x30,0x10,0x00,   
0x60,0x3F,0xFF,0xE0,0x3F,0xFF,0xE0,0x3F,0xFF,0xE0,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                              //3   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x7E,0x00,0x01,0x83,0x80,0x03,0x01,0xC0,   
0x06,0x00,0xE0,0x0E,0x00,0xE0,0x0E,0x00,0x70,0x0F,0x00,   
0x70,0x0F,0x00,0x70,0x07,0x00,0x70,0x00,0x00,0x70,0x00,   
0x00,0x60,0x00,0x00,0xE0,0x00,0x00,0xC0,0x00,0x01,0x80,   
0x00,0x07,0x00,0x00,0x7C,0x00,0x00,0x07,0x80,0x00,0x00,   
0xC0,0x00,0x00,0x60,0x00,0x00,0x70,0x00,0x00,0x30,0x00,   
0x00,0x38,0x00,0x00,0x38,0x0C,0x00,0x38,0x1E,0x00,0x38,   
0x1E,0x00,0x38,0x1E,0x00,0x30,0x1C,0x00,0x70,0x0C,0x00,   
0x60,0x06,0x00,0xC0,0x03,0x03,0x80,0x00,0xFE,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                             //4   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x01,0x80,0x00,0x03,0x80,0x00,0x03,0x80,   
0x00,0x07,0x80,0x00,0x0F,0x80,0x00,0x0B,0x80,0x00,0x1B,   
0x80,0x00,0x13,0x80,0x00,0x33,0x80,0x00,0x63,0x80,0x00,   
0x43,0x80,0x00,0xC3,0x80,0x01,0x83,0x80,0x01,0x03,0x80,   
0x03,0x03,0x80,0x02,0x03,0x80,0x04,0x03,0x80,0x0C,0x03,   
0x80,0x08,0x03,0x80,0x18,0x03,0x80,0x30,0x03,0x80,0x3F,   
0xFF,0xFC,0x3F,0xFF,0xFC,0x00,0x03,0x80,0x00,0x03,0x80,   
0x00,0x03,0x80,0x00,0x03,0x80,0x00,0x03,0x80,0x00,0x03,   
0x80,0x00,0x03,0x80,0x00,0x03,0xC0,0x00,0x7F,0xFC,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                          //5   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x07,0xFF,0xF0,0x07,0xFF,0xF0,0x07,0xFF,0xF0,   
0x04,0x00,0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x04,0x00,   
0x00,0x04,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,   
0x00,0x00,0x08,0x7F,0x00,0x09,0xFF,0x80,0x0B,0x81,0xC0,   
0x0E,0x00,0xE0,0x0E,0x00,0x70,0x0C,0x00,0x70,0x00,0x00,   
0x78,0x00,0x00,0x38,0x00,0x00,0x38,0x00,0x00,0x38,0x00,   
0x00,0x38,0x0C,0x00,0x38,0x1E,0x00,0x38,0x1E,0x00,0x38,   
0x1E,0x00,0x30,0x1C,0x00,0x70,0x0C,0x00,0x70,0x0C,0x00,   
0xE0,0x06,0x00,0xC0,0x03,0x83,0x80,0x00,0xFE,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                            //6   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x3F,0x00,0x00,0xC1,0xC0,0x01,0x81,0xC0,   
0x03,0x01,0xE0,0x06,0x01,0xE0,0x0C,0x01,0xE0,0x0C,0x00,   
0x00,0x0C,0x00,0x00,0x1C,0x00,0x00,0x18,0x00,0x00,0x18,   
0x00,0x00,0x38,0x00,0x00,0x38,0x3F,0x00,0x38,0xFF,0xC0,   
0x3B,0xC1,0xE0,0x3B,0x00,0xE0,0x3E,0x00,0x70,0x3C,0x00,   
0x70,0x38,0x00,0x38,0x38,0x00,0x38,0x38,0x00,0x38,0x38,   
0x00,0x38,0x38,0x00,0x38,0x18,0x00,0x38,0x1C,0x00,0x38,   
0x1C,0x00,0x38,0x0C,0x00,0x30,0x0E,0x00,0x70,0x06,0x00,   
0x60,0x03,0x00,0xC0,0x01,0xC1,0x80,0x00,0x7E,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                             //7   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x0F,0xFF,0xF8,0x0F,0xFF,0xF8,0x0F,0xFF,0xF0,   
0x0E,0x00,0x30,0x08,0x00,0x60,0x18,0x00,0x40,0x10,0x00,   
0xC0,0x10,0x00,0x80,0x00,0x01,0x80,0x00,0x01,0x00,0x00,   
0x03,0x00,0x00,0x02,0x00,0x00,0x06,0x00,0x00,0x04,0x00,   
0x00,0x0C,0x00,0x00,0x0C,0x00,0x00,0x18,0x00,0x00,0x18,   
0x00,0x00,0x38,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,   
0x70,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x70,0x00,   
0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0xF0,   
0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x70,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                           //8   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0xFF,0x00,0x03,0x81,0xC0,0x07,0x00,0xE0,   
0x0E,0x00,0x70,0x0C,0x00,0x70,0x1C,0x00,0x38,0x1C,0x00,   
0x38,0x1C,0x00,0x38,0x1C,0x00,0x38,0x1E,0x00,0x38,0x0F,   
0x00,0x70,0x0F,0x80,0x70,0x07,0xC0,0xE0,0x03,0xF1,0xC0,   
0x01,0xFF,0x00,0x01,0xFF,0x00,0x03,0x1F,0x80,0x06,0x07,   
0xC0,0x0E,0x03,0xE0,0x1C,0x00,0xF0,0x1C,0x00,0xF0,0x38,   
0x00,0x78,0x38,0x00,0x38,0x38,0x00,0x38,0x38,0x00,0x38,   
0x38,0x00,0x38,0x38,0x00,0x38,0x1C,0x00,0x70,0x0C,0x00,   
0x60,0x06,0x00,0xE0,0x03,0x81,0x80,0x00,0xFE,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,                            //9   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0xFC,0x00,0x03,0x83,0x00,0x06,0x00,0x80,   
0x0E,0x00,0xC0,0x1C,0x00,0x60,0x1C,0x00,0x60,0x18,0x00,   
0x30,0x38,0x00,0x30,0x38,0x00,0x30,0x38,0x00,0x38,0x38,   
0x00,0x38,0x38,0x00,0x38,0x38,0x00,0x38,0x38,0x00,0x78,   
0x1C,0x00,0x78,0x1C,0x00,0xF8,0x1E,0x01,0xB8,0x0F,0x87,   
0x38,0x07,0xFE,0x38,0x01,0xF8,0x38,0x00,0x00,0x30,0x00,   
0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x70,0x00,0x00,0x60,   
0x00,0x00,0xE0,0x06,0x00,0xC0,0x0F,0x01,0xC0,0x0F,0x01,   
0x80,0x0F,0x03,0x00,0x07,0x0E,0x00,0x01,0xF8,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,   
0x00};   
void Delay(U32 x){   
    U32 i, j, k;   
    for(i = 0; i < x; i++)   
        for(j = 0; j < 0xff; j++)   
            for(k = 0; k < 0xff; k++)   
                ;   
}   
      
void Init_LCD(){  
rLCDCON1=(CLKVAL<<8)|(MMODE<<7)|(PNRMODE<<5)|(BPPMODE<<1)|0;   //設置CLKVAL,VCLK=HCLK/[(CLKVAL+1)*2],決定VM的觸發方式,選擇顯示模式和BPP模式,暫時不要開啟LCD,因為還沒有設置好
       rLCDCON2=(VBPD<<24)|(LINEVAL<<14)|(VFPD<<6)|(VSPW);    //rLCDCON2,rLCDCON3和rLCDCON4主要設置時序  
       rLCDCON3=(HBPD<<19)|(HOZVAL<<8)|(HFPD);  
       rLCDCON4=(HSPW);  
       rLCDCON5 = (BPP24BL<<12) | (INVVCLK<<10) | (INVVLINE<<9) | (INVVFRAME<<8) | (0<<7) | (INVVDEN<<6) | (PWREN<<3)  |(BSWP<<1) | (HWSWP);                         //INVVLINE和INVVFRAME需要進行翻轉,因為CPU發出的是正脈沖,LCD使用的是負脈沖,所以要改變極性,PWREN使能電源信號
       rLCDSADDR1=(((U32)LCD_BUFFER>>22)<<21)|M5D((U32)LCD_BUFFER>>1);  
       rLCDSADDR2=M5D(((U32)LCD_BUFFER+(SCR_XSIZE*SCR_YSIZE*4))>>1 );  
       rLCDSADDR3=PAGEWIDTH*32/16;  
       rLCDINTMSK|=(3);        
       rTCONSEL = 0;            
       rGPCUP = 0x0;  
       rGPDCON = 0xaaaaaaaa;  
       rGPCCON = 0xaaaa02a9;  
       rGPDUP = 0x0;  
       rGPGUP=rGPGUP&("(1<<4))|(1<<4);        
       rGPGCON=rGPGCON&("(3<<8))|(3<<8);   
       rLCDCON1 |= 1;   //使能數據輸出和LCD控制信號
}        
      
void Paint_text(U32 x, U32 y, U32 color, unsigned char ch[], U32 lengx, U32 lengy){  //我的這個函數是通用的,只要正確傳遞參數  
    int i, j, test, t = -1;      
    for(i = 0; i < lengy; i++){         
        for(j = 0; j < lengx; j++){      
            if(j%8 == 0){      
                test = 0x80;      
                t++;      
            }      
            if(ch[t] & test)      
                LCD_BUFFER[x+i][y+j] = color;      
            test >>= 1;         
        }         
    }      
}      
      
void Paint_background(U32 c, U32 startx, U32 starty, U32 endx, U32 endy){   
    U32 i,j;      
    for(j = starty; j < endy; j++)      
        for(i = startx; i < endx; i++)      
            LCD_BUFFER[j][ i] = c;      
}      
U32 readAD(U32 ch){   
    rADCCON = (1<<14)|(49<<6)|(ch<<3);   
    rADCCON |= 0x1;   
    while(rADCCON & 0x1);   
    while(!(rADCCON & 0x8000));   
    return ((U32)rADCDAT0 & 0x3ff)*99/0x3ff ;   
}   
      
int LcdMain(){   
    U32 temperature, pre[2];   
    pre[0] = pre[1] = 0;      
    Init_LCD();      
    Paint_background(0xFFFFFF,0,0,LCD_XSIZE,LCD_YSIZE);   
    Paint_text(100, 20, 0x0, wen, 48, 48);   
    Paint_text(100, 68, 0x0, du, 48, 48);   
    Paint_text(100, 116, 0x0, s1, 48, 48);   
    Paint_text(100, 212, 0x0, s2, 48, 48);   
    while(1){   
        temperature = readAD(0);                                       //讀取溫度  
        if(temperature / 10 != pre[1]){                               //如果溫度改變了,調節LCD上顯示的溫度,如果沒有改變跳過  
            pre[1] = temperature/10;   
            Paint_background(0xFFFFFF,164,100,164+24,100+48);   
            Paint_text(100, 164, 0x0, num+pre[1]*144,24,48);     //因為每個數字占24*48/8=144個字節,所以num+offset就可以定位   
        }   
        if(temperature %10 != pre[0]){   
            pre[0] = temperature%10;   
            Paint_background(0xFFFFFF,188,100,188+24,100+48);   
            Paint_text(100, 188, 0x0, num+pre[0]*144,24,48);                    
        }   
        Delay(100);   
    }      
}

李萬鵬
本文地址:http://m.qingdxww.cn/thread-59914-1-1.html     【打印本頁】

本站部分文章為轉載或網友發布,目的在于傳遞和分享信息,并不代表本網贊同其觀點和對其真實性負責;文章版權歸原作者及原出處所有,如涉及作品內容、版權和其它問題,我們將根據著作權人的要求,第一時間更正或刪除。
您需要登錄后才可以發表評論 登錄 | 立即注冊

廠商推薦

  • Microchip視頻專區
  • 基于CEC1712實現的處理器SPI FLASH固件安全彈性方案培訓教程
  • 了解一下Microchip強大的PIC18-Q24 MCU系列
  • 無線充電基礎知識及應用培訓教程3
  • 5分鐘詳解定時器/計數器E和波形擴展!
  • 貿澤電子(Mouser)專區

相關視頻

關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯系我們
電子工程網 © 版權所有   京ICP備16069177號 | 京公網安備11010502021702
快速回復 返回頂部 返回列表
主站蜘蛛池模板: 91亚洲国产成人久久精品网站 | 免费看黄的网页 | 国产成人精品高清不卡在线 | 四虎影院在线观看免费 | 狠狠色丁香久久综合婷婷 | 韩国日本免费不卡在线观看 | 四虎网站最新 | 成人亚洲精品 | 国产一级做a爰片久久毛片 国产一级做a爰片... | 亚洲第一区精品日韩在线播放 | 在线人成精品免费视频 | 国产真实乱了在线播放 | 综合色在线观看 | 国产白色视频在线观看w | 色综合天天综合网国产成人网 | 66久久 | 岛国一区二区 | 91年精品国产福利线观看久久 | 国内精品久久久久久久 | 日韩欧美成末人一区二区三区 | 99精品在线免费观看 | 天天综合日日噜噜噜 | 黄色小视频在线免费看 | 国产成人精品男人的天堂538 | 激情五月开心婷婷 | 欧美精品一区在线看 | 免费观看国产精品视频 | 国产精品久久久久久影院 | www.四虎在线 | 超昂天使在线观看 | 日韩中文字幕第一页 | 成人国产欧美精品一区二区 | 伊人五月在线 | 久久99免费 | 2022国产精品福利在线观看 | 插菊花综合1 | 日本特黄特色大片免费看 | 成人免费男女视频网站慢动作 | 欧美视频在线观看网站 | 在线看日本 | 国产产一区二区三区久久毛片国语 |