probier den code einmal aus.
evtl musst du den AVR noch ändern.
mfg pebisoft
Code:
Declare Sub Kom_werte(byval Ee_adresse As Byte)
$regfile = "m16def.dat"
$crystal = 16000000
$baud = 9600
Config Scl = Portc.0
Config Sda = Portc.1
Dim Kom_daten As Byte , Kom_temp As Byte
Dim Kom_ausgabe As Word
Dim Kom_adresse As Byte
Kom_adresse = 2
Do
Call Kom_werte(kom_adresse)
Print Kom_ausgabe
Waitms 200
Loop
End
Function Kom_werte(byval Ee_adresse As Byte)
Disable Interrupts
I2cstart
I2cwbyte &B11000000 , Ack
I2cwbyte Ee_adresse
Waitms 10
I2cstart
I2cwbyte &B11000001 , Ack
I2crbyte Kom_daten , Ack
I2crbyte Kom_temp , Nack
Kom_ausgabe = Kom_daten * 256
Kom_ausgabe = Kom_ausgabe + Kom_temp
I2cstop
Enable Interrupts
End Function
Lesezeichen