I have problem with interrupt RB0


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    Posts
    70

    Default I have problem with interrupt RB0

    Sorry for wrong post this is proton code

    I did make code with ir decode for control on/off output
    now ir decode work properly but we need to add input switch for control also.
    Right now we used interrupt with RB0 for monitor IR modul active but don't work

    I'm not clear once interrup rb0 found and goto "disable" and effected to pulsin disable also or not

    Pls advise too , Below is may code

    code{}
    DEFINE LOADER_USED 1
    Include "PROTON_4.INC"
    'Enable Debug
    Dim IR As Word
    Dim pulses[33] As Byte
    Dim BitMask As Word
    Dim i As Byte 'loop index
    Dim b As Byte 'byte index
    Dim LeadIn As Word 'start pulse
    dim sw1 as portb.1

    OPTION_REG = %00000111
    INTCON = %00100000
    TRISB = %00000011
    ON_INTERRUPT GoTo loop

    Main:
    If sw1=0 then
    toggle portb.4
    endif

    GoTo Main

    Output_drive:
    'for i = 0 to 31
    ' HSEROUT ["B",dec pulses[i],13,10]
    'next
    HSerOut ["W ",Dec BitMask,13,10]
    HSerOut ["Bot ",Dec BitMask.LowByte,13,10]
    HSerOut ["Cmd ",Dec BitMask.HighByte,13,10]

    '-- output control --------------
    If BitMask.LowByte = 84 Then
    If BitMask.HighByte = 41 Then
    If PORTB.4 = 0 Then
    PORTB.4 = 1
    Else
    PORTB.4 = 0
    EndIf
    EndIf
    EndIf

    BitMask =0 'clear
    DelayMS 50
    GoTo Active_INT

    Disable
    loop:
    'toggle portb.6
    PulsIn PORTB.0, 0, LeadIn
    If LeadIn < 400 Then GoTo Active_INT '885
    If LeadIn > 1045 Then GoTo Active_INT
    For i = 0 To 31

    PulsIn PORTB.0, 1, pulses[i]

    Next
    For i = 16 To 27
    If pulses[i] > 40 Then
    If pulses[i] < 300 Then
    GoTo Active_INT
    EndIf
    EndIf

    If pulses[i] > 99 Then
    BitMask.0 = 1
    BitMask = BitMask << 1
    EndIf

    BitMask.0 = 0
    BitMask = BitMask << 1

    Next
    GoTo Output_drive

    Active_INT:
    Resume ' Return to main program
    Enable ' Enable interrupts after the handler

    End
    Last edited by chai98a; - 5th July 2008 at 02:20. Reason: Sorry for wrong post this is proton code

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Talking

    Hi,

    Just replace PULSIN by RCTime ( Ooops ... RCIN !!! ) in the interrupt Stubb ...

    That's all !

    For the reason ... this Topic has been discussed a week or Two ago with FLOTUL ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Problem with Interrupt on PIC18F4620 PORTB
    By rookie in forum Off Topic
    Replies: 1
    Last Post: - 22nd March 2007, 01:34
  2. RB0 interrupt problems
    By amindzo in forum General
    Replies: 1
    Last Post: - 26th August 2006, 11:52
  3. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  4. Interrupt Problem
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th November 2005, 20:58
  5. Interrupt stack overflow problem with Resume {label}
    By Yuantu Huang in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd May 2005, 01:17

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