![]() |
Forum Index : Microcontroller and PC projects : Serial Com issue
Author | Message | ||||
jovian Regular Member ![]() Joined: 16/04/2017 Location: AustraliaPosts: 63 |
Hi all I've been wrestling with the serial comms between 44pin micromite ver 5.0302 and an FN-RM01 FN RM01 audio record and playback board. I have two boards, they both play back when manually keyed. But I can't seem to get them to play back using UART from either COM port on the mite. Manual for the board states: 4.1. Serial Communication Protocol FN-RM01 supports standard UART asynchronous serial control(communication baud rate is 9600bps), working at 3.3V TTL level. Possible to be converted to RS232 level via MAX3232 chip. The communication protocol format is as below. Start code: 0x7E Number: number of bytes from Number itself to check code Command: a specific serial command byte Parameter: to realize a specific function with a command byte together Check code: it’s a sum value of Number+Command+Parameter(it uses one byte only that is from the lower 8 bits) End code: 0x7E If use a serial assistant, you need to set the parameters correctly as below. Note: All of the commands need to be sent in hex. Example is: .3.1. Specify playback(of a file) by indexed sequence in the root directory of the storage device This command is to play the 1st sound file in the root directory of the storage device. Returned data: 00 represents command is executed successfully; 01 represents no this file. Start Code 7E Number 05 Command A2 MSB of the Sound File 00 LSB of the Sound File 01 Check Code A8 End Code 7E MY CODE IS: OPEN "COM1: 9600" AS #1 PAUSE 100 PRINT #1,&H7E05A20001A87E DO INPUT #1, A$ IF A$<>"" THEN PRINT A$ A$="" ENDIF LOOP END '7E,05,A2,00,01,A8,7E ;PLAY FILE 1 I cannot get the board to respond.. I have two boards and the behaviour is the same on both. Any ideas before I hurl the thing into the circular file? Many thanks, Joe |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
Joe, I think the statement in your notes means you need to send hex ASCII characters, so your PRINT #1 line might need to be PRINT #1,"7E05A20001A87E"; Note the semiocolon on the end to supress CRLF. I don't have one of the modules so I can't test but you might like to try this. Doug. Edited 2020-04-22 11:42 by panky ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
A common problem. I would expect it to require hex values: Start Code 7E Number 05 Command A2 MSB of the Sound File 00 LSB of the Sound File 01 Check Code A8 End Code 7E PRINT chr$(&H7E)+chr$(&H05)+chr$(&HA2)+chr$(&H00)+chr$(&H01)+chr$(&HA8)+chr$(&H7E); You may or may not need the trailing CRLF Jim VK7JH MMedit |
||||
jovian Regular Member ![]() Joined: 16/04/2017 Location: AustraliaPosts: 63 |
Doug, Jim Thank you kindly for your fast responses. Jim, your solution worked! Thank you very much. For the record, somewhat strangely to me A$=chr$(&H7E)+chr$(&H05)+chr$(&HA2)+chr$(&H00)+chr$(&H01)+chr$(&HA8)+chr$(&H7E) PRINT #1,A$ doesn't work, but exactly as you notated it does: PRINT chr$(&H7E)+chr$(&H05)+chr$(&HA2)+chr$(&H00)+chr$(&H01)+chr$(&HA8)+chr$(&H7E); Thanks for your help, I almost didn't have any hair left to pull out! Cheers all Joe |
||||
jovian Regular Member ![]() Joined: 16/04/2017 Location: AustraliaPosts: 63 |
Hi all FWIW the solution to the Micromite UART Com1 serial communication issue above is that in this instance with the FN-RM01 board, and maybe others, the trailing semicolon is crucial. Thus the following works, but fails without the trailing semicolon: A$=chr$(&H7E)+chr$(&H05)+chr$(&HA2)+chr$(&H00)+chr$(&H01)+chr$(&HA8)+chr$(&H7E) PRINT #1,A$; Thanks for your help Joe |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
The trailing semicolon prevents the CRLF from being sent. A lot of devices get very confused if they receive extraneous data while others can handle it OK. Some need all the data sent in one stream while others can handle slow drip feeding. Some require you to use two stop bits to give them time to digest the data. It all makes life interesting... VK7JH MMedit |
||||
jovian Regular Member ![]() Joined: 16/04/2017 Location: AustraliaPosts: 63 |
Very useful information, thanks! |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
This may??? also work; setting up a few Constants.... Constant Play$=chr$(&H7E)+chr$(&H05)+chr$(&HA2)+chr$(&H00)+chr$(&H01)+chr$(&HA8)+chr$(&H7E) PRINT #1,Play$; Would need testing, but if it worked, you could setup Constants for all the strings you need to send. Cheers. Edit:- pointless reply as Play$ = Jim's A$..... Must be the stir crazy Covid isolation & boredom setting in... Edited 2020-04-23 08:12 by Phil23 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |