I want to build a datalogger with a picaxe28X1 and a vmusic2 module as Data Storage device. I've copied the example provided by technical (thanks), but i have some trouble to get data from the module.I have connected the device as described in the Program.
1. The returned information is not complete.
2. Some of the commands provided by the module do not work (e.g. VPF lexus.mp3 returns Bad Command)
The Programm runs twice. The first step (response) runs with an for next loop.
The second runs with a do... loop.
Here the modified Program:
And the results:
It seems that the scratchpad are destroyed, or the pointer incorrect, or the cpu is to slow.
I am very frustrated and confuse.
1. The returned information is not complete.
2. Some of the commands provided by the module do not work (e.g. VPF lexus.mp3 returns Bad Command)
The Programm runs twice. The first step (response) runs with an for next loop.
The second runs with a do... loop.
Here the modified Program:
Code:
symbol first_byte = b0
symbol point = b1
symbol temp = b2
symbol loopcounter = b3
symbol sw = b5
; set picaxe type
#picaxe 28x1
; set COM port used for download
;#com 4
; open terminal after download
; This is to view the 'sertxd' debugging comments
#terminal 4800
setup:
; setup serial hardware
; at 9600 with background receive
hsersetup b9600_4,%01
low 0 ; ensure CTS is low
init:
; Send Es until the unit responds correctly
'sertxd ("<Sent> E",CR,LF)
'hserout 0,("E",CR)
'gosub get_response
'if first_byte <> "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)
hserout 0,(CR)
gosub get_response
if first_byte <> "D" then main
pause 2000
sertxd ("ECS",CR,LF)
hserout 0,("ECS",CR)
gosub get_response
pause 2000
sertxd ("DIR",CR,LF)
hserout 0,("DIR",CR)
gosub get_response
pause 2000
hserout 0,(CR)
pause 100
gosub get_response
pause 2000
sertxd ("FWV",CR,LF)
hserout 0,("FWV",CR)
gosub get_response
pause 2000
sertxd ("FS",CR,LF)
hserout 0,("FS",CR)
gosub get_response
pause 2000
sertxd ("idd",CR,LF)
hserout 0,("idd",CR)
gosub get_response
pause 2000
sertxd ("VPF lexus.mp3",CR,LF)
hserout 0,("VPF lexus.mp3",CR)
gosub get_response
pause 1000
sertxd (CR,LF,CR,LF,#sw,CR,LF,CR,LF)
if sw = 1 then ende
sw = 1
toggle 7
goto main
ende:
sertxd (CR,LF,"Stop",CR,LF)
end
; Sub procedure to receive background bytes
get_response:
pause 2000 ; wait a while
if sw = 1 then Orig
'sertxd ("<Response> ",CR,LF)
point = 0 ; reset local pointer
get point,first_byte ; Save the first reply byte
for point = 0 to hserptr
get point,temp ; get returned byte
sertxd (temp) ; transmit it
if temp <> CR then s_end
sertxd (LF)
s_end:
next
hserptr = 0
return
Orig:
point = 0 ; reset local pointer
get point,first_byte ; Save the first reply byte
do
get point,temp ; get returned byte
sertxd (temp) ; transmit it
inc point ; increment pointer
loop while temp <> CR ; if not CR loop
sertxd (LF) ; Add a LF to the received CR
sertxd (CR,LF) ; Do another blank line
hserptr = 0 ; reset the background receive pointer
return
; Other Useful Commands
; Play all tracks hserout 0,("w3a",CR)
; Stop track hserout 0,("vst",CR)
; Skip to Next Track hserout 0,("vsf",CR)
; Skip to Start of current Track hserout 0,("vsb",CR)
; Skip to Previous Track hserout 0,("vsb",CR,"vsb",CR)
; Pause hserout 0,("e") ; note no CR here
; Resume (after pause) hserout 0,(CR)
; Set Volume hserout 0,("vwr",$0B,vol_right,vol_left,CR)
; where $00 = maximum volume,$FE is the minimum
; Suspend disk hserout 0,("sud",CR)
; Wakeup disk hserout 0,("wkd",CR)
; Get firmware version hserout 0,("fwv",CR)
And the results:
Code:
<Sent> Check Drive
Bad Command
ent> Check Drive
D:\>
oECS
D:\>
oDIR
1.BAS
HANSI.BAS
VINCUL~1.PDF
VDRIVE~1.BAS
LEXUS.MP3
D:\>
TD:\>
FWV
MAIN 02.08VDAPF
RPRG 1.00R
D:\>
VFS
\>
8idd
/Sector = $0200
Bytes/Cluster = $000200
Capacity = $01EB1000 Bytes
Free Space = $01583E00 Bytes
D:\>
.VPF lexus.mp3
Bad Command
2
0
<Sent> Check Drive
D:\>
ECS
D:\>
DIR
1.BAS
D:\>
FWV
FS
idd
/Sector = $0200
VPF lexus.mp3
Bad Command
1
Stop
It seems that the scratchpad are destroyed, or the pointer incorrect, or the cpu is to slow.
I am very frustrated and confuse.
Last edited: