Help with sending serial data - syntax

Blazemaguire

Senior Member
Hi,

I've been playing with the catalex MP3 sound modules
http://www.ebay.co.uk/itm/UART-Control-Serial-MP3-Music-Player-New-Module-For-Arduino-AVR-ARM-PIC-/151483413291?hash=item23451d732b

They work well and I've had it working fine using the standard commands that I pilfered from someone elses code on this forum) For those un familiar, they are controlled by sending serial commands such as the following:

link to manual: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&ved=0CDgQFjAEahUKEwj8vsD3kuDHAhUFuRQKHcsPC7g&url=http://markshauntedgarage.com/common/download.php?f=82&usg=AFQjCNGPb2Tl1S8xgBLNZRyxpUoFQcmmMQ&sig2=UEPa8UOG0dzpt6hqDnSwsw&cad=rja

serout audio,T9600_32,($7E,$FF,$06,$02,$00,$01,$01,$EF) 'this is the command to play folder 01/track001
serout audio,T9600_32,($7E,$FF,$06,$02,$00,$01,$03,$EF) 'this is the command to play folder 01/track003
serout audio,T9600_32,($7E,$FF,$06,$02,$00,$01,$06,$EF) 'this is the command to play folder 01/track006

there are other commands for volume up/down/pause etc.

(hope that makes sense so far!)

My issue is I want the final packet of data to NOT be the text $01, $02 etc, but rather, I need the final data packet to be a variable stored in the picaxe that changes based on an event
e.g B1.

Is this possible? what is the correct syntax? (I can't seem to find an answer in the picaxe manual)

I want to be able to do this so I can cycle through track numbers on an OLED display and choose the track to play before I hit a play button. (where the track number displayed on the OLED is just a variable that gets incremented or decremented based on 'next' and 'previous' buttons being pressed)

I want to take that live variable and have it run in my serout code above.

I've tried this:

serout audio,T9600_32,($7E,$FF,$06,$02,$00,$01,b1,$EF) (where I've previously set b1=1 which is accepted as legitimate syntax, but the mp3 module doesn't respond to it, so I assume it's wrong)

I'm sure this must be easy enough, but I'm unsure of the syntax, or whether I need preceeding zero's in front of the variable.

What does the $ part actually mean anyway? is it a seperator?

thanks in advance
 

srnet

Senior Member
Did you try the 'the sscom32 serial tool' ?

Did you try just sending; serout audio,T9600_32,($7E,$FF,$06,$02,$00,$01,$01,$EF) ?

Did you try sending it inverted; serout audio,N9600_32,($7E,$FF,$06,$02,$00,$01,$01,$EF)

What does the $ part actually mean anyway? is it a seperator?
If you open up manual 2, its a PDF file, and do a search on $, the first entry found on page 7 is;

"Hexadecimal (hex) numbers are preceded with a dollar-sign ($) or (0x)"
 

Blazemaguire

Senior Member
Please disregard. I'm an idiot. What I tried did work... There was another bug in my code causing it to pause as soon as I played a track with the serout instruction. Turns out you can just put a variable straight into the serout code with no issues. Thanks anyway!
 

srnet

Senior Member
Please disregard. I'm an idiot. What I tried did work... There was another bug in my code causing it to pause as soon as I played a track with the serout instruction. Turns out you can just put a variable straight into the serout code with no issues. Thanks anyway!
Always a good idea to post the whole code, very often a 'problem' is caused by the code that is not shown ...............
 
Top