garyatpt
Joined: 01 Oct 2018 Posts: 8
|
[Bug] CCS 5.081 Interrupt-Vector-Table Bug for PIC18F27K42 |
Posted: Tue Oct 02, 2018 12:28 am |
|
|
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);
}
|
|
|