Hi Hippy
Have rejigged it after your comments split the response into 3 segments
and addressed them as per the sample code in circuit creator so I belive that
the return bytes are those from the vdrive
Did'nt realise that I was just reading back the scratchpad go giddy with the result in excel
of the stick
Here is a screen shot of excel from the stick without serial download cable attached straight from chip to stick
and here is the reworking of the code
have simplified the main: so as not to chase variable wd about, and moved it so that it is just addressing the location of PTR so I believe that what I get back is now from the vdrive
thanks for the feed back
regards
john
Have rejigged it after your comments split the response into 3 segments
and addressed them as per the sample code in circuit creator so I belive that
the return bytes are those from the vdrive
Did'nt realise that I was just reading back the scratchpad go giddy with the result in excel
of the stick
Here is a screen shot of excel from the stick without serial download cable attached straight from chip to stick
and here is the reworking of the code
Code:
#picaxe 28x2
#no_data
#no_table
symbol temp =b6
symbol S_B = b7
symbol WD=b12
symbol point =b8
b5 = ","
wd=0
b1=0
setfreq em32
ptr=200
b1=0
ABC:
ptr=200
b1=0
do
inc b1
bintoascii b1,b2,b3,b4 ; convert b1 to ascii
@ptr=b1 'dummy adc scratchpad block 200 - 344
ptr=ptr+1
@ptr=b5 'puts "," comma to seperate the data for excel to read
ptr=ptr+1
if ptr = 344 then:goto BCA:endif
loop
BCA:
ptr =360
b10=10
do
inc b10
bintoascii b10,b2,b3,b4 ; convert b10 to ascii
@ptr=b10 ' dummy adc scratchpad block 360 - 504
ptr=ptr+1
@ptr=b5
ptr=ptr+1
if ptr= 504 then:ptr=0:wd=0:goto init_vdrive3:endif 'Trigger for data write
loop
init_vdrive3:
hsersetup B9600_32, %1
pause 3000 'send Es until Vdrive3 responds correctly
hserout 0,("E",CR)
pause 300
sertxd ("E requested ")
gosub response
if S_B <> "E" then init_vdrive3
sertxd ("bytes returned",#s_b)
pause 300
hserout 0,("OPW DAT.CSV",CR)
pause 300
gosub response
sertxd ("<Sent> Open file",CR,LF)
wd=1
goto main
main:
if wd =1 then:ptr =200:goto daat ' Trigger PTR pointer manipulation 1st block
elseif wd =2 then: ptr= 360:goto daat:endif ' trigger for 2nd scratchpad block
gosub shutdown 'stop write sequance
gosub Clr1
pause 300
gosub Clr2
pause 300
sertxd ("SAFE TO REMOVE")
end
daat:
hserout 0,("wrf ",$00,$00,$00,$14,CR)
hserout 0,("Col1,Col2,Col3,Col4",CR)
pause 300
hserout 0,("wrf ",0,0,0,236,CR)
pause 300
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'1
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'2
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'3
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'4
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'5
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'6
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'7
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'8
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'9
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'10
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'11
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'12
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'13
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'14
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'15
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'16
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'17
hserout 0,(#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,#@ptrinc,@ptrinc,cr)'18
hserout 0,($00,$00,$00,$00,$00,$00,$0a,$0d,cr)'19 Added this to form a break between data
hserout 0,($00,$00,$0D,$0A,CR)' To tell drive data write ended
sertxd ("<sent> write",cr,lf)
gosub response1
pause 500
inc wd ' used for addressing ptr
goto main
response:
sertxd ("<Response> ")
point=0
get point, s_b
hserptr = 0
return
response1:
point =0 ' Data transfer to USB
do
get point,temp
inc point
loop until temp <> CR
hserptr = 0
return
Clr1: 'Reset 1st scratchpad data block
ptr = 200
do
@ptr=0
ptr=ptr+1
if ptr =345 then:exit:endif
loop
return
Clr2: 'Reset 2nd block
ptr = 360
do
@ptr=0
ptr=ptr+1
if ptr =505 then:exit:endif
loop
return
shutdown: ' file close
hserout 0,("CLF DAT.CSV",CR)
pause 300
hserptr=0
return
thanks for the feed back
regards
john