CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

[Bug] CCS 5.081 Interrupt-Vector-Table Bug for PIC18F27K42

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
garyatpt



Joined: 01 Oct 2018
Posts: 8

View user's profile Send private message

[Bug] CCS 5.081 Interrupt-Vector-Table Bug for PIC18F27K42
PostPosted: Tue Oct 02, 2018 12:28 am     Reply with quote

Dear all,
step1: Disabled interrupt vector table (IVT) using (//#device vector_ints)
-->When input 'uart2_cmd' from UART2 RX interrupts, everything work fine.

step2: Enabled interrupt vector table (IVT) using (#device vector_ints)
-->When input 'uart2_cmd' from UART2 RX interrupts, then mcu will "Stop" work.

For CCS 5.080, step1 & step2 all work fine.
Code:

//==============================================================
//ccs 5.081
//IVT_demo (Interrupt Vector Table demo)
//==============================================================

#include <18F27K42.h>
// Disabled interrupt vector table (IVT) <---work fine
// Enabled interrupt vector table (IVT) <---work error
#device vector_ints 

#fuses NOWDT
#use delay(internal=64MHz)

#use fast_io(A)

#pin_select U1TX=PIN_C1
#pin_select U1RX=PIN_C0       
#use rs232(baud=9600,  UART1, bits=8, stop=1, parity=N, stream=STREAM_UART1, errors)

#pin_select U2TX=PIN_C6
#pin_select U2RX=PIN_C7
#use rs232(baud=9600,  UART2, bits=8, stop=1, parity=N, stream=STREAM_UART2, errors)

#byte   LAT_A   =   0x3FBA
#bit    TP      =   LAT_A.0    //O

int8 uart2_cmd;

////****************************************
//// timer2 interrupts  (200us)
////****************************************
#int_timer2
void timer2_isr(void)

    TP=!TP;


//======================================================================
// UART2 RX interrupts
// Purpose:   Interrupt service routine for handling incoming serial data
//======================================================================
#int_rda2
void incomming_serial_2()
{                       

    uart2_cmd=fgetc(STREAM_UART2);
   
}

//----------------------------------------------------------------
void main(void)
{
int8 cmd;

    delay_ms(100);
   
    set_tris_a(0b00000000);     //RA0-->TP ouptup monitor
    TP=0;
   
    //------------------timer2 setting
    setup_timer_2(T2_DIV_BY_64 | T4_CLK_HFINTRC, 199, 1);   //200us
    set_timer2(0);
    enable_interrupts(INT_TIMER2);                          //enable TIMER2 interrupts
   
    //------------------enable UART2 RX interrupts
    enable_interrupts(INT_RDA2);
   
    //------------------global interrupts
    enable_interrupts(GLOBAL);
   
    //UART1
    fprintf(STREAM_UART1, "\r\nIVT_demo - %s\r\n", getenv("DEVICE"));
   
    do
    {
        //UART1
        fprintf(STREAM_UART1, "\r\nInput R from UART2: ");       
        uart2_cmd=0;
        do
        {             
            //Get cmd from (UART2)
            cmd = toupper(uart2_cmd);           
             
        } while((cmd != 'R'));
     
        //UART1
        fputc(cmd, STREAM_UART1);
        fprintf(STREAM_UART1, "\r\n------------- ");     
        fprintf(STREAM_UART1, "\r\nOk-->R ");
        fprintf(STREAM_UART1, "\r\n");

    } while(TRUE);
   
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Tue Oct 02, 2018 10:52 am     Reply with quote

Report this to CCS. The problem is not with the IVT itself, it is with the return from the interrupt when the IVT is enabled...
garyatpt



Joined: 01 Oct 2018
Posts: 8

View user's profile Send private message

PostPosted: Tue Oct 02, 2018 8:36 pm     Reply with quote

Thanks for the help.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group