⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dispfinal.lst

📁 视频字符叠加系统、采用89系列单片机开发
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V6.12  DISPFINAL                                                              09/08/2004 09:49:09 PAGE 1   


C51 COMPILER V6.12, COMPILATION OF MODULE DISPFINAL
OBJECT MODULE PLACED IN .\dispfinal.OBJ
COMPILER INVOKED BY: D:\keilc51\C51\BIN\C51.EXE .\dispfinal.c DEBUG OBJECTEXTEND CODE SYMBOLS

stmt level    source

   1            /*****************************************************************
   2          * one track charactor genrater
   3          ******************************************************************
   4          *eeprom define
   5          *16 byte display character code
   6          *60 byte display character information
   7          *others are download character array information
   8          *character code 
   9          *		figure and english character
  10          *		available chinese code 
  11          *		custom code
  12          *serial receive command include
  13          *		dot array download command/code
  14          *		time adjust
  15          *		title setup
  16          ******************************************************************/
  17          // the file is suited to at89c51 chip millcrocomputer 22.1184mhz
  18          // BAUD=9600
  19          //define contrain head file
  20          #pragma cd db oe
  21          #include <reg52.h>
  22          //#include <reg516.h>
  23          #include <stdio.h>
  24          #include <string.h>
  25          #include <intrins.h>
  26          #include <ctype.h>
  27          #include <string.h>
  28          #include <stdlib.h>
  29          #include <math.h>
  30          #include <absacc.h>
  31          //--------------------------------------------------
  32          //define osd6453 command
  33          #define LOCAL_PORT 0x00
  34          #define REC_LENGTH 0x1d
  35          #define clear_vram 0x34
  36          #define normal_tv 0x30
  37          #define selectable_tv 0x31
  38          #define disp_control 0x0e
  39          #define disp_close 0x00
  40          #define background_fring 0x43				//fring on/off control
  41          #define no_background 0x41
  42          #define back_color_fring 0x10				//fring color black background color control 
  43          #define cram_addr 0x86						//write charater dot information addr
  44          #define cram_data 0x90						//write charater dot information
  45          #define charsize 0x8c						//
  46          #define char_twice_size 0x8d
  47          #define disp_position_high 0x80
  48          #define disp_position_low 0xc4         //change from c5 to c4  3.26
  49          #define char_position 0x84					//the display charater position
  50          #define char_attribute 0xc8
  51          #define char_blink 0xc9
  52          #define smooth 0x30
  53          
  54          //----------------------------------------------------------
  55          
C51 COMPILER V6.12  DISPFINAL                                                              09/08/2004 09:49:09 PAGE 2   

  56          //-----------------------------------------------------------
  57          //define bit 
  58          static struct date_clock
  59          		{
  60          		unsigned char date_lines;
  61          		unsigned char date_words;
  62          		unsigned int  years;
  63          		unsigned char months;
  64          		unsigned char dates;
  65          		unsigned char time_lines;
  66          		unsigned char time_words;
  67          		unsigned char hours;
  68          		unsigned char minutes;
  69          		unsigned char seconds;
  70          		unsigned char microseconds;
  71          		} idata real_clock={10,14,2004,1,1,11,16,12,00,00,00};
  72          		 
  73          /*-------------------------------------------------------------
  74          //define display character informatio table
  75          static struct display_information 
  76          			{
  77          			unsigned char           lines;
  78          			unsigned char			words;
  79          			unsigned char			start_blink;
  80          			unsigned char 			end_blink;
  81          			unsigned char 			disp_addr[24];
  82          			} xdata disp_form[2][12];*/
  83          //-------------------------------------------------------------
  84          //define display character code
  85          unsigned char idata  character_code[2][32]=\
  86          		{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\
  87          		 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
  88          unsigned char idata  address_buf[24]=\
  89          		{0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,\
  90          		 0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef};
  91          static struct 
  92          	{
  93          		unsigned char ascii;
  94          		unsigned char stroke;
  95             	}code disp_strokes[]=\
  96          		{{' ',0xcf},{'!',0xcb},{'&',0xdc},{'-',0xe7},{'.',0xe3},{'/',0xcd},{'0',0x00},{'1',0x01},\
  97          		 {'2',0x02},{'3',0x03},{'4',0x04},{'5',0x05},{'6',0x06},{'7',0x07},{'8',0x08},\
  98          		 {'9',0x09},{':',0xe1},{';',0xe2},{'<',0xdf},{'>',0xe0},{'?',0xcc},{'A',0x0a},\
  99          		 {'B',0x0b},{'C',0x0c},{'D',0x0d},{'E',0x0e},{'F',0x0f},{'G',0x10},{'H',0x11},\
 100          		 {'I',0x12},{'J',0x13},{'K',0x14},{'L',0x15},{'M',0x16},{'N',0x17},{'O',0x00},\
 101          		 {'P',0x19},{'Q',0x1a},{'R',0x1b},{'S',0x1c},{'T',0x1d},{'U',0x1e},{'V',0x1f},\
 102          		 {'W',0x20},{'X',0x21},{'Y',0x22},{'Z',0x23},\	 
 103          		 };
 104          static struct
 105          	{
 106          		unsigned char code_high;
 107          		unsigned char code_low;
 108          		unsigned char ch_stroke;
 109             	}code disp_ch_strokes[]=\
 110          		{{0xb1,0xb6,0x37},{0xb3,0xf6,0x4f},{0xb5,0xad,0x3b},{0xb5,0xcd,0x52},\
 111          		 {0xb7,0xac,0x3c},{0xb8,0xb1,0x35},{0xb8,0xcd,0x51},{0xbb,0xad,0x25},\
 112          		 {0xbb,0xf0,0x2f},{0xbc,0xc6,0x48},{0xbd,0xf0,0x32},{0xbe,0xed,0x2a},\
 113          		 {0xbf,0xaa,0x40},{0xbf,0xcc,0x45},{0xbf,0xda,0xb2},{0xc1,0xa6,0x50},\
 114          		 {0xc1,0xcb,0x43},{0xc4,0xbe,0x31},{0xc4,0xea,0x2c},{0xc5,0xa8,0x3a},\	 
 115          		 {0xc8,0xa5,0x4b},{0xc8,0xb7,0x46},{0xc8,0xcf,0x47},{0xc8,0xd5,0x2e},\
 116          		 {0xc8,0xeb,0x4e},{0xc9,0xab,0x39},{0xc9,0xf9,0x36},{0xc9,0xfa,0x27},\
 117          		 {0xca,0xb1,0x44},{0xca,0xbc,0x41},{0xcb,0xae,0x30},{0xcb,0xcd,0x29},\
C51 COMPILER V6.12  DISPFINAL                                                              09/08/2004 09:49:09 PAGE 3   

 118          		 {0xcb,0xd9,0x38},{0xcd,0xa3,0x4c},{0xcd,0xc1,0x33},{0xcf,0xfb,0x4a},\
 119          		 {0xd1,0xba,0x49},{0xd2,0xf4,0x53},{0xd3,0xe8,0x3e},{0xd4,0xbc,0x3f},\
 120          		 {0xd4,0xc2,0x2d},{0xd4,0xd9,0x26},{0xd4,0xe7,0x28},{0xd6,0xb9,0x4d},\
 121          		 {0xd6,0xd5,0x42},{0xd6,0xf7,0x34},{0xd7,0xe9,0x3d},{0xe5,0x68,0x24},\
 122          		 {0xfe,0xfe,0x2b}};
 123          unsigned char code month1_dates[13]={31,31,28,31,30,31,30,31,31,30,31,30,31};
 124          unsigned char code month2_dates[13]={31,31,29,31,30,31,30,31,31,30,31,30,31};
 125          //-----------------------------------------------------------------------------------
 126          //define receive buffer 
 127          
 128          unsigned char data receive_bcc;
 129          unsigned char data REC_ADDR;
 130          unsigned char data receive_count;
 131          unsigned char data disp_lines;
 132          unsigned char data disp_words;
 133          unsigned char data start_blink;
 134          unsigned char data end_blink;
 135          unsigned char data disp_count=0;
 136          unsigned char data addr_count=0;
 137          unsigned char data receive_buf[29];
 138          unsigned char data receive_buf1[29];
 139          unsigned char idata receive_buf2[29];
 140          unsigned char bdata flag;
 141          		sbit receive_flag=flag^0;
 142          		sbit command=flag^1;
 143          		sbit addr_mark=flag^2;
 144          		sbit second=flag^3;
 145          		sbit leap=flag^4;
 146          		sbit change=flag^5;
 147          		sbit black1=flag^6;
 148          		sbit black2=flag^7;
 149          unsigned char bdata flag1;
 150          		sbit required=flag1^0;
 151          		sbit close1=flag1^1;
 152          		sbit close2=flag1^2;
 153          		sbit closedate1=flag1^3;
 154          		sbit closedate2=flag1^4;
 155          		sbit oneday=flag1^5;
 156          		sbit already=flag1^6;
 157          
 158          
 159          
 160          //define i/o port 
 161          		sbit osd1_cs=P1^3;
 162          		sbit osd2_cs=P1^6;
 163          		sbit osd_busy=P1^0;
 164          		sbit osd_reset=P1^4;
 165          		sbit k_4053c=P1^5;
 166          		sbit alarm=P1^7;
 167          		sbit sw1=P3^2;
 168          		sbit sw2=P3^3;
 169          		sbit AD16=P3^4;
 170          		sbit AD17=P3^5;
 171          //sfr          SCONF=0xbf;
 172          //-----------------------------------------------------------------------
 173          //define 
 174          //void delay(void);
 175          void system_init(void);
 176          void monitor(void);
 177          void detemine_command(void);
 178          void clear_disp(void);
 179          void timer_position(void);
C51 COMPILER V6.12  DISPFINAL                                                              09/08/2004 09:49:09 PAGE 4   

 180          void timer_setup(void);
 181          void dot_download(void);
 182          void write_osd(void);
 183          unsigned char get_strokes(unsigned char);
 184          void write_osd_date(void) ;//reentrant;
 185          void write_osd_time(void) ;//reentrant;
 186          unsigned char read_ds1287(unsigned char);
 187          extern left_shift(unsigned char);
 188          extern unsigned char take_char(unsigned int);
 189          void create_chararter(unsigned int);
 190          //void write_osd_cram(void);
 191          void write_osd_vram(unsigned char,unsigned char);
 192          void create_character(unsigned int);
 193          void osd_control(void);
 194          void initialize_osd(void);
 195          void disp_character(void);
 196          extern read_dot(unsigned int);
 197          unsigned char get_strokes(unsigned char);
 198          unsigned char get_ch_strokes(unsigned char,unsigned char);
 199          void write_osd(void);
 200          void delay(unsigned char);
 201          void separate_half_date(void);
 202          void separate_half_time(void);
 203          void release_alarm(void);
 204          void video_change(void);
 205          void background_set(void);
 206          void close_time(void);
 207          void close_date(void);
 208          unsigned long calculate_addr(unsigned char,unsigned char);
 209          //------------------------------------------------------------------------------------------
 210          //the main program start here
 211          //------------------------------------------------------------------------------------------
 212          void main()
 213          		{
 214   1      		osd_reset=0;
 215   1      		delay(20);
 216   1      		osd_reset=1;
 217   1      		system_init();
 218   1      		monitor();
 219   1      		 }
 220          //--------------------------------------------------------------------------------------
 221          void delay(unsigned char n)
 222          		{
 223   1      			unsigned int i;
 224   1      			for(i=0;i<200*n;i++)
 225   1      				_nop_();
 226   1      		}
 227          		
 228          //-----------------------------------------------------------------------------------------
 229          void system_init(void)
 230          		{
 231   1      	//	 register unsigned char i;
 232   1      	 	 TMOD=0x21;
 233   1      //		 IP=0x02;       //don't set 9.8
 234   1      		 SCON=0x50;
 235   1      		 PCON|=0x80;
 236   1      	 	 leap=1; 			//;闰年标志
 237   1      		 TR1=1;
 238   1      		 TH1=TL1=0xf3;
 239   1      //		 TH1=TL1=0xfa;
 240   1      		 TH0=0xf8;
 241   1      		 TL0=0x30;
C51 COMPILER V6.12  DISPFINAL                                                              09/08/2004 09:49:09 PAGE 5   

 242   1      		 osd_control();
 243   1      		 clear_disp();
 244   1      		 IE=0x92;
 245   1      		 TR0=1;
 246   1      		 }
 247          //--------------------------------------------------------------------------
 248          void monitor(void)
 249          		{
 250   1      		 while(1)
 251   1      			{
 252   2      			if(receive_flag) detemine_command();
 253   2      			if(!sw1) 
 254   2      				{
 255   3      				k_4053c=0;
 256   3      				alarm=0;
 257   3      				}
 258   2      			else
 259   2      				{
 260   3      				if(!sw2) 
 261   3      					{
 262   4      					k_4053c=1;
 263   4      					alarm=0;
 264   4      					}
 265   3      				}
 266   2      			if(second)	
 267   2      				{
 268   3      				second=0;
 269   3      				if(close1) osd1_cs=1;
 270   3      				else       osd1_cs=0;
 271   3      				if(close2) osd2_cs=1;
 272   3      				else	   osd2_cs=0;
 273   3      				while(osd_busy);
 274   3      				write_osd_time();
 275   3      				while(osd_busy);
 276   3      				osd1_cs=1;
 277   3      				osd2_cs=1;
 278   3      				}
 279   2      			if(oneday)
 280   2      				{
 281   3      				oneday=0;
 282   3      				if(!close1)
 283   3      					{
 284   4      					if(closedate1) 	osd1_cs=1;
 285   4      					else       		osd1_cs=0;
 286   4      					}
 287   3      				if(!close2)
 288   3      					{
 289   4      					if(closedate2) 	osd2_cs=1;
 290   4      					else	   		osd2_cs=0;
 291   4      					}
 292   3      				while(osd_busy);
 293   3      				write_osd_date();
 294   3      				while(osd_busy);
 295   3      				osd1_cs=1;
 296   3      				osd2_cs=1;
 297   3      				}
 298   2      		  	}
 299   1      		}
 300          
 301          //---------------------------------------------------------------------
 302          void osd_control(void)
 303          		{	 
C51 COMPILER V6.12  DISPFINAL                                                              09/08/2004 09:49:09 PAGE 6   

 304   1      			osd1_cs=0;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -