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

📄 t100.lst

📁 车载显示器
💻 LST
📖 第 1 页 / 共 3 页
字号:
 603   2                                              OSDCtrl(0);
 604   2                                              Repeat_Times=0xff;
 605   2                                              break;
 606   2                                      case kyDEC://0x04
 607   2                                              OSDCtrl(-1);
 608   2                                              if(Repeat_Times==0xff)Repeat_Times=5;
 609   2                                              else Repeat_Times=0;
 610   2                                              break;
 611   2                                      case kyINC://0x02
 612   2                                              OSDCtrl(1);
C51 COMPILER V6.12  T100                                                                   08/25/2007 18:38:52 PAGE 11  

 613   2                                              if(Repeat_Times==0xff)Repeat_Times=5;
 614   2                                              else Repeat_Times=0;
 615   2                                              break;
 616   2                                      default:  Repeat_Times=0xff;
 617   2      #endif
 618   2                              }//*/
 619   2      /*			if(!kyFULL_43)	//P0^6
 620   2      			{
 621   2                 		bFULL_43=!bFULL_43;
 622   2      				SetMode();
 623   2      			}
 624   2      			if(!kyUD_LR)	//P0^5
 625   2      				SetUD_LR();
 626   2      			if(!kySOURCE)	//P0^4
 627   2      			{
 628   2      				cSource++;
 629   2      				if(cSource>6)cSource=2;
 630   2      				SetSource();
 631   2      				SetMode();
 632   2      			}
 633   2      /*				P0	 = 0xff;
 634   2      				cKey_Curr = 0xff -( P0 | 0x8F );*/
 635   2      			//Delay_ms(2);
 636   2              }
 637   1              else if(cKey_Curr&0x06){Repeat_Times-=1;Delay_ms(2);}
 638   1      
 639   1      }
 640          #ifdef OSD_EN
 641          void OSDShowLine(uCHAR *string,uCHAR x,uCHAR y,uCHAR cColor);
 642          void OSDDrawGauge(uCHAR cVal, uCHAR x, uCHAR y, uCHAR cColor);
 643          void LoadFont(void);
 644          void LoadMenu(void);
 645          void ShowOSDData(void);
 646          void LoadData(void);
 647          void SaveData(void);
 648          void InitOSD(void)
 649          {
 650   1          LoadFont();
 651   1          LoadMenu();
 652   1          LoadData();
 653   1          ShowOSDData();
 654   1          OSDDisable();
 655   1      }
 656          void LoadFont(void)
 657          {
 658   1      	unsigned int i;
 659   1              StartCondition();
 660   1              Send_Byte(0x50);
 661   1              Send_Byte(0xA4);
 662   1              for(i=0; i<35*18; i++){
 663   2              	Send_Byte(font_00[2*i]);
 664   2         	        Send_Byte(font_00[2*i+1]);
 665   2      	       }
 666   1         //0xc00==1024*3;
 667   1      	for(; i<0x360; i++){
 668   2         	        Send_Byte(0x00);
 669   2                      Send_Byte(0x00);
 670   2      	}//*/
 671   1       	StopCondition();
 672   1      }
 673          void LoadMenu(void)
 674          {
C51 COMPILER V6.12  T100                                                                   08/25/2007 18:38:52 PAGE 12  

 675   1          uCHAR i;
 676   1          for(i=0;i<4;i++)
 677   1          {
 678   2              OSDShowLine(iBlankLine,0,i,COL_NORMAL);
 679   2          }
 680   1              OSDShowLine(iBright_ICON,0,0,COL_NORMAL);
 681   1      
 682   1              OSDShowLine(iColor_ICON,0,1,COL_NORMAL);
 683   1      
 684   1              OSDShowLine(iScreen_ICON,0,2,COL_NORMAL);
 685   1      
 686   1              OSDShowLine(iScreen_ICON,0,3,COL_NORMAL);
 687   1      
 688   1              OSDShowLine(iFULL_ICON,LINE_LENGTH-2,3,COL_NORMAL);
 689   1      
 690   1              OSDShowLine(i4_3_ICON,LINE_LENGTH-3,2,COL_NORMAL);
 691   1                        OSDDrawGauge(cColor,3,1,COL_GAUGE);
 692   1                        OSDDrawGauge(cBright,3,0,COL_GAUGE);
 693   1      }
 694          void ShowOSDData(void)
 695          {
 696   1          switch(cOSDFunc)
 697   1          {
 698   2              case 1:
 699   2                        OSDDrawGauge(cBright,3,0,COL_GAUGE);
 700   2                      break;
 701   2              case 2:
 702   2                        OSDDrawGauge(cColor,3,1,COL_GAUGE);
 703   2                      break;
 704   2              case 3: break;
 705   2              }
 706   1      }
 707          
 708          void OSDSetRamAddr(int address)
 709          {
 710   1      	I2CWriteByte(TW100,0xA3,(uCHAR)(address>>8));
 711   1        	I2CWriteByte(TW100,0xA2,(uCHAR)(address & 0xff));
 712   1      }
 713          void OSDShowLine(uCHAR *string,uCHAR x,uCHAR y,uCHAR cColor)
 714          {
 715   1      	if((x < 30) && ( y < 0x28))
 716   1        	{
 717   2      	OSDSetRamAddr(MENU_START_ADDR+((int)y << 5)+x);
 718   2              StartCondition();
 719   2              Send_Byte(0x50);
 720   2              Send_Byte(0xA4);
 721   2           	while((*string) != EOL && (x < LINE_LENGTH))
 722   2           	{
 723   3           		Send_Byte(*string++);
 724   3              	Send_Byte(cColor );
 725   3              	x++;
 726   3        		}
 727   2         	StopCondition();
 728   2      	}
 729   1      }
 730          
 731          void OSDDrawGauge(uCHAR cVal,  uCHAR x, uCHAR y, uCHAR cColor)
 732          {
 733   1           uCHAR cTemp1,cTemp2,i=8;
 734   1           cTemp1=cVal/2;
 735   1           cTemp2=cVal%2;
 736   1           OSDSetRamAddr(MENU_START_ADDR+((int)y << 5)+x);
C51 COMPILER V6.12  T100                                                                   08/25/2007 18:38:52 PAGE 13  

 737   1              StartCondition();
 738   1              Send_Byte(0x50);
 739   1              Send_Byte(0xA4);
 740   1           while(i)
 741   1           {
 742   2              if(cTemp1==0)
 743   2              {
 744   3                if(i==8)Send_Byte(0x0A+cTemp2);
 745   3                else if(i==1)Send_Byte(0x10+cTemp2);
 746   3                else Send_Byte(0x0D+cTemp2);
 747   3               Send_Byte(cColor);
 748   3                i--;
 749   3                break;
 750   3               }
 751   2               else
 752   2               {
 753   3                if(i==8)Send_Byte(0x0C);
 754   3                else if(i==1)Send_Byte(0x12);
 755   3                else Send_Byte(0x0F);
 756   3               }
 757   2               Send_Byte(cColor);
 758   2               cTemp1--;
 759   2               i--;
 760   2            }
 761   1            while(i)
 762   1            {
 763   2               if(i>1)Send_Byte(0x0D);
 764   2               else   Send_Byte(0x10);
 765   2               Send_Byte(cColor);
 766   2               i--;
 767   2            }
 768   1            StopCondition();
 769   1            //Num
 770   1           cTemp1=cVal/10;
 771   1           cTemp2=cVal%10;
 772   1           i=cVal/10;
 773   1      /*     cTemp1=(cVal%100)/10;
 774   1           cTemp2=cVal%10;//*/
 775   1           OSDSetRamAddr(MENU_START_ADDR+((int)(y) << 5)+(LINE_LENGTH-2));
 776   1              StartCondition();
 777   1              Send_Byte(0x50);
 778   1              Send_Byte(0xA4);
 779   1              if(i)Send_Byte(i+0x13);
 780   1              else Send_Byte(BLANK);
 781   1               Send_Byte(cColor);
 782   1              Send_Byte(cTemp2+0x13);
 783   1               Send_Byte(cColor);
 784   1            StopCondition();
 785   1      
 786   1      }
 787          void  OSDDisable(void)
 788          {
 789   1         I2CWriteTbl(OSDDisableTbl);
 790   1      }
 791          void OSDEnable(void)
 792          {
 793   1         uCHAR cTemp[8];
 794   1         cTemp[0]=TW100;
 795   1         cTemp[1]=5;
 796   1         cTemp[2]=0xa0;
 797   1         cTemp[3]=3;
 798   1         cTemp[4]=Y_INC;
C51 COMPILER V6.12  T100                                                                   08/25/2007 18:38:52 PAGE 14  

 799   1         cTemp[5]=0x05;
 800   1         cTemp[6]=23+(cOSDFunc-1);
 801   1         if((cOSDFunc==3)&&bFULL_43)cTemp[6]+=1;
 802   1         cTemp[7]=EOT;
 803   1         I2CWriteTbl(cTemp);
 804   1         cTemp[5]=0x1E;
 805   1         I2CWriteTbl(cTemp);
 806   1         I2CWriteTbl(OSDEnableTbl);
 807   1      }
 808          void OSDCtrl(char cDir)
 809          {
 810   1      	uCHAR cTemp;
 811   1              switch(cOSDFunc)
 812   1              {
 813   2                      case 0: OSDDisable();return;
 814   2                      case 1:
 815   2                            if((cBright==0x10)&&(cDir==1))return;
 816   2                            if((cBright==0x00)&&(cDir==-1))return;
 817   2                            cBright+=cDir;
 818   2      					 if(cBright<16)cTemp=cBright*16;
 819   2      					 else cTemp=0xff;
 820   2                            I2CWriteByte(TW100,0x69,cTemp);
 821   2                            break;
 822   2                      case 2:
 823   2                            if((cColor==0xfc)&&(cDir==1))return;
 824   2                            if((cColor==0x00)&&(cDir==-1))return;
 825   2                            cColor+=cDir*4;
 826   2      					 if(cColor<16)cTemp=cColor*16;
 827   2      					 else cTemp=0xff;
 828   2                            I2CWriteByte(TW100,0x6c,cTemp);
 829   2                            break;
 830   2                      case 3:
 831   2                            if(Repeat_Times==0)return;
 832   2                            if(cDir)
 833   2                            {
 834   3                                bFULL_43=!bFULL_43;
 835   3                                SetMode();
 836   3                             }
 837   2                            break;
 838   2              }
 839   1              SaveData();
 840   1              ShowOSDData();
 841   1              OSDEnable();
 842   1      }
 843          
 844          
 845          void LoadData(void)
 846          {
 847   1      #ifdef NVRAM
              
              #else
 850   1              cBright=BRIGHT;
 851   1              cColor=COLOR;
 852   1      #endif
 853   1      }
 854          void SaveData(void)
 855          {
 856   1      #ifdef NVRAM
              
              #endif
 859   1      }
 860          #endif
C51 COMPILER V6.12  T100                                                                   08/25/2007 18:38:52 PAGE 15  

 861          bit m_bBKPowerOn		=1;
 862          bit m_bKyPowerOn 		=1;
 863          bit m_bChipPowerOn		=1;
 864          void PowerManage(void)
 865          {
 866   1       	if(m_bKyPowerOn) //Power on
 867   1      	{
 868   2      		I2CWriteByte(TW100, 0xE0, I2CReadByte(TW100, 0xE0)|0x80);
 869   2      		//When power on chip, force to reset chip
 870   2      		m_bChipPowerOn=1;
 871   2      		Delay_ms(50);
 872   2      		OpenPanel();
 873   2       			if(!m_bBKPowerOn)
 874   2      					BL_EN=0;
 875   2      // 				BKPower();
 876   2      	}
 877   1      	else 	//Forced Power Off
 878   1      	{
 879   2      		if(m_bChipPowerOn)
 880   2      		{
 881   3      			Delay_ms(50);
 882   3       			if(m_bBKPowerOn)
 883   3      				BL_EN=1;
 884   3      // 				BKPower();
 885   3      			ClosePanel();
 886   3      			Delay_ms(100);
 887   3      			I2CWriteByte(TW100, 0xE0, I2CReadByte(TW100, 0xE0)&0x7F);
 888   3      			m_bChipPowerOn=0;
 889   3      		}
 890   2      	}
 891   1      }
 892          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2494    ----
   CONSTANT SIZE    =   2356    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     11      40
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      7    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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