Different serial in speed and out speed possible?

I want to try an idea of connecting an old handheld computer with a maximum rs232 baud rate of 9600 to a 08m2 have the 08m2 listen for keypresses then convert those to midi commands and output at 31250 (midi baud rate) I don’t think it is possible but wanted to be sure.

I am not averse to using 2 08m2 for the project, one to handle the serial input from the handheld, and one to do the midi output, but not sure if that is possible either?
 
Hi,

31250 baud is not a "standard" PICaxe Baud rate (i.e. it's not a "power of two" multiple of 2400 baud, etc.) so it can't be used with the SEROUT/IN commands. However, the "HSEROUT" (Hardware) can be set to any (reasonable) baud rate, if you do a few calculations (I didn't find a "Wizard" for it) as explained in the HSERSETUP command. The other problem with high baud rates is that the PICaxe may not have sufficient time to process the data before the next byte arrives, and similarly the "HSERIN" Hardware offers the possibility of a solution. But it might not be possible to operate the HSERIN and HSEROUT at different baud rates, so you may need to use the SERIN command for 9600 baud.

Also, there are some severe "issues" with the operation of the HSERIN command, to the extent that I don't recommend attempting to use it for any "fast" applications. There is a long relevant thread, which you might start reading at post #29 HERE but beware that the solution is not for the faint-hearted. That thread is concerned with receiving a very high baud rate so 9600 baud should be quite possible. Then transmission at 31250 baud might be reasonably straightforward, particularly if you are "comfortable" with PEEKSFR and POKESFR commands. ;)

An 08M2 may indeed be the "best" PICaxe to use because it is marginally faster than the other M2 chips, but using two to share the task (of receive and transmit) might not help much, because they would still need to communicate with each other (using serial comms ?). However, a successful solution is likely to depend not on the nominal "peak" baud rates, but more on there being (some) sufficiently long time gaps between incoming data bytes, i.e. the average baud rate.

Cheers, Alan.
 
Thanks Alan, so is it possible to receive at 9600 using SERIN and send using HSEROUT at 31250 on the same 08m2? The incoming data will just be key presses over a terminal on the handheld, then I want the 08m2 to translate these to midi messages and send out.
 
Hi,

If the input is just single (isolated) ASCII characters then yes I think it should be possible with a single 08M2. It depends what the "translation" involves but I guess the 08M2 has sufficient memory (it doesn't have the 512 bytes of Table Memory of other M2s). The SERIN will need a SETFREQ of at least 8 MHz and I'd probably choose 16 MHz which leads to a value of 127 (i.e. B31250_16) in HSERSETUP.

Cheers, Alan.
 
Thanks again Alan, the translation will probably be simple 1-1 stuff, for example ASCII character number to midi value, eg ASCII code 100 to midi value 100. The end goal is to be able to use the handheld computer to send any kind of channel specific messages - midi note or controller message, I don’t need the full midi spec like sysex, nrpn and realtime, so hopefully it will simplify things a bit.
 
Back
Top