PDA

View Full Version : serin



Sphere
- 28th August 2005, 15:40
Im trying to make a protocol converter using the serin an serout commands. The device sends instructions of varying length. That’s the problem. Ive used SERIN PortB.5,N9600,b0,b1,b2,b3 but some of the instructions only use b0,b1 so the serin command is still waiting for b2 and b3. Ive also tried adding the timeout instruction to the command to reset serin, this does work 90% of the time but it tends to miss out instructions during the time out.

(b0,b1,b2,b3 are var bytes)

Any ideas Sphere.

mister_e
- 28th August 2005, 16:06
If your PIC have an internal USART... use it. Use the USART interrupt to get your data, then send it where you want.

No timeout hassle and all this kind of future problem. Do a search with USART Inerrupt and you should find more than enough to begin

Receive your data, one byte at the time, then you can store them in an aray, EEPROM, send it to LCD.........

Sphere
- 28th August 2005, 19:43
Thanks for the reply I will give it a go.

Sphere....