PDA

View Full Version : ASM Addressing method help needed



sougata
- 28th January 2007, 14:12
Hi,

I am trying to read and buffer LPT printer port data by a 18F452 @ 40MHz. The application is a parallel to serial converter. I am using INT_0 high priority interrupt to read the strobe (falling edge) signal and capturing the data via portd. As soon as I fall into the ISR I clear the INT_0 flag , locate the address (which array what location) where to store the data and return ( RETFIE FAST ). I have found that creating a software indexed array addressing method eats up instruction cycle time. (:o I haven't counted my instruction cycle time, but I am loosing data). So rather than using 5 different arrays I plan to use a single array starting from Bank1 through Bank5.

So my questions are::confused:

1. Is the post increment method the best here ?
2. While in the interrupt if the INT_0 flag gets set can I loop around my ISR before quiting ?
3. How to define and access my array (1280 bytes @ 8bit data buffer) ? Cause without a software index I don't know where was it left and what has been already transmitted serially and what pending ?
4. Can somebody help me with the LPT port timings to decide if it is at all possible with a PIC ?
5. Would it be beneficial to use the PSP port ?

I am counting on the Gurus out there and I am desperate even to overclock the PIC to 48MHz. Please help.

sougata
- 28th January 2007, 17:01
Hi,

Well I have limited my buffer and checking the FSRH bit 2 and stopping to grab setting a bit buffer full. Then in my main PBP routine I am starting the TX dump. Checking only a single bit in the FSRH saves instruction cycle as I am worried that I will loose data. Anyway round if my incoming data is greater than my buffer then I am going to loose it. However I intended to setup a ring buffer so that my buffer is releived when the incoming data stream is less.

Still counting on the Gurus and waiting for a Monday morning.