Interesting bug with the DISCONNECT command.
Had me going for awhile...
Had me going for awhile...
Code:
'Disconnect bug
'
'Initially tried with a 16mhz resonator on 28x1 firmware version A3
'tried removing resonator
'what appears to happen is an unexpected reset occurs about 10ms
'after the disconnect is issued
'I think I narrowed it down to a relationship with the i2cslave speed
'parameter. I'm using a NANO USB I/F running hyperterms terminal program
'at 9600 baud for an interface.
'what you will see:
'
'Read Parms
'Read Parms
'Main
'as expected, you see it doing the Read Parms routine
'Then, a second Read Parms routine (which shouldn't be here)
'and then the do nothing loop at Main.
'if you comment out the disconnect command, it works with
'either i2cslave speed settings
setfreq m8 'terminal at 9600
disconnect
gosub read_parms
main:
sertxd ("Main",cr,lf) 'got to here
do_nothing:
pause 1000
goto do_nothing
'*********************************************************
Set_24LC_SLAVE:
'*********************************************************
' i2cslave %10100000, i2cfast, i2cword '24LC256 = 10100000
i2cslave %10100000, i2cfast_8, i2cword '24LC256 = 10100000
return
'*********************************************************
Read_Parms: 'loads saved parms from eeprom
'*********************************************************
sertxd ("Read Parms",cr,lf) 'got to here
gosub Set_24LC_SLAVE
w5=$2000 'place to read
for b6=$50 to $7E 'place to write
hi2cin [%10100000],w5,(b0) 'read byte from eeprom
poke b6,b0 'write byte
inc w5
next
return