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

📄 osd.lst

📁 用51单片机实现的在屏幕上显视文字,外接一颗MT230OSDIC
💻 LST
字号:
C51 COMPILER V7.07   OSD                                                                   12/01/2003 15:27:38 PAGE 1   


C51 COMPILER V7.07, COMPILATION OF MODULE OSD
OBJECT MODULE PLACED IN OSD.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\c51.exe OSD.c DB OE SMALL ROM(LARGE)

stmt level    source

   1          #include "golbal.h"
   2          
   3          BYTE data CursorX;
   4          BYTE data CursorY;
   5          
   6          BYTE code HexTab[16]={_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f};
   7          BYTE code NullRow[31]={__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__
             -,__,__,DataEnd};
   8          
   9          enum window
  10          {
  11            window1=1,
  12            window2,
  13            window3,
  14            window4
  15          };
  16          
  17          void gotoxy(BYTE x, BYTE y)
  18          {
  19   1        CursorX=x;
  20   1        CursorY=y;
  21   1      }
  22          
  23          void SetOSDAttribute(BYTE color)
  24          {
  25   1        byM230_OSDRA=CursorY|OSD_ATTRIBUTE;
  26   1        byM230_OSDCA=CursorX;
  27   1        byM230_OSDDT0=color;  
  28   1       }
  29          
  30          void SetOSDDisplay(BYTE font, bit page2)
  31          {
  32   1        byM230_OSDRA=CursorY|OSD_DISPLAY;
  33   1        byM230_OSDCA=CursorX;
  34   1        
  35   1        if(page2)
  36   1           {
  37   2             byM230_OSDDT1=font;
  38   2            }
  39   1        else
  40   1           {
  41   2             byM230_OSDDT0=font;
  42   2            }
  43   1      }
  44          
  45          void PrintChar(BYTE FontCode, BYTE Color, bit Page2)
  46          {
  47   1        SetOSDDisplay(FontCode,Page2);
  48   1        SetOSDAttribute(Color);
  49   1      
  50   1        CursorX++;
  51   1      
  52   1        if(CursorX>29)
  53   1              {
  54   2                CursorX=0;
C51 COMPILER V7.07   OSD                                                                   12/01/2003 15:27:38 PAGE 2   

  55   2                CursorY++;
  56   2              }
  57   1      
  58   1        if(CursorY>14)
  59   1              {
  60   2                CursorY=0;
  61   2              }
  62   1      }
  63          
  64          void PrintString(BYTE *string, BYTE color)
  65          {
  66   1        while((*string)!=DataEnd)
  67   1        {
  68   2          if((*string)==SecondPage)
  69   2              {
  70   3                string++;
  71   3                PrintChar(*string, color, 1);
  72   3              }
  73   2          else
  74   2              {
  75   3                PrintChar(*string, color, 0);
  76   3               }
  77   2              
  78   2              string++;
  79   2        }
  80   1      }
  81          
  82          void PrintDec(BYTE value, BYTE color)
  83          {
  84   1        BYTE data buf[3];
  85   1      
  86   1        buf[2]=value/0x64;
  87   1        buf[1]=(value%0x64)/0x0a;
  88   1        buf[0]=(value%0x64)%0x0a;
  89   1      
  90   1        if(buf[2]==0x00)
  91   1              {
  92   2                PrintChar(__,color,0);
  93   2               }
  94   1        else
  95   1              {
  96   2                PrintChar(HexTab[buf[2]], color, 0);
  97   2               }
  98   1        
  99   1        PrintChar(HexTab[buf[1]], color, 0);
 100   1        PrintChar(HexTab[buf[0]], color, 0);
 101   1      }
 102          
 103          void PrintHex(BYTE value, BYTE color)
 104          {
 105   1        PrintChar(HexTab[value/16], color, 0);
 106   1        PrintChar(HexTab[value%16], color, 0);
 107   1      }
 108          
 109          #define GAUGE_DEGREE    5
 110          #define GAUGE_LENGTH    16
 111          #define MAX_GAUGE               (GAUGE_DEGREE*GAUGE_LENGTH)
 112          
 113          
 114          void PrintBar(BYTE value, BYTE color)
 115          {
 116   1        BYTE data full,i;
C51 COMPILER V7.07   OSD                                                                   12/01/2003 15:27:38 PAGE 3   

 117   1         
 118   1         BYTE code NFULL_CODE[GAUGE_DEGREE]=
 119   1         {
 120   1            _BAR_EMP,_BAR_1, _BAR_2, _BAR_3,_BAR_F
 121   1         };
 122   1      
 123   1         value=MAX_GAUGE*value/(MaxValue-MinValue);
 124   1         full=value/GAUGE_DEGREE;
 125   1      
 126   1         if( (value==0) && (full==0) )
 127   1         {
 128   2            for(i=0;i<GAUGE_LENGTH;i++)
 129   2            {
 130   3               PrintChar(_BAR_EMP, color, 0);
 131   3            }
 132   2            //PrintChar(_BAR_END,color, 0);
 133   2            return;
 134   2         }
 135   1      
 136   1        for(i=0;i<GAUGE_LENGTH;i++)
 137   1         {
 138   2            if(i<full)
 139   2            {
 140   3               PrintChar(_BAR_F,color, 0);
 141   3            }
 142   2            else if(i==full)
 143   2            {
 144   3               PrintChar(NFULL_CODE[value%GAUGE_DEGREE],color, 0);
 145   3            }
 146   2            else
 147   2            {
 148   3               PrintChar(_BAR_EMP,color, 0);
 149   3            }
 150   2            
 151   2         }
 152   1         //PrintChar(_BAR_END,color, 0);   
 153   1      }
 154          
 155          void PrintOneBar(BYTE Cstart, BYTE Rstart, BYTE color)
 156          {
 157   1        BYTE data data_value; 
 158   1        BYTE data bar_value;
 159   1      
 160   1        bar_value=WorkValue;
 161   1        data_value=(bar_value-MinValue)*100/(MaxValue-MinValue);
 162   1      
 163   1        gotoxy(19,7);
 164   1        
 165   1        PrintDec(data_value, color);
 166   1      
 167   1        gotoxy(Cstart,Rstart);                       
 168   1        //PrintChar(_BAR_S,color,0);
 169   1        PrintBar(bar_value, color);
 170   1      }
 171          
 172          void InitialOSD(void)
 173          {
 174   1        BYTE data i;
 175   1        
 176   1        CloseOSD();
 177   1        //ClearOSD();
 178   1        
C51 COMPILER V7.07   OSD                                                                   12/01/2003 15:27:38 PAGE 4   

 179   1        byM230_RSPACE=0x00;
 180   1        //byM230_HORD=OSDHPos;
 181   1        //byM230_VERTD=OSDVPos;
 182   1        byM230_CH=0x00;
 183   1        byM230_CHSC=0x00;
 184   1        byM230_FSSTP=0x00;
 185   1        byM230_WINSW=0x00;
 186   1        byM230_WINSH=0x00;
 187   1      
 188   1         for(i=0;i<4;i++)
 189   1              {
 190   2               CloseOSDWindow(i);  
 191   2              }
 192   1      
 193   1         for(i=0;i<=14;i++)
 194   1              {
 195   2                byM230_OSDRA=i;
 196   2                byM230_OSDCA=30;
 197   2                byM230_OSDDT0=0x00;
 198   2              }
 199   1      }
 200          
 201          void OpenOSD(void)
 202          {
 203   1        byM230_OSDCON=OSD_ENABLE;
 204   1      }
 205          
 206          void CloseOSD(void)
 207          {
 208   1              byM230_OSDCON=WEN_Clr+RAM_Clr;
 209   1              DelayX1ms(1);
 210   1              byM230_OSDCON=0x00;
 211   1      }
 212          
 213          void CloseOSDWindow(BYTE WinNo)
 214          {
 215   1        switch(WinNo)
 216   1           {
 217   2              case window1:
 218   2                      byM230_W1COL1=0x00;
 219   2                      break;
 220   2                      
 221   2              case window2:
 222   2                      byM230_W2COL1=0x00;
 223   2                      break;
 224   2                      
 225   2              case window3:
 226   2                      byM230_W3COL1=0x00;
 227   2                      break;
 228   2                      
 229   2              case window4:
 230   2                      byM230_W4COL1=0x00;
 231   2                      break;
 232   2                      
 233   2              default:
 234   2                      break;
 235   2              }
 236   1      }
 237          
 238          void ClearRow(BYTE row, BYTE color)
 239          {
 240   1        gotoxy(CursorX,row);
C51 COMPILER V7.07   OSD                                                                   12/01/2003 15:27:38 PAGE 5   

 241   1        PrintString(NullRow, color);
 242   1      }
 243          
 244          void SetWindow(BYTE CStart,BYTE CEnd,BYTE RStart,BYTE REnd,BYTE Color,BYTE WinNum)
 245          {
 246   1        switch(WinNum)
 247   1              {
 248   2                case window1:
 249   2                      byM230_W1ROW=(RStart<<4)|REnd;
 250   2                              byM230_W1COL1=((CStart<<3)|WEN_En)&0xfe;
 251   2                              byM230_W1COL2=(CEnd<<3)|(Color&0x07);
 252   2                              break;
 253   2                      
 254   2              case window2:
 255   2                      byM230_W2ROW=(RStart<<4)|REnd;
 256   2                              byM230_W2COL1=((CStart<<3)|WEN_En)&0xfe;
 257   2                              byM230_W2COL2=(CEnd<<3)|(Color&0x07);
 258   2                              break;
 259   2                      
 260   2              case window3:
 261   2                      byM230_W3ROW=(RStart<<4)|REnd;
 262   2                              byM230_W3COL1=((CStart<<3)|WEN_En)&0xfe;
 263   2                              byM230_W3COL2=(CEnd<<3)|(Color&0x07);
 264   2                              break;
 265   2                      
 266   2              case window4:
 267   2                      byM230_W4ROW=(RStart<<4)|REnd;
 268   2                              byM230_W4COL1=((CStart<<3)|WEN_En)&0xfe;
 269   2                              byM230_W4COL2=(CEnd<<3)|(Color&0x07);
 270   2                              break;
 271   2                      
 272   2              default:
 273   2                              break;
 274   2               }
 275   1      }
 276          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    746    ----
   CONSTANT SIZE    =     52    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2      11
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       2
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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