tralala
Huidig project: Hexapod
Zie dit topic.
Als ik de volgende code gebruik, staat er steeds 8. Dit had ik ook al bij het programma in het vorige topic. Hoe kan dat?
Device 16F628A
Config WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_OFF, HS_OSC
ALL_DIGITAL true
XTAL 20
Dim W0 As Word ' Address
Dim B1 As Byte ' Data 1
Dim B2 As Byte ' Data 2
For W0 = 0 To 15 ' Loop 16 times
B1 = W0 + 10 ' B1 is data for SEEPROM
BusOut $A0,W0,[B1] ' Write each location
DelayMS 5 ' Delay 5ms after each write
Next
loop: Cls
For W0 = 0 To 15 Step 2 ' Loop 8 times
BusIn $A1,W0,[B1,B2] ' Read 2 locations in a row
Print At 1,1,Dec W0,": ",Dec B1," ",Dec B2," " ' Display 2 locations
DelayMS 1000
Next
GoTo loop
Die code is trouwens I2C.bas van de examples van Proton PICBasic. Alleen aangepast op type PIC.
free_electron
Silicon Member
Professioneel ElectronenTemmer - siliconvalleygarage.com - De voltooid verleden tijd van 'halfgeleider' is 'zand' ... US 8,032,693 / US 7,714,746 / US 7,355,303 / US 7,098,557 / US 6,762,632 / EP 1804159 - Real programmers write Hex into ROM
Gewoon verder in dat topic.