I am not seeing where are you setting the baud rate?
can you send me the
Init_SCI0(BUS_CLK_HZ); function?
normally you need to set something like this
SCI2_BD |= 52; //set baud rate 9600 (8Mhz/(16 x 52)) // in your case SCI0
this is a simple sample code
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
void SCI2RX_ISR(void);
unsigned char u8receiver, flag,chema = 0;
void main(void) {
EnableInterrupts;
/* include your code here */
/* WDOG_CNT: CNT=0xC520 */
WDOG_CNT = 0xC520; /* First part of the WDG unlock sequence */
/* WDOG_CNT: CNT=0xD928 */
WDOG_CNT = 0xD928; /* Second part of the WDG unlock sequence */
/* WDOG_TOVAL: TOVAL=4 */
WDOG_TOVAL = 0x04;
/* WDOG_CS2: WIN=0,FLG=0,??=0,PRES=0,??=0,??=0,CLK=1 */
WDOG_CS2 = 0x01;
/* WDOG_CS1: EN=0,INT=0,UPDATE=0,TST=0,DBG=0,WAIT=0,STOP=0 */
WDOG_CS1 = 0x00; /* Disable watchdog */
/* System clock initialization */
/*lint -save -e923 Disable MISRA rule (11.3) checking. */
if (*(unsigned char*far)0xFF6FU != 0xFFU) { /* Test if the device trim value is stored on the specified address */
ICS_C3 = *(unsigned char*far)0xFF6FU; /* Initialize ICS_C3 register from a non volatile memory */
ICS_C4 = (unsigned char)((*(unsigned char*far)0xFF6EU) & (unsigned char)0x01U); /* Initialize ICS_C4 register from a non volatile memory */
}
/*lint -restore Enable MISRA rule (11.3) checking. */
/* ICS_C1: CLKS=0,RDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */
ICS_C1 = 0x06U; /* Initialization of the ICS control register 1 */
/* ICS_C2: BDIV=1,LP=0 */
ICS_C2 = 0x20U; /* Initialization of the ICS control register 2 */
/* ICS_C4: LOLIE=0,CME=0 */
ICS_C4 &= (unsigned char)~(unsigned char)0xA0U;
SCI2_C1 = 0x00; /* Reset flags */
SCI2_C3 = 0x00; /* Configure the SCI */
SCI2_C2 = 0x00; /* Disable error interrupts */
SCI2_S2 = 0x00; /* Disable all interrupts */
SCI2_BD |= 52; //set baud rate 9600 (8Mhz/(16 x 52))
SCI2_C1 |= 0x00;
SCI2_C2 |= (SCI2_C2_TE_MASK | SCI2_C2_RE_MASK);//| SCI2_C2_RIE_MASK); /* Enable transmitter, Enable receiver, Enable receiver interrupt */
for(;;)
{
// __RESET_WATCHDOG(); /* feeds the dog */
while (SCI2_S1_TDRE == 1)
{
SCI2_D =('a');
}
} /* loop forever */
/* please make sure that you never leave main */
}
/***************************************************************************************/
interrupt VectorNumber_Vsci2rx void SCI2RX_ISR(void)
{
(void) SCI2_S1; // read SCIS1 register for clear RDRF flag
u8receiver = SCI2_D;
//SCI2_D = 1+u8receiver;
}
/***************************************************************************************/