PDA

View Full Version : serout : false byte after boot up



mischl
- 31st August 2005, 17:59
hello all

i have an effect now which i have some time before also...

on a pin of a pic is max232. i send some bytes with serout. all goes right.

but when i start up - the pic get the power - the first byte is sending is not correct. ever the first after boot up! after then the same routine with the same value send it right.
when i send first a byte for nothing, then the rest is good.
i've looked if i can clear the TXREG first, but my example doesn't run. i tried this (found in thread 1999)

ASM
btfss PIR1,4 ; Wait for TXREG to be empty after last byte
goto $-1 ; Not empty, wait
ENDASM

probaply i search at the wrong end...

thanks for any help

mister_e
- 31st August 2005, 22:22
The problem is in the Idle mode of your pin before using the first SEROUT. Have a look at it before and after. You'll void the problem by setting your idele mode at the same level.

mischl
- 1st September 2005, 17:20
for interests, fixed the problem by :

init : high tx1 ' avoid idle mode
main : serout tx1, t9600, [sendbyte]