PDA

View Full Version : ASM equiv for SERIN2???



Squibcakes
- 24th August 2004, 06:09
Hi,

I think I need to speed up my program by using ASM.

Basically I have a PIC programmed as a DCE using Hardware flow control, it then prints out to a centronics printer.

My flow control (Using DSR and CTS) from the PIC works ok but when the flow speed is increased, the PIC fails to print some characters...

Here is a cut from the code: (CTS - Clear to Send)

MAIN:
HIGH CTS
SERIN2 SDI,16780,[char]
LOW CTS

<... output to printer here ....>

GOTO MAIN


It seems that the pic is not quick enough between capturing the char and clearing the CTS signal.

I may be able to speed things up by converting the above three lines to ASM?

Can anybody help please?
J

Kypros
- 26th August 2004, 05:53
Hello Squibcakes,
First, avoid the commands: High <pin> and LOW <pin>.
Use CTS=1 or CTS=0 instead. The take less code space and I thing they execute faster. There is an assembly equivalent of just few lines but I do not use assemble and need to read the manual to answer this.
Secondly, you might try the HSERIN and HSEROUT commands if your PIC has a hardware USART build-in. This might need a MAX232 IC to invert the logic.

Regards
K.

Squibcakes
- 26th August 2004, 07:42
Hi Kypros,

Thanks for the HIGH / LOW tip...

I've been playing around with the code some more and found that it is even better to use the FLOW pin option.. ie

SERIN2 SDI\FLOW,16780,[char]

and scrap the HIGH , LOW flow commands all together.

Its possible that the PC's UART buffe is still causing me some problems and headaches....

I may need to re wire and use the USART after all.... I will post here if I have any success.
Squib