Here is some untested code based upon our work with vdrive2
<code><pre><font size=2 face='Courier'>
; Hardware Setup
; VDIP PICAXE-18X
; GND - 0V
; RTS - CTS input4 (not used)
; V+ - V+
; RXD - TXD output7
; TXD - RXD input6
; CTS - RTS output0 (not essential, can tie to 0V)
; Note RXD on VMUSIC2 connects to TXD on PICAXE etc.
; Tested with a Sandisk 1GB Micro Cruzer
; IMPORTANT NOTE: Upon powerup it can take over a minute for the
; VDIP to enumerate the 1GB memory stick. During this time it looks
; like nothing at all is happening. This had us confused for many hours,
; thinking that the module was not working!
; After powerup have a cup of coffee and wait for the LED
; to go green. The drive LED should also be on - if not try reinserting.
symbol point = b0
'b1 reserved
symbol temp = b2
symbol loopcounter = b3
; set picaxe type
#picaxe 18x
; set COM port used for download
;#com 4
; open terminal after download
; This is to view the 'sertxd' debugging comments
#terminal 9600
setup:
setfreq m8
'NB double speed, so t4800 is actually t9600
low 0 ; ensure CTS is low
init:
; Send Echos until the unit responds correctly
sertxd ("<Sent> E",CR,LF)
serout 7,t4800,("E",CR)
serin 6,T4800,b1
pause 100
if b1 <> "E" then init
main:
; check to see if a drive is actually inserted
; response will start D for yes and N for no
sertxd ("<Sent> Check Drive",CR,LF)
serout 7,t4800,(CR)
serin 6,T4800,b1
pause 100
if b1 <> "D" then main
logging:
; create a log file called 'log' (for some reason 'log.txt' didn't work)
sertxd ("<Sent> Open file",CR,LF)
serout 7,t4800,("opw log",CR)
serin 6,T4800,b1
pause 100
sertxd ("<Sent> write to file",CR,LF)
bintoascii loopcounter,b5,b6,b7 ; convert loopcounter byte to 3 ascii digits
; and write 8 bytes loop_xyz
serout 7,t4800,("wrf ",$00,$00,$00,$08,CR,"loop_",b5,b6,b7,CR)
serin 6,T4800,b1
pause 100
sertxd ("<Sent> Close file",CR,LF)
serout 7,t4800,("clf log",CR)
serin 6,T4800,b1
pause 100
inc loopcounter ; increment counter
goto main
</font></pre></code>
Edited by - Technical on 26/04/2007 22:49:25