RB0 interrupt problems


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006
    Location
    Iran
    Posts
    94

    Default RB0 interrupt problems

    Hi,
    i enabled RB0 interrupt it works but my problem didn't solve.i have a same problem as i had in
    USART interrupt.
    in RB0 interrupt also just interrupt routine works and other part of my program don't work.
    i write a simple program to turn on and off led and when serial data is coming the RB0 interrupt
    occur (because i send 10101010 befor my data) .
    so when serial data is coming the program goes to interrupt routine and show the revieved data on lcd but led doen't turn on or off.
    just interrupt routine works.
    what's the reason?
    i have a same problem in USART interrupt too.
    i use micro code studio picbasic pro2.41
    for more information see USART interrupt in PIC16F877A
    http://www.picbasic.co.uk/forum/showthread.php?t=4511
    this is my simple program:


    define OSC 20
    include"modedefs.bas"
    ADCON1=7 ' convert porta from analoge to digital
    TRISA = %00000000 ' set porta as an output
    TRISB = %00001111 'set first 4 bit of portb as an input and last 4 bit as putput
    TRISC = %00000000 ' set portc as output
    '----------------------------------------------------
    ' Define LCD parameters
    ' Set LCD Data port
    DEFINE LCD_DREG PORTD
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 4
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTD
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 1
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTD
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 0
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    pause 100
    lcdout $fe,1
    i var word
    y1 var byte
    y2 var byte
    y3 var byte

    on interrupt goto int
    OPTION_REG = %10000000
    INTCON = %10010000
    TRISB = %11111111
    start:
    for i=1 to 1000
    PORTC.3=0
    pause 1
    next i
    for i=1 to 1000
    PORTC.3=1
    pause 1
    next i
    goto start
    disable
    int:
    serin PORTB.0,N1200,["A"],y1
    serin PORTB.0,N1200,["A"],y2
    serin PORTB.0,N1200,["A"],y3
    '
    if (y2=y3) then
    lcdout $fe,1,#y2
    pause 4000
    lcdout $fe,1
    PORTC.4=1
    pause 4000
    PORTC.4=0
    endif
    OPTION_REG = %10000000
    INTCON = %10010000
    resume
    enable
    end
    Last edited by amindzo; - 26th August 2006 at 10:31.

  2. #2
    Join Date
    Aug 2006
    Location
    Iran
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Hi,
    i found that two interrupts(USART and RB0) are working and when i turn on micro it goes to interrupt routine.
    for RB0 i should connect a pull up resistor but when i connect the out put of the RF reciever to it interrupt occurs.
    i don't know why?
    maby the noise of RF reciever (when we don't have data) is the reason.
    for USART interrupt ,i have the same problem but in this case , there is no deference between connecting and not connecting the RF reciever.
    when i turn on micro it goes to interrupt routine.
    what is the reason?
    what should i do?

Similar Threads

  1. 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
  2. RB0 interrupt and toggle issue
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 35
    Last Post: - 5th May 2009, 19:49
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  4. Interrupt Problem
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th November 2005, 20:58
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

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