www.pudn.com > HT1621Control.rar > io_drv.i



#line 1 "Driver\io_drv.c" /0









 
  
#line 1 "system\reg51.h" /0






 
 
 
 
 
 
 sfr P0   = 0x80;
 sbit P0_0 = P0^0;
 sbit P0_1 = P0^1;
 sbit P0_2 = P0^2;
 sbit P0_3 = P0^3;
 sbit P0_4 = P0^4;
 sbit P0_5 = P0^5;
 sbit P0_6 = P0^6;
 sbit P0_7 = P0^7;
 
 sfr P1   = 0x90;
 sbit P1_0 = P1^0;
 sbit P1_1 = P1^1;
 sbit P1_2 = P1^2;
 sbit P1_3 = P1^3;
 sbit P1_4 = P1^4;
 sbit P1_5 = P1^5;
 sbit P1_6 = P1^6;
 sbit P1_7 = P1^7;
 
 sfr P2   = 0xA0;
 sbit P2_0 = P2^0;
 sbit P2_1 = P2^1;
 sbit P2_2 = P2^2;
 sbit P2_3 = P2^3;
 sbit P2_4 = P2^4;
 sbit P2_5 = P2^5;
 sbit P2_6 = P2^6;
 sbit P2_7 = P2^7;
 
 sfr P3   = 0xB0;
 sbit P3_0 = P3^0;
 sbit P3_1 = P3^1;
 sbit P3_2 = P3^2;
 sbit P3_3 = P3^3;
 sbit P3_4 = P3^4;
 sbit P3_5 = P3^5;
 sbit P3_6 = P3^6;
 sbit P3_7 = P3^7;
 
 sfr PSW  = 0xD0;
 sfr ACC  = 0xE0;
 sfr B    = 0xF0;
 sfr SP   = 0x81;
 sfr DPL  = 0x82;
 sfr DPH  = 0x83;
 sfr PCON = 0x87;
 sfr TCON = 0x88;
 sfr TMOD = 0x89;
 sfr TL0  = 0x8A;
 sfr TL1  = 0x8B;
 sfr TH0  = 0x8C;
 sfr TH1  = 0x8D;
 sfr IE   = 0xA8;
 sfr IP   = 0xB8;
 sfr SCON = 0x98;
 sfr SBUF = 0x99;
 
 
 
 
 sbit CY   = 0xD7;
 sbit AC   = 0xD6;
 sbit F0   = 0xD5;
 sbit RS1  = 0xD4;
 sbit RS0  = 0xD3;
 sbit OV   = 0xD2;
 sbit P    = 0xD0;
 
 
 sbit TF1  = 0x8F;
 sbit TR1  = 0x8E;
 sbit TF0  = 0x8D;
 sbit TR0  = 0x8C;
 sbit IE1  = 0x8B;
 sbit IT1  = 0x8A;
 sbit IE0  = 0x89;
 sbit IT0  = 0x88;
 
 
 sbit EA   = 0xAF;
 sbit ES   = 0xAC;
 sbit ET1  = 0xAB;
 sbit EX1  = 0xAA;
 sbit ET0  = 0xA9;
 sbit EX0  = 0xA8;
 
 
 sbit PS   = 0xBC;
 sbit PT1  = 0xBB;
 sbit PX1  = 0xBA;
 sbit PT0  = 0xB9;
 sbit PX0  = 0xB8;
 
 
 sbit RD   = 0xB7;
 sbit WR   = 0xB6;
 sbit T1   = 0xB5;
 sbit T0   = 0xB4;
 sbit INT1 = 0xB3;
 sbit INT0 = 0xB2;
 sbit TXD  = 0xB1;
 sbit RXD  = 0xB0;
 
 
 sbit SM0  = 0x9F;
 sbit SM1  = 0x9E;
 sbit SM2  = 0x9D;
 sbit REN  = 0x9C;
 sbit TB8  = 0x9B;
 sbit RB8  = 0x9A;
 sbit TI   = 0x99;
 sbit RI   = 0x98;
 
 
#line 11 "Driver\io_drv.c" /0
 
  
#line 1 "system\compiler.h" /0









 
 
 typedef unsigned char      Byte;
 typedef unsigned char      Uchar;
 typedef unsigned int       Uint16;
 typedef int                Int16;
 typedef float              Float16;
 typedef unsigned long int  Uint32;
 typedef long int           Int32; 
 
 
#line 12 "Driver\io_drv.c" /0
 
  
#line 1 "system\config.h" /0









 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#line 171 "system\config.h" /1
  
  
  
  
  
 
#line 177 "system\config.h" /0
 
 
 
 
 
 
 
 
 
 
 
 
 
#line 13 "Driver\io_drv.c" /0
 
  
#line 1 "driver\io_def.h" /0









 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#line 14 "Driver\io_drv.c" /0
 
  
#line 1 "driver\kbd_drv.h" /0









 
 
 
 
 void kbd_init (void);
 void kbd_task (void);
 Byte kbd_decode (void);
 void dts_FerInc (void);
 void I2c_WriteByte (Byte address, Byte bByte);
 
 extern	data    Byte    gl_kbd_tick;             
 extern	bdata	bit		key_flag;
 extern	Byte code VOL_Step_Map[];
#line 15 "Driver\io_drv.c" /0
 
 














 
 
 void getByteLSB(Byte bByte)
 {
 Byte i; 
 
 for (i=0; i<8; i++) 
 {
  P3_5 = 0;
 if (bByte & 0x01) P3_6 = 1;
 else P3_6 = 0;
 bByte >>= 1;
  P3_5 = 1;
 }
 }
 














 
 
 int dts_scanByte(void)
 {
 Byte i; 
 char bByte= 11,temp;
 
 for (i=0; i<8; i++){
  P3_5 = 0;
 if (P3_4){
 temp = 0x80;
 temp >>= i;
 bByte |= temp;
 }
  P3_5 = 1;
 }
 return (bByte);
 }
 














 
 
 void HT1621_getMSB(Byte bByte)
 {
 Byte i; 
 
 for (i=0; i<8; i++) 
 {
  P0_1 = 0;
 if (bByte & 0x80) P0_0 = 1;
 else P0_0 = 0;
 bByte <<= 1;
  P0_1 = 1;
 }
 }
 














 
 
 void HT1621_getLSB(Byte bByte)
 {
 Byte i; 
 
 for (i=0; i<8; i++) 
 {
  P0_1 = 0;
 if (bByte & 0x01) P0_0 = 1;
 else P0_0 = 0;
 bByte >>= 1;
  P0_1 = 1;
 }
 }