Hi guys
I'm using SCI to transmit data if the received command is correct. I can transmit data to hyper Terminal but not receive data. There is no new data in the receive buffer and the bus is unused.
My code is like this
void init_SCI(void){
GCR = 0x08; // SYSCLK = 4*Oscil = 24MHz
PCR = 0x01; // ICLK = SYSCLK
SCI3PC1 = 0x03; // CLK output on Pin SCICLK
SCI3CTL3 &= ~SW_NRESET; // Entering reset state
CLKCNTL = 0x60;
SCI3CCR |= TIMING_MODE_ASYNC; // Asynchronous timing
SCI3CCR |= CHAR_8; // 8 Data bits
SCI3CCR &= ~COMM_MODE_ADDRESS; // idle-line mode
SCI3CTL1 |= RXENA; // Allows the receiver to transfer data from shift buffer to the receive buffer
SCI3CTL2 |= TXENA; // Enable SCI to transfer data from SCITXBUF to SCITXSHF
SCI3CTL3 |= CLOCK; // Internal SCICLK
SCI3CTL3 |= RX_ACTION_ENA; // Receive DMA/interrupt enabled
SCI3CTL3 |= TX_ACTION_ENA; // Transmit DMA/interrupt enabled
SCI3CTL3 |= RXERR_INT_ENA;
SCI3HBAUD = 0x00;
SCI3MBAUD = 0x01;
SCI3LBAUD = 0x38;
SCI3PC2 |= RX_FUNC; // SCIRX is the SCI receive pin
SCI3PC3 |= TX_FUNC; // SCITX is the SCI transmit pin
SCI3CTL3 |= SW_NRESET; // Leaving reset state
}
void Read_from_SCI(int Command, int data[], int data1[]){
int RXBUF;
SCI3CTL1 |= RXENA;
if ((SCI3CTL1 & 0x04) == 0x04){ // new data ready to be read *This line can not be fulfilled*
RXBUF = SCI3RXBUF; // read receive buffer
SCIcommand(RXBUF, data, data1, Command);
}
SCI3CTL1 &= ~RXENA;
}
Is there anything wrong with my code??
Thanks a lot
Rui