Could any pro out there help me to solve it? really appreciates


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2007
    Posts
    4

    Default Could any pro out there help me to solve it? really appreciates

    Hi,
    i have this problem on my program. I tried calling the interrupt routine but it just won't be called. For this case, i need to press the SW3(button) and there will be an interrupt but the interrupt just wont be activated and hence the routine won't be called. Can anyone help me with this? Any help will be appreciated.My source code is as below:


    #include<p18f4620.h> //for special function register declarations
    #include<portb.h> //for the RB0/INT0 interrupt
    //#include<adc.h>
    //#include<stdlib.h>
    //#include<delays.h>


    void Record (void);
    #pragma code InterruptVectorHigh = 0x08
    void InterruptVectorHigh(void)
    {
    _asm
    goto Record
    _endasm
    }
    #pragma code //allow the linker to locate the remaining code

    #pragma interrupt Record
    void Record(void)
    {
    PORTDbits.RD6=0;
    PORTDbits.RD7=0;
    PORTCbits.RC2=0;
    INTCONbits.INT0IF=0; //clear flag to avoid another interrupt
    }

    void EnableHighInterrupts(void)
    {
    RCONbits.IPEN =1; //enable interrupt priority levels
    INTCONbits.GIEH=1; //enable all high priority interrupts
    }

    void WaitForRecord(void)
    {
    //INTCONbits.RBIF=0;
    while(1); //wait for the SW3 button to be pressed
    }

    void main(void)
    {
    /*Port, TRIS and LAT initialisation*/
    //TRISA = 0x8F; //RA<3:0> as inputs, this value will change after
    //checking PORT A
    //PORTAbits.RA4=1;
    //PORTAbits.RA5=1; //it showed HIGH on hardware but not at the
    //watch view
    ADCON1 = 0x0F;
    TRISB = 0x07; //RB<2:0> as inputs
    //RB<5:3> as outputs
    //RB<7:6> as inputs
    LATB = 0x00;
    //PORTB=0x00;
    //PORTBbits.RB3=1;
    //PORTBbits.RB4=1;
    //PORTBbits.RB5=1;

    //TRISC = 0x20; //RC5 as inputs
    //RC<7:6>, RC<4:0> as outputs
    //PORTCbits.RC0=1;
    //PORTCbits.RC1=1;
    //PORTCbits.RC2=1;
    //PORTCbits.RC3=1;
    //PORTCbits.RC4=1;

    //TRISD = 0x00; //RD<7:0> as outputs

    //PORTDbits.RD6=1;
    //PORTDbits.RD7=1;

    //TRISE = 0xB0; //RE<2:0> as outputs, this value will change after
    //checking PORT E
    //ADCON1 = 0x0A;//Configure A/D for digital inputs for PORT E
    //PORTEbits.RE0=1;
    //PORTEbits.RE1=1;
    //PORTEbits.RE2=1;


    EnableHighInterrupts();

    OpenRB0INT(PORTB_CHANGE_INT_ON & //enable the RB0/INT0 interrupt
    PORTB_PULLUPS_ON & //configure the RB0 pin for input
    FALLING_EDGE_INT); //trigger interrupt upon SW3 button
    //depression
    WaitForRecord();
    }

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    And yet again...look at the top of the web page...and tell me what you see.
    I'd bet anything you'd see something relating to PicBasic.
    I'd bet twice anything you don't see anything relating to C.
    I could be wrong....

Similar Threads

  1. PicBasic Pro Demo
    By nbrucew in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th August 2009, 19:10
  2. Calculate Byte Value Checksum in PBP Pro
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th July 2009, 22:50
  3. pbp pro versus oshon or bascom basic
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd September 2006, 00:49
  4. Question for all that use MELABS PICBASIC PRO
    By oskuro in forum Off Topic
    Replies: 2
    Last Post: - 24th March 2005, 17:15
  5. Need help converting to PB Pro from Mbasic Pro
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 11th February 2004, 07:43

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