+ Reply to Thread
Results 1 to 6 of 6

Thread: Help with interrupts pic18f2620

  1. #1

    Default Help with interrupts pic18f2620

    Hi there.
    please could someone help !! I am pretty new to Proton and i am having troubles configuring things for an interrupt routine for a pic18f2620.
    My project requires me to RSIN at 57600baud every second and then to display three bytes of the stream onto a 3dig 7seg display. I have been able to convert the RSIN data and display it but the digits do not update until a new RSIN data has been decoded. I need to use an INTERRUPT to continuously update the 7segs while the rest of the main loop waits for new RSIN data to be displayed. I have tried various code examples but nothing seems to make sense. I have the option of using either a 16F876 or 18F2620 devices and again I am not quite sure which device would be more suitable as they have different methods and requirements for interrupt routines.
    I am running at 20Mhz to recieve serial data at 57600 baud which is send out from the host every second.

    Advice would be greatly welcomed.

    Hi, its great to see you visiting our forum. Why not try Proton Compiler for FREE?

    Download the FREE version of Proton Compiler, Its called Amicus18 and its available from HERE

    Already using proton Compiler??? Get rid of these pesky messages... get LICENSED USER STATUS




  2. If you're a Licensed user of PROTON DEVELOPMENT SUITE, apply for Licensed User Status to remove these pesky messages
     and get access to additional forum areas, Beta test downloads and more!

  3. #2
    Licensed User pverburg's Avatar
    Join Date
    Jan 2004
    Location
    Wellington, New_Zealand
    Posts
    770


    Default Re: Help with interrupts pic18f2620

    in the examples there is a buffered interrupt driven serial example just look at that and add your 7seg code to it.

    Paul V.

  4. #3
    Licensed User Tim's Avatar
    Join Date
    Jan 2003
    Location
    london
    Posts
    6,950


    Default Re: Help with interrupts pic18f2620

    For starters RSIN is a software serial command and should not be used while interrupts are running. Use Hrsin instead.

    Next set up an interrupt using say TMR0, You need to have a very high refresh rate to prevent it flickering.

    Here is some code you can use in the interrupt that will handle putting the data out on the display


    Code:
    Select LEDSegNo
        Case 0 
            LEDSeg3 = 0
            LEDPort = LED_DSPLY_DATA#0
            LEDSeg1 = 1
        Case 1
            LEDSeg1 = 0      
            LEDPort = LED_DSPLY_DATA#1
            LEDSeg2 = 1
        Case 2
            LEDSeg2 = 0
            LEDPort = LED_DSPLY_DATA#2
            LEDSeg3 = 1    
        EndSelect
        
        Inc LEDSegNo
        If LEDSegNo > 2 Then LEDSegNo = 0
    Tim

  5. #4


    Default Re: Help with interrupts pic18f2620

    Hi Paul

    many thanks for your support. i have now managed to get the display working fine with an interrupt working in the back ground. i have managed to rsin the serial data from the host and decode it onto the display. however... there is one slight problem....

    the 7seg display(3 digit) gives the correct values decoded from the serial stream but gives an blank blink every second. the serial stream from the host is sent every second and i am guessing that this is causing the display to blank as the rsin command waits for data.
    would you have any ideas how i can keep the display constant and also monitor the serial rsin as well.

    best regards

  6. #5


    Default Re: Help with interrupts pic18f2620

    hi tim.

    many thanks for the sample code.

  7. #6
    Licensed User Tim's Avatar
    Join Date
    Jan 2003
    Location
    london
    Posts
    6,950


    Default Re: Help with interrupts pic18f2620

    You have me confused. Unless your disabling interrupts during the RSIN it should not flicker

    However I have to reiterate, use HRSIN not RSIN

    Can you post your code so I can do a double check on the interrupt handling?
    Tim

+ Reply to Thread

Similar Threads

  1. PIC18F2620 Configuration Settings
    By Dick Barton in forum The Lounge
    Replies: 12
    Last Post: 19th June 2011, 03:45
  2. Help with interrupts please...
    By CThom in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 11th March 2011, 15:23
  3. Pic18F2620
    By dolci in forum Proton Plus Compiler v3
    Replies: 12
    Last Post: 22nd December 2008, 11:00
  4. PWM and interrupts
    By joesaliba in forum Proton Plus Compiler v3
    Replies: 11
    Last Post: 9th November 2007, 12:16
  5. Interrupts
    By chuckieboy in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 1st March 2007, 18:37

Members who have read this thread since 2nd May 2012, 19:46 : 0

Actions :  (Set Date)  (Clear Date)

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

Tags for this Thread

Posting Permissions

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