Hallo
Ik probeer al een tijdje het voorbeeld programmatje zoals beschreven in het user manual van proton development version 3.1 blz.118 " interface to a 24LC32 serial eeprom "
Dit doe ik met het simulatie prog. proteus.
Ik zou verwachten dat de array op het display zou worden weergegeven,maar dit is niet het geval.
dit is het voorbeeld programmatje uit het mapje
Device = 16F877
Dim Loop As Byte
Dim Array[10] As Byte
' Transmit bytes to the I2C bus
BStart ' Send a START condition
BusOut %10100000 ' Target an eeprom, and send a WRITE command
BusOut 0 ' Send the HIGHBYTE of the address
BusOut 0 ' Send the LOWBYTE of the address
For Loop = 48 To 57 ' Create a loop containing ASCII 0 to 9
BusOut Loop ' Send the value of LOOP to the eeprom
Next ' Close the loop
BStop ' Send a STOP condition
DelayMS 10 ' Wait for the data to be entered into eeprom matrix
' Receive bytes from the I2C bus
BStart ' Send a START condition
BusOut %10100000 ' Target an eeprom, and send a WRITE command
BusOut 0 ' Send the HIGHBYTE of the address
BusOut 0 ' Send the LOWBYTE of the address
BREStart ' Send a RESTART condition
BusOut %10100001 ' Target an eeprom, and send a READ command
For Loop = 0 To 9 ' Create a loop
Array[Loop] = BusIn ' Load an array with bytes received
If Loop = 9 Then BStop : Else : BusAck ' ACK or STOP ?
Next ' Close the loop
Print At 1,1, Str Array ' Display the Array as a STRING
Stop
Mijn vraag is nu is het mogelijk de string weer te geven op het LC display ,in dien ja waarom lukt het me niet.
~Galaxy
In the beginning there was nothing.... and even that exploded...
0,1% kans dat er een foutje in de manual geslopen is.
99,9% kans dat er een fout in je eigen code staat.
Waarom dump je de code uit de manual dan hier, en laat je je eigen code achterwege ??
Hier werkt het overigens als een zonnetje.
Device = 16F877
Config intrc_osc_noclkout, CP_OFF, WDT_OFF, PWRTE_ON, LVP_OFF,BODEN_OFF
ALL_DIGITAL=true
Declare SCL_PIN PORTC.6
Declare SDA_PIN PORTC.7
DelayMS 50
Cls
Dim Loop As Byte
Dim Array[10] As Byte
' Transmit bytes to the I2C bus
BStart ' Send a START condition
BusOut %10100000 ' Target an eeprom, and send a WRITE command
BusOut 0 ' Send the HIGHBYTE of the address
BusOut 0 ' Send the LOWBYTE of the address
For Loop = 48 To 57 ' Create a loop containing ASCII 0 to 9
BusOut Loop ' Send the value of LOOP to the eeprom
Next ' Close the loop
BStop ' Send a STOP condition
DelayMS 10 ' Wait for the data to be entered into eeprom matrix
' Receive bytes from the I2C bus
BStart ' Send a START condition
BusOut %10100000 ' Target an eeprom, and send a WRITE command
BusOut 0 ' Send the HIGHBYTE of the address
BusOut 0 ' Send the LOWBYTE of the address
BREStart ' Send a RESTART condition
BusOut %10100001 ' Target an eeprom, and send a READ command
For Loop = 0 To 9 ' Create a loop
Array[Loop] = BusIn ' Load an array with bytes received
If Loop = 9 Then BStop : Else : BusAck ' ACK or STOP ?
Next ' Close the loop
Print At 1,1, Str Array ' Display the Array as a STRING
StopDag ~Galaxy
Het klopt,wist niet dat de sda en scl moesten gedeclareerd
worden.
Wat dom van mij.
bedankt voor de hulp.
Mvg.