how to remap interrupt vector - pic18f4550


Results 1 to 13 of 13

Threaded View

  1. #9
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Recieving data

    But I don't have that luxury. I'm getting SNMP packets (80-230 bytes). The host sends me a request, and has about a 20mSec timeout. I have to do an enormous amount of processing to decode the packets, grab the appropriate data, rebuild the response packet, and send. I previously did everything (receive, process, send) in one long ISR. That worked great. I was getting queries every 410mSec. The problem is - the customer added a second host that was sending me queries every 1 second. Most of the time, all was OK. But of course, there were times when the two requests hit me at virtually the same time. Since I was processing and sending in the 'receive' ISR, I missed the second request. I should mention that I don't have any flow control out of my network port. The hardware is already in the field and the handshake lines are not connected.
    So I made the ISR a 'receive only' segment and made my buffer twice as long (so it could handle two incoming packets), and modified my routines so that they worked with an offset. Offset '0' is the first byte of the first packet and offset $100 is the first byte of the second packet.
    When a packet came in, I set flags (packet offset 0 recieved and packet offset $100 received) and tested those flags in my main loop. Unfortunately, my main loop takes up to .5 second to execute. The host would time out before I sent my response.
    So I set up Timer3 Int as a low-priority int, but didn't turn on the timer. I set PIR2.1 just before I exit the (high priority) receive ISR. As soon as it exits, it goes into my 'fake' TMR3 int and processes and sends the packet. If another packet comes in right after the first, the high priority receive interrupt stops the 'process and send' routine and grabs the packet. It then goes right back to processing and sending - both packets if it needs to. I'm running the net-port to PIC interface at 230K baud.
    It all works!
    Last edited by Charles Linquis; - 10th November 2011 at 00:02.
    Charles Linquist

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts