I2C VB Api


'***************************************************************************/
'* IIC-Seriell - Interface Routinen für VB
'* Version 0.1 : 27.1.2001 / Ingo Gerlach DH1AAD
'*
'* Je nachdem welches Interface eingesetzt wird, muss das jeweilige
'* VB - Modul eingesetzt werden.
'*
'* Seriell  -> I2C_SER.BAS, NT I2C_NT_SER.BAS
'* Paralell -> I2C_PAR.BAS, NT I2C_NT_PAR.BAS
'*
'* 0.3 : 21.05.2002 : Anpassung Linux / Windows
'* 0.2 : 17.02.2002 : ....
'* 0.1 : 27.01.2001 : DLL für WIN95/98
'*
'***************************************************************************/

Option Explicit

' Functionen f�r das Interface
' High Level
Declare Function init_iic Lib "I2C_SER" (ByVal PortNr As Long) As Long
Declare Function deinit_iic Lib "I2C_SER" () As Long
Declare Function set_port_delay Lib "I2C_SER" (ByVal Delay As Long) As Long
Declare Function iic_start Lib "I2C_SER" () As Long
Declare Function iic_stop Lib "I2C_SER" () As Long
Declare Function iic_send_byte Lib "I2C_SER" (ByVal sbyte As Long) As Long
Declare Function iic_read_byte Lib "I2C_SER" (ByVal ack As Long) As Long


' Low Level Access
Declare Function read_sda Lib "I2C_SER" () As Long
Declare Function read_scl Lib "I2C_SER" () As Long
Declare Function iic_ok Lib "I2C_SER" () As Long
Declare Function wait_port Lib "I2C_SER" () As Long
Declare Function sda_high Lib "I2C_SER" () As Long
Declare Function sda_low Lib "I2C_SER" () As Long
Declare Function scl_high Lib "I2C_SER" () As Long
Declare Function scl_low Lib "I2C_SER" () As Long


' Dummy (nur verf�gbar f�r Paralellport)
Declare Function set_strobe Lib "I2C_SER" (ByVal Status As Long) As Long
Declare Function byte_out Lib "I2C_SER" (ByVal Status As Long) As Long
Declare Function byte_in Lib "I2C_SER" (ByVal Status As Long) As Long
Declare Function get_status Lib "I2C_SER" (ByVal Status As Long) As Long
Declare Function io_disable Lib "I2C_SER" () As Long
Declare Function io_enable Lib "I2C_SER" () As Long
Declare Function inp32 Lib "I2C_SER" (ByVal Port As Long) As Long
Declare Function out32 Lib "I2C_SER" (ByVal Port As Long, ByVal sbyte As Long) As Long

'*********************************************************************************************************

' I2C Port IO , PCF 8574
Declare Function iic_tx_pcf8574 Lib "I2C_SER" (ByVal sbyte As Long, ByVal Adress As Long) As Long
Declare Function iic_rx_pcf8574 Lib "I2C_SER" (ByVal Adress As Long) As Long

' LC Display Funktionen
Declare Function lcd_init Lib "I2C_SER" () As Long
Declare Function lcd_instr Lib "I2C_SER" (ByVal cmd As Long) As Long
Declare Function lcd_wchar Lib "I2C_SER" (ByVal wchar As Long) As Long
Declare Function lcd_rchar Lib "I2C_SER" (ByRef rchar As Long, ByVal Adress As Long) As Long
Declare Function lcd_write_str Lib "I2C_SER" (ByVal rstr As String) As Long
Declare Function lcd_read_str Lib "I2C_SER" (ByVal slen As Long, ByVal Adress As Long, ByVal str As String) As Long
Declare Function lcd_backlight Lib "I2C_SER" (ByVal cmd As Long) As Long
Declare Function lcd_get_adress Lib "I2C_SER" () As Long

' I2C Port DA/AD  , PCF 8591
' Achtung alle Spannungswerte in mV !
Declare Function ad_pcf8591_init Lib "I2C_SER" (ByVal ChanMode As Long, ByVal ref As Long) As Long
Declare Function ad_pcf8591_readchan Lib "I2C_SER" (ByVal Kanal As Long, ByVal adr As Long) As Long
Declare Function ad_pcf8591_setda Lib "I2C_SER" (ByVal da_out As Long, ByVal adr As Long) As Long
Declare Function ad_pcf8591_aout Lib "I2C_SER" (ByVal Kanal As Long) As Long

' I2C PLL TSA5511
Declare Function pll_tsa5511_init Lib "I2C_SER" (ByVal Mode As Long, ByVal Quarz As Long) As Long
Declare Function pll_tsa5511_calc Lib "I2C_SER" (ByVal Freq As Long, ByVal dstep As Long) As Long
Declare Function pll_tsa5511_send Lib "I2C_SER" (ByVal Adresse As Long) As Long
Declare Function pll_tsa5511_read Lib "I2C_SER" (ByVal Adresse As Long) As Long

' I2C PLL TBB200
Declare Function pll_tbb200_init Lib "I2C_SER" (ByVal Mode As Long, ByVal RefQ As Long, ByVal prescale As Long) As Long
Declare Function pll_tbb200_calc Lib "I2C_SER" (ByVal Step As Long, ByVal Freq As Long) As Long
Declare Function pll_tbb200_send_status Lib "I2C_SER" (ByVal Status As Long) As Long
Declare Function pll_tbb200_send_r_cnt Lib "I2C_SER" () As Long
Declare Function pll_tbb200_send_n_cnt Lib "I2C_SER" () As Long

' I2C PLL SDA3302
Declare Function pll_sda3302_init Lib "I2C_SER" (ByVal Mode As Long) As Long
Declare Function pll_sda3302_calc Lib "I2C_SER" (ByVal Freq As Long, ByVal dstep As Long) As Long
Declare Function pll_sda3302_send Lib "I2C_SER" (ByVal Adresse As Long) As Long

' I2C PLL TSA6057
Declare Function pll_tsa6057_init Lib "I2C_SER" (ByVal Mode As Long,ByVal Raster As Long) As Long
Declare Function pll_tsa6057_calc Lib "I2C_SER" (ByVal Freq As Long, ByVal Raster As Long) As Long
Declare Function pll_tsa6057_send Lib "I2C_SER" (ByVal Adresse As Long) As Long

' I2C PLL TSA5523
Declare Function pll_tsa5523_init Lib "I2C_SER" (ByVal Mode As Long) As Long
Declare Function pll_tsa5523_calc Lib "I2C_SER" (ByVal Freq As Long, ByVal dstep As Long) As Long
Declare Function pll_tsa5523_send Lib "I2C_SER" (ByVal Adresse As Long) As Long
Declare Function pll_tsa5523_read Lib "I2C_SER" (ByVal Adresse As Long) As Long


© Ingo Gerlach, DH1AAD, 28.11.2003
E-Mail bitte an:IngoGerlach@Welfen-Netz.com