PDA

View Full Version : how do you clear the serial buffer at power up?



J_norrie
- 8th June 2007, 14:39
Hi there, I am using a pic18f4523 and using it to print to a panel printer via serial the serial port and a ST202RCN rs232 driver at 9600 baud. When I initially switch the unit the printer starts up printing gobbylygook. Does anyone have any suggestions on how to overcome this.

many thanks in advance John

skimask
- 8th June 2007, 15:32
Hi there, I am using a pic18f4523 and using it to print to a panel printer via serial the serial port and a ST202RCN rs232 driver at 9600 baud. When I initially switch the unit the printer starts up printing gobbylygook. Does anyone have any suggestions on how to overcome this.

many thanks in advance John

What kind of printer?

J_norrie
- 11th June 2007, 14:43
Hi I have found that if I power up the PIC ten send data to the printer and then switch on the printer then everything from then on is fine. I was actually trying tio clear the pic serial output buffer at power up. Is this possible?

kind regards and many thanks John

skimask
- 11th June 2007, 16:12
Hi I have found that if I power up the PIC ten send data to the printer and then switch on the printer then everything from then on is fine. I was actually trying tio clear the pic serial output buffer at power up. Is this possible?

kind regards and many thanks John

disable then reenable the serial port on the PIC itself.

mister_e
- 11th June 2007, 20:15
almost sure you're using SEROUT right?

J_norrie
- 12th June 2007, 09:08
hi again yes i am using serial out as follows
printoutB:
gosub GetBin
gosub year10
SEROUT PortC.6,T9600,[printit,"k =",#peak,"0 ftlbs",13,10]

pause 100: return

any suggestions please
thanks again john

mister_e
- 12th June 2007, 11:12
2 choice, Or you change it to HSEROUT (with the according DEFINEs + TRIS ) or you still use SEROUT BUT you give to that pin the right idle level when your program start.

Somewhere at the top of your program, add those simple line
HIGH PORTC.6
PAUSE 50

and post your results