Sie sind hier: Home » Datenlogger V2 » Programm V2 » TWI V2

'***** Definitionen für TWI-Interfac *****
'aus: rn_wissen.de  ;  TWI Multimaster

$lib "MyTWI.LIB"                                            'Interruptroutine in Assembler

$external Twi_sense
$external Mst_start
$external Mst_stop
$external Twi_mst_slv_isr


'-------------------------------------
'  TWI-STRUCTURE MASTER
'-------------------------------------
Dim Twi_mst_flag As Byte                                    '0     Kontroll-flags
Dim Twi_mst_addr As Byte                                    '1     SLA + R/W; eigene Adresse

Dim Twi_mt_curr As Byte                                     '0     resv
Dim Twi_mt_data As Word                                     '1/2   Data Address Master Transmit
Dim Twi_mt_cntr As Byte                                     '3     Anzahl Bytes Master Transmit

Dim Twi_mr_curr As Byte                                     '0     resv
Dim Twi_mr_data As Word                                     '1/2   Data Address Master Receive
Dim Twi_mr_cntr As Byte                                     '3     Anzahl Bytes Master Receive

'-------------------------------------
'  TWI-STRUCTURE SLAVE RECV / TRANS
'-------------------------------------
Dim Twi_slv_flag As Byte                                    '0     Kontroll-flags
Dim Twi_slv_addr As Byte                                    '1     Slave Adresse; ferne Adresse
Dim Twi_slv_stat As Byte                                    '2     TWI-state (SLA)

Dim Twi_sr_cntr As Byte                                     '0     Anzahl Bytes Slave Receive
Dim Twi_sr_data As Word                                     '1/2   Data-Address Slave Receive

Dim Twi_st_cntr As Byte                                     '0     Anzahl Bytes Slave Transmit
Dim Twi_st_data As Word                                     '1/2   Data-Address Slave Transmit


Const Twi_m_sent = 1
Const Twi_m_recv = 2
Const Twi_timeout = 3
Const Twi_m_busy = 4
Const Twi_buserr = 7