HT1380实时时钟驱动程序(EMC)[zt] |
HT1380实时时钟驱动程序 HT1380 EQU 0X06 COUNT0 EQU 0X10 TXBUF EQU 0X11 RXBUF EQU 0X12 DATABUF EQU 0X13 ADDRPOINT EQU 0X14 HT_SDA_IN EQU 0B01001000 HD_SDA_OUT EQU 0B00001000 HT_SCL EQU 0 HT_RST EQU 1 Ht_SDA EQU 2 ; TX_1380: MOV A,@HT_SDA_OUT IOW HT1380 BC HT1380,HT_SCL MOV A,@8 MOV COUNT0,A TX_1380_LP: BC HT1380,HT_SDA JBC TXBUF,0 BS HT1380,HT_SDA BS HT1380,HT_SCL RRC TXBUF BC HT1380,HT_SCL DJZ COUNT0 JMP TX_1380_LP RET ;读HT1380子程序 READ_HT: MOV TXBUF,A BC HT1380,HT_SCL BS HT1380,HT_RST MOV A,@HT_SDA_OUT IOW HT1380 MOV A,@8 MOV COUNT0,A TX_1_LP: BC HT1380,HT_SDA JBC TXBUF,0 BS HT1380,HT_SDA BS HT1380,HT_SCL RRC TXBUF BC HT1380,HT_SCL DJZ COUNT0 JMP TX_1_LP MOV A,@HT_SDA_IN IOW HT1380 MOV A,@8 MOV COUNT0,A RX_1380_LP: RRC RXBUF BC RXBUF,7 JBC HT1380,HT_SDA BS RXBUF,7 BS HT1380,HT_SCL BC HT1380,HT_SCL DJZ COUNT0 JMP RX_1380_LP BC HT1380,HT_RST RET ;写HT1380子程序 WRITE_HT: MOV ADDRPOINT,A BC HT1380,HT_SCL BS HT1380,HT_RST MOV A,@0B1000110 MOV TXBUF,A CALL TX_1380 CLR TXBUF CALL TX_1380 BC HT1380,HT_RST NOP BS HT1380,HT_RST MOV A,ADDRPOINT MOV TXBUF,A CALL TX_1380 MOV A,DATABUF MOV TXBUF,A CALL TX_1380 BC HT1380,HT_RST NOP BS HT1380,HT_RST MOV A,@0B10001110 MOV TXBUF,A CALL TX_1380 MOV A,@0B10000000 MOV TXBUF,A CALL TX_1380 BC HT1380,HT_RST MOV A,HT_SDA_IN IOW HT1380 RET END |
文章评论(0条评论)
登录后参与讨论