hello! is there anyone could help me wth my final project?


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

    Default hello! is there anyone could help me wth my final project?

    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 //for special function register declarations
    #include //for the RB0/INT0 interrupt
    //#include
    //#include
    //#include


    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

    Quote Originally Posted by rookie View Post
    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 //for special function register declarations
    #include //for the RB0/INT0 interrupt
    //#include
    //#include
    //#include


    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();
    }
    Hey!
    This is getting fun!
    Try again...
    Notice the top of the web page.
    PicBasicPro.
    Anything about Pic C, or Microchip C, anything?
    And that final project excuse isn't going to get you anywhere either...jeeze...

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. A Temperature & Humidity Data Recorder Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 9th July 2008, 18:47
  3. Student Final Project Need help
    By marco in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th March 2007, 18:12
  4. Help with final project
    By OvERKiLL in forum General
    Replies: 4
    Last Post: - 15th December 2006, 20:35
  5. A category for Project Ideas
    By Pic_User in forum Forum Requests
    Replies: 2
    Last Post: - 23rd June 2006, 07:29

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