Brian wrote:
Is there a technical issue with "how" the HSER/SER-based send serial data...do they both conform to (or other insight is to what the differences between why one command would work over the other)?
8-data bits
1-stop bit
no parity
Slight background: For each character there are 10 bits of data a start, the 8 data bits and a stop. So at 9600 baud each bit is 1/9600 seconds long or about 104us.
With the hardware serial port this is done with hardware support. That is the UART you hand it a byte of data to output and it takes care of timing of all of the bits, likewise when data is coming in. Also with the HSERIAL system it goes one step farther. That is, when you tell it to output a string of characters, it simply queues these up and the hserial system, than puts a character into the the appropriate register to start the output, when the system then says it is ready for another character, it generates an interrupt, which the hserial system than gives it the next... Likewise for input. When the system has detected a new character has arrived, an interrupt is generated and that character is added to a queue and the system can continue to receive the next character. This allows you to read in the characters whenever your code wishes to. Why use this: The timings are taken care of for you. The hardware queues allows your program to do other things while the characters are being input or output... Likewise as the characters are input or output with hardware support, they are not potentially screwed up by other things like interrupts that happen on the processor (within reason)
With the Serin/Serout system, this is all done in software. When you tell the system to output a string of characters, the serout function will start to output: Set the start bit(high or low depending on normal or inverted), spin for 104us, output the first bit, spin for 104us, ... Likewise for serin, the code will sit there spinning wait for the start bit transition, when it detects it, it will spin for 1/2 bit period in this case 52us, such that it will detect the bits as close to what it thinks the center of the bit is and then it will delay a bit period, detect the first bit, delay, detect... With this, if data is being sent to the pic and your program is not in a serin statement, that data will be lost...
When use serin/serout: There are a limited number of hardware serial ports that are fixed to specific pins. Likewise, with the hardware serial port code you are limited to what the hardware can do(which baud rates, parity, stop bits, inverted or non-inverted...) where with software you are free to implement whichever options you wish, only limited by how fast can the code go...
Downsides include: Your processor will sit there spinning while waiting to input/output a bit. All characters that are received when you are not in a serin are lost. Serin/Serout data can be screwed up if your code is processing any interrupts. This includes interrupts for hserial or on Pros Hservo... Why: I have mentioned this in many other places...
I hope my longer winded response, answers you question
Kurt