November 21, 2024, 10:35:59 AM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


SEROUT help

Started by robp790, November 17, 2010, 10:53:06 AM

Previous topic - Next topic

robp790

I could use some pointers on how to use the SEROUT command to send a HEX command to my serial device. I was trying to send it by using serout 7, t2400, (002) The parallax guide says that is like sending ascii data whatever is in the  parentheses the only notation for sending it in HEX is in the BS2 and SX notes. I went and read up on decimal to hex conversion, that just makes the 002 convert to 02. The results I have received in sending this serout command makes the device work but in a random fashion, which makes me believe what I sent is the command for play random files or 00.

JonnyMac

Here's the thing: HEX is for humans, so unless your device is expecting a two-byte text representation of a value (as the HEX we use is), you do not need do anything, just TX the byte.  Internally it's all binary, anyway.

What is the device?  If you can point to protocol docs I can be more specific with code examples.
Jon McPhalen
EFX-TEK Hollywood Office

robp790

It is the mdfly RS232-TTL MOL-AU5121 sound module. Their spec say to send 01 to play 001.mp3 and 02 to play 002.mp3 EF to stop. It plays but in a random fashion right now. When I program the SEROUT command I get errors when I just place 01 in the line This led me to believe the data I placed in the parenthesis is being interpreted as 00 which is the command to play random files

JonnyMac

When all else fails, check the docs!  ;D

According to this document:

http://mdfly.com/Download/Module/AU5121Sspec.pdf

... the baud rate of that device is 4800 which is 2x faster than what the Prop-1 can handle.  You'd need a Prop-2 or Prop-SX to communicate properly with that device.
Jon McPhalen
EFX-TEK Hollywood Office

robp790

Thats true I did read that. But the prop1 IS communicating with the board. Is my line reading SEROUT 7, T2400, (02) correct for sending the hex command to play 002.mp3 to the mdfly board?  If it is baud rate causing the problem I will try a picaxe 28x2.

JonnyMac

Yes, it's a problem with the baud rate.  The board is reacting to the data but being sent at half speed, it's not interpreting it correctly.
Jon McPhalen
EFX-TEK Hollywood Office

robp790

Hmmm thats a bummer! Thanks for all your help.