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

📄 busio.lst

📁 采用台湾MRT晶捷公司的MRT4方案的液晶电视的程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
 301   1              SendI2CByte(index);
 302   1              if (NoAck) goto buserror;
C51 COMPILER V6.23a  BUSIO                                                                 09/10/2004 16:09:03 PAGE 6   

 303   1      
 304   1              SendI2CStop();
 305   1      
 306   1              /* I2C Start and send slave address */
 307   1              GoI2CMaster(SLAVEADDR_REGR);
 308   1              if (NoAck | BusFault) goto buserror;
 309   1      
 310   1              /* data transmit */
 311   1              val = RcvI2CByte(1);
 312   1      
 313   1      endi2c:
 314   1              /* Finish transmition */
 315   1              SendI2CStop();
 316   1              RegByteOut(0xC0, 0x3C); // Select Normal Registers
 317   1      
 318   1      
 319   1      #if DISABLEINT0
 320   1              /* restove interrupt 0 flag */
 321   1              EX0 =   IntFlag;
 322   1      #endif
 323   1      
 324   1              return(val);
 325   1      
 326   1      buserror:
 327   1      #if DEBUGMSG
                 printf("  BUS error (RegByteIn) !!!!\n");
              #endif
 330   1          goto endi2c;
 331   1      }
 332          
 333          /**********************************************
 334          * Write bit(s) of data to Mascot reg          *
 335          ***********************************************/
 336          void OSDRegBitOut(unsigned char index, unsigned char val, unsigned char mask)
 337          {
 338   1              unsigned char b;
 339   1              
 340   1              RegByteOut(0xC0, 0xBC); // Select OSD Registers
 341   1              
 342   1              b = RegByteIn(index);
 343   1              b = (b & ~mask) | val;
 344   1              OSDRegByteOut(index, b);
 345   1              
 346   1              RegByteOut(0xC0, 0x3C); // Select Normal Registers
 347   1      }
 348          
 349          /**********************************************
 350          * Write byte of data to Mascot regs           *
 351          ***********************************************/
 352          void OSDRegByteOut(unsigned char index, unsigned char val)
 353          {
 354   1      #if DISABLEINT0
 355   1              bit IntFlag;
 356   1      
 357   1              /* disable interrupt 0 */
 358   1              IntFlag = EX0;
 359   1              EX0 = 0;
 360   1      #endif
 361   1      
 362   1      
 363   1              RegByteOut(0xC0, 0xBC); // Select OSD Registers
 364   1              
C51 COMPILER V6.23a  BUSIO                                                                 09/10/2004 16:09:03 PAGE 7   

 365   1              /* I2C Start and send slave address */
 366   1              GoI2CMaster(SLAVEADDR_REGW);
 367   1              if (NoAck | BusFault) goto buserror;
 368   1      
 369   1              /* Send comm */
 370   1              SendI2CByte(WRITE_BYTE);
 371   1              if (NoAck) goto buserror;
 372   1      
 373   1              /* Send index */
 374   1              SendI2CByte(index);
 375   1              if (NoAck) goto buserror;
 376   1      
 377   1              /* data transmit */
 378   1              SendI2CByte(val);
 379   1       
 380   1      endi2c:
 381   1              /* Finish transmition */
 382   1              SendI2CStop();
 383   1              RegByteOut(0xC0, 0x3C); // Select Normal Registers
 384   1      
 385   1      
 386   1      #if DISABLEINT0
 387   1              /* restove interrupt 0 flag */
 388   1              EX0 =   IntFlag;
 389   1      #endif
 390   1          return;
 391   1      
 392   1      buserror:
 393   1      #if DEBUGMSG
                 printf("    BUS error (RegByteOut) !!!!\n");
              #endif   
 396   1          goto endi2c;
 397   1      }
 398          
 399          /**********************************************
 400          * Write bytes of data to Mascot regs          *
 401          ***********************************************/
 402          void OSDRegDataOut(unsigned char index, unsigned char *s, int cnt)
 403          {
 404   1              int data byteCnt;
 405   1      
 406   1      #if DISABLEINT0
 407   1              bit IntFlag;
 408   1      
 409   1              /* disable interrupt 0 */
 410   1              IntFlag = EX0;
 411   1              EX0 = 0;
 412   1      #endif
 413   1      
 414   1      
 415   1              RegByteOut(0xC0, 0xBC); // Select OSD Registers
 416   1              
 417   1              /* I2C Start and send slave address */
 418   1              GoI2CMaster(SLAVEADDR_REGW);
 419   1              if (NoAck | BusFault) goto buserror;
 420   1      
 421   1              /* Send comm */
 422   1              SendI2CByte(WRITE_AUTOINC);
 423   1              if (NoAck) goto buserror;
 424   1      
 425   1              /* Send index */
 426   1              SendI2CByte(index);
C51 COMPILER V6.23a  BUSIO                                                                 09/10/2004 16:09:03 PAGE 8   

 427   1              if (NoAck) goto buserror;
 428   1      
 429   1              /* data transmit */
 430   1              for(byteCnt = cnt; byteCnt > 0; byteCnt--) {
 431   2                      SendI2CByte(*s++);
 432   2                      if (NoAck) goto buserror;
 433   2              }
 434   1      
 435   1      endi2c:   
 436   1              /* Finish transmition */
 437   1              SendI2CStop();
 438   1              RegByteOut(0xC0, 0x3C); // Select Normal Registers
 439   1      
 440   1      
 441   1      #if DISABLEINT0
 442   1              /* restove interrupt 0 flag */
 443   1              EX0 =   IntFlag;
 444   1      #endif
 445   1          return;
 446   1      
 447   1      buserror:
 448   1      #if DEBUGMSG
                  printf("    BUS error (RegDataOut) !!!!\n");
              #endif
 451   1              goto endi2c;
 452   1      }
 453          
 454          
 455          
 456          #if USE_TCON
              void TconByteOut(unsigned char index, unsigned char val)
              {
                      RegByteOut(0xC0, 0x40);
                  RegByteOut(index, val);
                      RegByteOut(0xC0, 0x3C); // Select Normal Registers
              }
              #endif 
 464          
 465          /*********************************************
 466          * Send bytes of data to an Mascot device     *
 467          **********************************************/
 468          void PortDataOut(int index, unsigned char c0, unsigned char *s, int cnt)
 469          {
 470   1              int data byteCnt;
 471   1      
 472   1      #if DISABLEINT0
 473   1              bit IntFlag;
 474   1      
 475   1              /* disable interrupt 0 */
 476   1              IntFlag = EX0;
 477   1              EX0 = 0;
 478   1      #endif
 479   1      
 480   1      
 481   1              if (c0 <= 0x03) //UPDATE_HCD_REGATT 
 482   1              {
 483   2                      /* ---- I2C Start and send slave address for C0 ---- */
 484   2                      GoI2CMaster(SLAVEADDR_REGW);
 485   2                      if(NoAck | BusFault) goto buserror;
 486   2      
 487   2                      /* Send command */
 488   2                      SendI2CByte(WRITE_BYTE);
C51 COMPILER V6.23a  BUSIO                                                                 09/10/2004 16:09:03 PAGE 9   

 489   2                      if(NoAck) goto buserror;
 490   2              
 491   2                      /* Send C0 */
 492   2                      SendI2CByte(0xC0);
 493   2                      if(NoAck) goto buserror;
 494   2      
 495   2                      /* Send the contest of C0 */
 496   2                      SendI2CByte(0xBC);
 497   2                      if(NoAck) goto buserror;
 498   2      
 499   2                      SendI2CStop();
 500   2                      /* ------------- Finish C0 -------------- */
 501   2                      /* ---- I2C Start and send slave address for 78 ---- */
 502   2                      GoI2CMaster(SLAVEADDR_REGW);
 503   2                      if(NoAck | BusFault) goto buserror;
 504   2      
 505   2                      /* Send command */
 506   2                      SendI2CByte(WRITE_BYTE);
 507   2                      if(NoAck) goto buserror;
 508   2              
 509   2                      /* Send C0 */
 510   2                      SendI2CByte(0x78);
 511   2                      if(NoAck) goto buserror;
 512   2      
 513   2                      /* Send the contest of C0 */
 514   2                      SendI2CByte(c0);
 515   2                      if(NoAck) goto buserror;
 516   2      
 517   2                      SendI2CStop();
 518   2                      /* ------------- Finish 78 -------------- */
 519   2                      if(index > 511)
 520   2                      {
 521   3                              index -= 512;
 522   3                              /* ---- I2C Start and send slave address for C0 ---- */
 523   3                              GoI2CMaster(SLAVEADDR_REGW);
 524   3                              if(NoAck | BusFault) goto buserror;     
 525   3      
 526   3                              /* Send command */
 527   3                              SendI2CByte(WRITE_BYTE);
 528   3                              if(NoAck) goto buserror;
 529   3              
 530   3                              /* Send C0 */
 531   3                              SendI2CByte(0xC0);
 532   3                              if(NoAck) goto buserror;
 533   3      
 534   3                              /* Send the contest of C0 */
 535   3                              SendI2CByte(0x3D);
 536   3                              if(NoAck) goto buserror;
 537   3      
 538   3                              SendI2CStop();
 539   3                              /* ------------- Finish C0 -------------- */
 540   3                      }
 541   2                      else if (index > 255 & index<512)
 542   2                      {
 543   3                              index -= 256;
 544   3                              /* ---- I2C Start and send slave address for C0 ---- */
 545   3                              GoI2CMaster(SLAVEADDR_REGW);
 546   3                              if(NoAck | BusFault) goto buserror;     
 547   3      
 548   3                              /* Send command */
 549   3                              SendI2CByte(WRITE_BYTE);
 550   3                              if(NoAck) goto buserror;
C51 COMPILER V6.23a  BUSIO                                                                 09/10/2004 16:09:03 PAGE 10  

 551   3              
 552   3                              /* Send C0 */
 553   3                              SendI2CByte(0xC0);
 554   3                              if(NoAck) goto buserror;
 555   3      
 556   3                              /* Send the contest of C0 */
 557   3                              SendI2CByte(0x01);
 558   3                              if(NoAck) goto buserror;
 559   3      
 560   3                              SendI2CStop();
 561   3                              /* ------------- Finish C0 -------------- */
 562   3                      }
 563   2                      else  
 564   2                      {       
 565   3                              /* ---- I2C Start and send slave address for C0 ---- */
 566   3                              GoI2CMaster(SLAVEADDR_REGW);
 567   3                              if(NoAck | BusFault) goto buserror;     
 568   3      
 569   3                              /* Send command */
 570   3                              SendI2CByte(WRITE_BYTE);
 571   3                              if(NoAck) goto buserror;
 572   3              
 573   3                              /* Send C0 */
 574   3                              SendI2CByte(0xC0);
 575   3                              if(NoAck) goto buserror;
 576   3      
 577   3                              /* Send the contest of C0 */
 578   3                              SendI2CByte(0x00);
 579   3                              if(NoAck) goto buserror;
 580   3      
 581   3                              SendI2CStop();
 582   3                              /* ------------- Finish C0 -------------- */
 583   3                      }
 584   2              }
 585   1              else    //(c0 > 0x03)
 586   1              {
 587   2                      if (index > 255)
 588   2                      {
 589   3                              c0++;
 590   3                              index -= 256;
 591   3                      }       
 592   2                      /* ---- I2C Start and send slave address for C0 ---- */
 593   2                      GoI2CMaster(SLAVEADDR_REGW);
 594   2                      if(NoAck | BusFault) goto buserror;
 595   2      
 596   2                      /* Send command */
 597   2                      SendI2CByte(WRITE_BYTE);
 598   2                      if(NoAck) goto buserror;
 599   2              
 600   2                      /* Send C0 */
 601   2                      SendI2CByte(0xC0);
 602   2                      if(NoAck) goto buserror;
 603   2      
 604   2                      /* Send the contest of C0 */
 605   2                      SendI2CByte(c0);
 606   2                      if(NoAck) goto buserror;
 607   2      
 608   2                      SendI2CStop();

⌨️ 快捷键说明

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