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

📄 lcd_osd.lst

📁 液晶显示器程序代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 218   1              width = width;
 219   1              if (height)
 220   1              {
 221   2                      do
 222   2                      {
 223   3                              OSD_Fact_Line(row_start, col_start, FactRow_Info[0][row_start+1], 0x00, 3);
 224   3                              //OSD_Line(row_start, col_start, width, 0x00, 3);
 225   3                              row_start++;
 226   3                      }
 227   2                      while (--height);
 228   2              }
 229   1      }
 230          
C51 COMPILER V7.06   LCD_OSD                                                               11/21/2005 13:47:29 PAGE 5   

 231          void ShowValue(unsigned char row, unsigned char col,unsigned char value, unsigned char color)
 232          {
 233   1              unsigned int idata usStart_Addr;
 234   1              unsigned char idata ucTemp;
 235   1      
 236   1              usStart_Addr = FONT_SELECT_ADDRESS;
 237   1      
 238   1              //The address of the first character Cn1 in Row n = FONT_SELECT_ADDRESS + Row0_length + Row1_length +...+
             -Row(n-1)_length
 239   1              for(ucTemp = 1; ucTemp < row+1; ucTemp ++)
 240   1                      usStart_Addr += FactRow_Info[0][ucTemp];
 241   1      
 242   1              Data[10] = value/100;
 243   1              Data[11] = (value - (Data[10]*100))/10;
 244   1              Data[12] = value - (Data[10]*100) - (Data[11]*10);
 245   1              if(0 != Data[10])
 246   1              {
 247   2                      Data[10] += _0_;
 248   2                      Data[11] += _0_;
 249   2              }
 250   1              else
 251   1              {
 252   2                      if(0 != Data[11])       Data[11] += _0_;
 253   2              }
 254   1              Data[12] += _0_;
 255   1              //Byte1
 256   1              Data[0] = 5;
 257   1              Data[1] = Y_INC;
 258   1              Data[2] = OSD_ADDR_MSB_90;
 259   1              Data[3] = (unsigned char)( ((usStart_Addr + col)  & 0x0fff) >> 8 ) | 0x50;
 260   1              Data[4] = (unsigned char)((usStart_Addr + col) & 0x00ff);
 261   1              Data[5] = 0;
 262   1              RTDWrite(Data);
 263   1              Data[0]     = 6;
 264   1              Data[1]     = N_INC;
 265   1              Data[2]     = OSD_DATA_92;
 266   1              Data[3]     = Data[10];
 267   1              Data[4]     = Data[11];
 268   1              Data[5]     = Data[12];
 269   1              Data[6]     = 0;
 270   1              RTDWrite(Data);
 271   1              //Byte2
 272   1              Data[0] = 5;
 273   1              Data[1] = Y_INC;
 274   1              Data[2] = OSD_ADDR_MSB_90;
 275   1              Data[3] = (unsigned char)( ((usStart_Addr + col)  & 0x0fff) >> 8 ) | 0x90;
 276   1              Data[4] = (unsigned char)((usStart_Addr + col) & 0x00ff);
 277   1              Data[5] = 0;
 278   1              RTDWrite(Data);
 279   1              Data[0]     = 6;
 280   1              Data[1]     = N_INC;
 281   1              Data[2]     = OSD_DATA_92;
 282   1              Data[3]     = color;
 283   1              Data[4]     = color;
 284   1              Data[5]     = color;
 285   1              Data[6]     = 0;
 286   1              RTDWrite(Data);
 287   1      }
 288          
 289          void Value_Adjust(unsigned char *Var, unsigned char Key, unsigned char VMax, unsigned char VMin)
 290          {
 291   1              if(NOTIFY_LEFT_KEY == Key)
C51 COMPILER V7.06   LCD_OSD                                                               11/21/2005 13:47:29 PAGE 6   

 292   1              {
 293   2                      if(bKeyTurbo)
 294   2                              *Var   = (*Var < (VMax - 1)) ? (*Var + 2) : VMax;
 295   2                      else
 296   2                              *Var   = (*Var < VMax) ? (*Var + 1) : VMax;
 297   2              }
 298   1              else
 299   1              {
 300   2                      if(bKeyTurbo)
 301   2                              *Var   = (*Var > (VMin + 1)) ? *Var - 2 : VMin;
 302   2                      else
 303   2                              *Var   = (*Var > VMin) ? (*Var - 1) : VMin;
 304   2              }
 305   1      }
 306          
 307          void SPREAD_Adjust(unsigned char* variable,unsigned char Key)
 308          {
 309   1              if (NOTIFY_LEFT_KEY == Key)
 310   1              {
 311   2                      if (15 <= *variable)
 312   2                              return;
 313   2       
 314   2                      if (!bKeyTurbo)
 315   2                              *variable   = 15 > *variable ? *variable + 1 : 15;
 316   2                      else
 317   2                              *variable   = 14 > *variable ? *variable + 2 : 15;
 318   2              }
 319   1              else
 320   1              {
 321   2                      if (0 == *variable)
 322   2                              return;
 323   2      
 324   2                      if (!bKeyTurbo)
 325   2                              *variable   = 0 < *variable ? *variable - 1 : 0;
 326   2                      else
 327   2                              *variable   = 1 < *variable ? *variable - 2 : 0;
 328   2              }
 329   1      }
 330          
 331          
 332          /////////////////////////////////////////////////////////////////////////////////////
 333          /////////////////////////////////////////////////////////////////////////////////////
 334          
 335          void Get_OSD_Margin(void)
 336          {
 337   1              unsigned char ucH_Min, ucH_Max, ucV_Max;
 338   1      
 339   1      #if (DISP_ALIGN)
                      RTDRead(DH_ACT_STA_27, 0x02, Y_INC);
                      Data[2] = Data[1] & 0x07;
                      Data[3] = Data[0];
              
                      ucH_Min = (((unsigned int *)Data)[1] / 4) + 1;
                      ucH_Max = OSD_HMAX;
              #else
 347   1              RTDRead(DH_ACT_END_29, 0x02, Y_INC);
 348   1              Data[2] = Data[1] & 0x07;
 349   1              Data[3] = Data[0];
 350   1      
 351   1              //ucH_Max = ((((unsigned int *)Data)[1] - 312 - 8 - 16) / 4) + 1;
 352   1              ucH_Max = ((((unsigned int *)Data)[1] - 512) / 4) + 1; 
 353   1              ucH_Min = OSD_HMIN;
C51 COMPILER V7.06   LCD_OSD                                                               11/21/2005 13:47:29 PAGE 7   

 354   1      #endif
 355   1      
 356   1              RTDRead(DV_ACT_END_34, 0x02, Y_INC);
 357   1              Data[2] = Data[1] & 0x07;
 358   1              Data[3] = Data[0];
 359   1      
 360   1              ucV_Max = (((unsigned int *)Data)[1] - DV_ACT_STA_POS - 250 - 14) / 4;
 361   1      
 362   1              Data[0] = ucH_Min;
 363   1              Data[1] = ucH_Max;
 364   1              Data[2] = OSD_VMIN;
 365   1              Data[3] = ucV_Max;
 366   1              
 367   1      }
 368          
 369          // OSD_Position : Restore OSD position according to global settings
 370          // para : OSD font parameter
 371          // OSD_GLOBAL_BLINK    : 0x10
 372          // OSD_DISP_ZONE_LEFT  : 0x04
 373          // OSD_DISP_ZONE_RIGHT : 0x08
 374          // OSD_ROTATE          : 0x02
 375          // OSD_ENABLE          : 0x01
 376          
 377          void OSD_Position(unsigned char para)
 378          {
 379   1              Get_OSD_Margin();
 380   1      
 381   1              if (Data[0] > stGUD1.OSD_POSH || Data[1] < stGUD1.OSD_POSH ||
 382   1                      Data[2] > stGUD1.OSD_POSV || Data[3] < stGUD1.OSD_POSV)
 383   1              {
 384   2                      stGUD1.OSD_POSV = OSD_VMID;
 385   2                      stGUD1.OSD_POSH = OSD_HMID;
 386   2                      Save_GUD1();
 387   2              }
 388   1      
 389   1                      if(ucOSD_Page_Index == PAGE_Factory)            //anson
 390   1                      {
 391   2                              stGUD1.OSD_POSH = 230;
 392   2                              stGUD1.OSD_POSV = 100;
 393   2                      }
 394   1      
 395   1              Wait_For_Event(EVENT_DEN_STOP);
 396   1      
 397   1              Data[0]     = 5;
 398   1              Data[1]     = Y_INC;
 399   1              Data[2]     = OSD_ADDR_MSB_90;
 400   1              Data[3]     = 0xc0;
 401   1              Data[4]     = 0x00;
 402   1              Data[5]     = 6;
 403   1              Data[6]     = N_INC;
 404   1              Data[7]     = OSD_DATA_92;
 405   1              Data[8]     = stGUD1.OSD_POSV >> 1;
 406   1              Data[9]     = (unsigned char)(stGUD1.OSD_POSH >> 2);
 407   1              Data[10]    = ((unsigned char)(stGUD1.OSD_POSH & 0x0003) << 6) | ((stGUD1.OSD_POSV & 0x01) << 5) | para;
 408   1                                      //+ (unsigned char)(OSD_Enable[10] & 0x1e) + osd_en;
 409   1              Data[11]    = 0;
 410   1              RTDWrite(Data);
 411   1      
 412   1      }
 413          
 414          void OSD_Line(unsigned char row, unsigned char col, unsigned char length,
 415                        unsigned char value, unsigned char indicate)
C51 COMPILER V7.06   LCD_OSD                                                               11/21/2005 13:47:29 PAGE 8   

 416          {
 417   1              unsigned int idata usStart_Addr;
 418   1              unsigned char idata ucTemp;
 419   1      
 420   1              usStart_Addr = FONT_SELECT_ADDRESS;
 421   1      
 422   1              //The address of the first character Cn1 in Row n = FONT_SELECT_ADDRESS + Row0_length + Row1_length +...+
             -Row(n-1)_length
 423   1              for(ucTemp = 1; ucTemp < row+1; ucTemp ++)
 424   1                      usStart_Addr += Row_Info[0][ucTemp];
 425   1      
 426   1              Data[0] = 5;
 427   1              Data[1] = Y_INC;
 428   1              Data[2] = OSD_ADDR_MSB_90;
 429   1      
 430   1              if( (col+1) > Row_Info[0][row + 1])     // if column_start > row_length, then return
 431   1                      return;
 432   1              else if((col + 1 + length) > Row_Info[0][row + 1])      // if column_start + length > row_length, then re-calc
             -ulate the length
 433   1                      length = Row_Info[0][row + 1] - col;
 434   1              
 435   1              // indicate : 0, 1, 2, 3 set byte 0, 1, 2 and all byte
 436   1              Data[3] = (unsigned char)( ((usStart_Addr + col)  & 0x0fff) >> 8 ) | (((indicate << 2) + 1) << 4);
 437   1              Data[4] = (unsigned char)((usStart_Addr + col) & 0x00ff);
 438   1              Data[5] = 0;  
 439   1              RTDWrite(Data);
 440   1      
 441   1              Data[0]     = (indicate == 3) ? length * 3 + 3 : length + 3;
 442   1              Data[1]     = BURST; 
 443   1              Data[2]     = OSD_DATA_92;
 444   1              Data[3]     = value;
 445   1              Data[4]     = 0;
 446   1              RTDWrite(Data);
 447   1              
 448   1      }     
 449          

⌨️ 快捷键说明

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