What’s the difference between the two? I know the “H” Serial commands are the hardware serial but what is the implication of it?
I will take a quick stab at this. AcidTech and others can probably give you a more complete answer.
The H version uses the underlying hardware serial support of the underlying microprocessor instead of doing bit banging in software. Some implications are:
-
Only one hardware port on the Pro on specific I/O pins(maybe 2 on the Pro plus if that ever is released). Where as software can be on any of the I/O pins.
-
The hardware version should be more reliable, especially if your program is using other features of the Atom Pro such as HSERVO or Interrupt handling. The hardware does the timing for each of the bits vs the software trying to count how many clock cycles is need for each high and low bit.
-
Hardware version gives us Buffering of input and output. when you do a HSEROUT it simply adds the output to a queue and the software continues while the character(s) are output, where as the serout version, does not continue to the next line of code until all of the characters have been output. This is more important difference for serin vs hserin. If you use the software version, it can only receive input when it is in the serin command. So if your program is busy doing something else and the source of the serial input tries to output, the output will be lost, whereas when using the hardware serial port, your program can be busy doing other things and can either simply poll to see if there is any input or you can set up interrupts to let you know when there is input available.
I hope this helps.
Kurt
Thanks for the explanation kurte, I really appreciate it.
This explains why some of the commands sent to the SSC-32 seems to get lost as I had to put a humongous delay between the lines for it to be sent correctly.
I’m going to try to replace all the SEROUT command with HSEROUT instead. It seems to be the better solution if i only need one port (off of P14 and P15 for RXD and TXD respectively).
be aware that you can probably either overflow the buffer for hserout or wind up waiting for it to have space. perhaps someone knows how deep the hserial buffers are and if there is a way to see if they are full.
I wonder how large the buffer is for those hardware serials. Perhaps looking at the datasheet for the mcu would yield the answer to that.
For now, I don’t have problems shoving commands for 12 servos to the SSC-32 with 1 second delay between hserout. For example
hserout [blahblahto12servos]
pause1000
hserout [blahblahto12servos]
baud rate will obviously impact how fast you can send commands as well.
I have begun workin processing the signals from the HITEC RC Receiver on 6 channels (using 6 interrupts) on the Atom Pro and would like to show the results on an LCD display. Neither of my displays will work properly at 2400 baud with these interrupts active so I decide to try the hardware serial port.
My question is: if you configure your port like:
sethserial h2400,h8databits,hnoparity,h1stopbits
Is that like: i2400 or n2400?
My guess is i2400. If I need n2400 can I negate each bit to make it work?
Thanks
Kurt
I believe the answer to my second half of the question is No. You would need to invert the entire signal, not just the data bits.
I was wondering about another off the wall question.
Suppose my Robot will use both an SSC-32 and an Atom Pro. Also Suppose I use maybe P12 and P13 to talk to the SSC-32. Could I then Jumper P14 and P15 back to the SSC-32 to the other side of the TX/RX lines to use the MAX232 and DB9 connector on the SSC-32 to talk to the PC using the Hardware serial port of the Atom Pro?
Ha, that’s a good idea… might help the other guy who was asking about the smirf thing too if it is using rs-232 on it’s output.
so you going to write the pass through code for the BAP?