Replacing existing pic


Results 1 to 30 of 30

Threaded View

  1. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I would probably skip the interrupt and perform everything in a tight loop instead. As the Relay check is done pretty quick. Not a fan of using GOSUBs in a ISR.

    From what i feel, S2 should have dual contacts attach to GPIO<1:0>

    To know which relay is activated, i would bet that...
    Code:
    WhichRelay VAR BYTE
    '
    '
    '
    '
    WhichRelay=GPIO & 3
    Select case WhichRelay
        CASE 0 ' Relay 2
          ' do stuff for relay 2
    
        CASE 1 ' Relay 1
          ' do stuff for relay 1
     
        CASE 2 ' Relay 3
          ' do stuff for relay 3
         END SELECT
    If you still want to use Ints, don't re-enable the GIE bit, the PIC will do it for you. Just clear the offending INT flag and get out of there.

    If you play with GIE bit, you will run into problems, that's for sure.
    Last edited by mister_e; - 27th May 2008 at 16:34.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. Replacing Hall Effect throttle with PIC
    By idtat in forum General
    Replies: 4
    Last Post: - 22nd October 2009, 21:55
  3. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  4. Replacing shift register with PIC
    By TonyA in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 7th April 2008, 18:31
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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