Tray adding the following two defines:
DEFINE I2C_SLOW 1
DEFINE I2C_HOLD 1
Al.
Tray adding the following two defines:
DEFINE I2C_SLOW 1
DEFINE I2C_HOLD 1
Al.
All progress began with an idea
DOH!!!
My apologies...
The way I read the first post I did not think you had any code of your own.
And I hate opening attachments...
Use code tags in the future.
Dave
Always wear safety glasses while programming.
I'll try the Defines and whenever I use code tags the code jumbles up or leaves stuff out, tried this a couple times on other questions and it left parts of the code out.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
The Defines worked!!! Couple other little changes and I believe it works, except for when I download from PC it just hangs. Cycle power and all takes off and works fine. Seems to get stuck in interrupt. Here's the code now trying Joe S. method.
[magic] Include "modedefs.bas"
INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
define osc 8
define DEBUGIN_REG GPIO
define DEBUGIN_BIT 3
define DEBUGIN_BAUD 2400
define DEBUGIN_MODE 1
define I2C_SLOW 1
define I2C_HOLD 1
Dpin var GPIO.2 'Data pin
Cpin var GPIO.0 'Clock pin
Lpin var GPIO.1 'Latch pin
Dapin var GPIO.4 '24LC256 data pin
Clpin var GPIO.5 '24lc256 clock pin
serialin var GPIO.3 'Input from PC
cont con $A0
addr var word
CMCON0=$07 'Shut off comparators
ANSEL=$00 'Set all digital
ADCON0=$00 'Shut off A/D Converter
TRISIO=$08 'Set all to outputs except GPIO.3 is input
INTCON.7=1 'Enable all unmasked interrupts
IOC=$08 'Enable interrupts on input3
GPIO=$00
b1 var byte
b2 var byte
chipnum var byte
thischip var byte
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler GPC_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
INT_ENABLE GPC_INT ; enable external (INT) interrupts
ENDASM
Start:
addr=0
loop:
I2Cread dapin,clpin,cont,addr,[b1,b2] 'Read from 24lc256
if b2=$FF then goto Start 'If b2=FF start over
for chipnum=0 to 1 'Load into 74hc595
lookup2 chipnum,[b2,b1],thischip 'Load into 74hc595
shiftout dpin,cpin,LSBFIRST,[thischip] 'Put out onto chips
next chipnum
pulsout lpin,10 'Latch data onto 74hc595
addr=addr+2 'Next eeprom location
pause 600
goto loop
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
addr=0 'Start writing at eeprom location 0
NEXTSTEP:
debugin[#b1,#b2] 'Read input
i2cwrite dapin,clpin,cont,addr,[b1,b2] 'Store in eeprom
pause 10 'Wait between writes
addr=addr+2 'Next eeprom loc
if b2 <> $FF then nextstep 'FF means end of data
low serialin
Finish:
@ INT_RETURN
end [/magic]
Joe said to replace the word magic with the word code
Dave
Always wear safety glasses while programming.
Sorry trying to fix supper for my daughter and was reading to fast.
Code:Include "modedefs.bas" INCLUDE "DT_INTS-14.bas" ' Base Interrupt System INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts define osc 8 define DEBUGIN_REG GPIO define DEBUGIN_BIT 3 define DEBUGIN_BAUD 2400 define DEBUGIN_MODE 1 define I2C_SLOW 1 define I2C_HOLD 1 Dpin var GPIO.2 'Data pin Cpin var GPIO.0 'Clock pin Lpin var GPIO.1 'Latch pin Dapin var GPIO.4 '24LC256 data pin Clpin var GPIO.5 '24lc256 clock pin serialin var GPIO.3 'Input from PC cont con $A0 addr var word CMCON0=$07 'Shut off comparators ANSEL=$00 'Set all digital ADCON0=$00 'Shut off A/D Converter TRISIO=$08 'Set all to outputs except GPIO.3 is input INTCON.7=1 'Enable all unmasked interrupts IOC=$08 'Enable interrupts on input3 GPIO=$00 b1 var byte b2 var byte chipnum var byte thischip var byte ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler GPC_INT, _ToggleLED1, PBP, yes endm INT_CREATE ; Creates the interrupt processor INT_ENABLE GPC_INT ; enable external (INT) interrupts ENDASM Start: addr=0 loop: I2Cread dapin,clpin,cont,addr,[b1,b2] 'Read from 24lc256 if b2=$FF then goto Start 'If b2=FF start over for chipnum=0 to 1 'Load into 74hc595 lookup2 chipnum,[b2,b1],thischip 'Load into 74hc595 shiftout dpin,cpin,LSBFIRST,[thischip] 'Put out onto chips next chipnum pulsout lpin,10 'Latch data onto 74hc595 addr=addr+2 'Next eeprom location pause 600 goto loop '---[INT - interrupt handler]--------------------------------------------------- ToggleLED1: addr=0 'Start writing at eeprom location 0 NEXTSTEP: debugin[#b1,#b2] 'Read input i2cwrite dapin,clpin,cont,addr,[b1,b2] 'Store in eeprom pause 10 'Wait between writes addr=addr+2 'Next eeprom loc if b2 <> $FF then nextstep 'FF means end of data low serialin Finish: @ INT_RETURN end
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks