PDA

View Full Version : Hserout, multitasking?



toalan
- 23rd February 2005, 18:38
Hi guys for some reason I though the Hserout was multitasking, meaning if I Hserout a value the MCU would not need to wait until the task was fully executed to carry on with the next line of code.

In testing I found that the MCU has to finish executing the HSEROUT command in order to continue the next line of code. If I were to use assembly would that still be the case?

Ingvar
- 24th February 2005, 10:21
The HSEROUT command will wait until it has stuffed the last character into the 2 byte transmit buffer. That means that all strings longer than 2 characters will do some waiting. It will always be faster than any software serial routine like SEROUT, SEROUT2 or DEBUG who will be busy until the bitter end.

Since the buffersize is set in hardware there is no way of getting it bigger, assembler will be affected in just the same way. You can ofcource use interrupts to handle a bigger softwarebuffer in the background.

toalan
- 24th February 2005, 18:07
ahh that makes alot of sense.

I assume you can directly or indirectly check to see if the buffer is full or not. Any idea which registers to check? I know read the datasheet, but if anyone happens to know it off the of their head then please do tell. Thanks again

Regards,

Alan To

mister_e
- 25th February 2005, 04:35
mmmm can't say you can do it elsewhere than in a interrupt handler routine... try TXSTA=0

OR do a loop to send your data byte/byte, do a test after each HSEROUT that say to continue or stop HSEROUT.



for SEndData = x to y
Hserout [Myvar[SendData]]
' set your stop/continue flag here and after that
'
If ContinueOrStop = Stop then SendData = y ' to get out of the loop
next

toalan
- 25th February 2005, 17:07
TY for the info