Remove Text Formatting
Loading...

+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Qacer's Avatar
    Qacer Guest

    Question Priority interrupt?

    Hi all,



    I have three signals that are prioritized. Let's say S1 = 1st priority, S2 = 2nd, and S3 = 3rd.

    I'm planning on connecting each signal line to an available pin in the PIC mcu. I'm trying to understand how I can use the interrupt feature so that it will do the following:

    - if S1 is present, then ignore any signals from S2 and S3 and output S1.
    - if S2 is present and S1 is not, then ignore any signal from S3 and output S2.
    - however, if S1 comes on a few seconds later, then ignore S2 and S3 and output S1.

    Can anyone give me some tips on how I can go about implementing this?

    I haven't really dealt with the interrupt feature before.

    Thanks!

  2. #2
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382

    Default

    Interrupts are what they say they are, the are actions that interrupt the normal progression of your software.

    For example, when serial data comes into the UART and interrupt occurs and the program jumps to a sub to collect the data. Once complete the program continues where it was interrupted.

    What you are describing is a bunch of conditional statements, not really interrupts.

  3. #3
    Qacer's Avatar
    Qacer Guest

    Default

    Hi!

    You are correct. They are conditional statements, but I'm trying to figure out how to do this (sorry if I don't explain it clearly.. I'm still thinking it in my head):

    - If S2 is present, then output the signal at the same time perform some instructions specific to S2. So while these instructions are being performed, if S1 comes on, then I want to be able to interrupt this process and perform the instructions specific to S1.

    - But if S1 is present and S1 specific instructions are carried out, I don't want S2 to interrupt this process.

    - However, since S2 has a higher priority than S3, it then has to have some interrupt capability to break any S3 instructions that are currently performed.

    So that means that while S1 instructions are being processed, a signal from S2 can still interrupt S1.

    How do I keep lower priority signals from interrupting higher priority signals? (I guess this should've been my original question.)

    Thanks!

  4. #4
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382

    Default

    To give you any more assistance we will need more information.
    What you are explaining is way too vague and ethereal to give an accurate answer.

    What specifically are you trying to do? What are these “signals” you are trying to receive? What are you trying to output? What type of chip are you using? What ports are these “signals” connected to?

  5. #5
    Qacer's Avatar
    Qacer Guest

    Default

    Hiya!

    Well, let's say the signals are a sample of an analog signal rectified and sent to a multivibrator to turn them into a pulse representation. The pulses are then sent to a pin to a PIC. I don't have any specific chips in mind, but I'm thinking maybe a PIC12F675.

    The signals come from multiple sources. Let's say three. So, I would use three pins from the PIC. Then, when the PIC detects a signal, it is supposed to do some processing and then re-route the signal via a separate analog switch. The PIC would control the analog switch.

    So as different signals come along from different sources, then the PIC is supposed to prioritized them based on which source the signal comes from. So, if the PIC is processing a signal from a 2nd priority source and a 1st priority signal comes along, it is supposed to stop what its doing and process the 1st priority signal.

  6. #6
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382

    Default

    Interrupts are determined by the pic you choose.

    The only interrupt that might apply, depending on the pic, is PortB change. Even then all it would do is jump to a sub anytime one of the affected ports changed status. You still would need to write code to determine the "priorities" you are speaking of.

    Based on the application interrupts are not going to be any assistance to you. You are going to have to do this conventionally by polling each pin and writing conditional statements. Interrupts don't function in the way you are hoping they would.

    I would assume this if for the following project http://www.picbasic.co.uk/forum/showthread.php?t=4772
    Last edited by DynamoBen; - 6th October 2006 at 04:48.

  7. #7
    Qacer's Avatar
    Qacer Guest

    Default

    Hello,

    Yep, it is for that project. I thought about polling the pins, but that would take extra battery charge, which I really don't want to do.

    Thanks!

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 19:14
  4. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 03:59
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

Members who have read this thread : 0

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