Sie sind hier: Home » Zentraler SE » Programm zSE » MyTWIj

$lib "MyTWI.LIB"

$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

Dim Twi_mt_curr As Byte                                     '0     resv
Dim Twi_mt_data As Word                                     '1/2   Data address
Dim Twi_mt_cntr As Byte                                     '3     Anzahl bytes

Dim Twi_mr_curr As Byte                                     '0     resv
Dim Twi_mr_data As Word                                     '1/2   Data address
Dim Twi_mr_cntr As Byte                                     '3     Anzahl bytes

'-------------------------------------
'  twi-STRUCTURE SLAVE RECV / TRANS
'-------------------------------------
Dim Twi_slv_flag As Byte                                    '0     Kontroll-flags
Dim Twi_slv_addr As Byte                                    '1     Slave adresse
Dim Twi_slv_stat As Byte                                    '2     twi-state (SLA)

Dim Twi_sr_cntr As Byte                                     '0     Anzahl bytes
Dim Twi_sr_data As Word                                     '1/2   Data-address

Dim Twi_st_cntr As Byte                                     '0     Anzahl bytes
Dim Twi_st_data As Word                                     '1/2   Data-address


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