Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
Hello all,
Pleas, I have problems setting the UART for receiving, I followed the examples but still not working. I did the following:
Using HALGOGEN:
1. Enable SCI1 driver
2.Configure SCI , just setting the baud rate and stop and start bit, I don't know if i should configure more than that, unfortunately the examples are NOT clear.
3. Generating the code.
In CCS, I edited the code as follow:
//--------------------------------------------------------------------------------------------------------------------------------------
/* Include Files */
#include "HL_sys_common.h"
#include "HL_system.h"
/* USER CODE BEGIN (1) */
#include "HL_sci.h"
#define Size 7
// send the following
uint8 T_Data[Size]= {'C','M','I','Y','C',' ',' '};
//store the received data
uint8 R_Data[Size];
// function prototype
void sciDisplayText(sciBASE_t *sci, uint8 *text, uint32 length);
void wait(uint32 time);
//choosing UART1
#define UART sciREG1
/* USER CODE END */
void main(void)
{
/* USER CODE BEGIN (3) */
sciInit(); /* initialize sci/sci-lin */
/* even parity , 2 stop bits */
sciDisplayText(UART,&T_Data[0],Size); /* send text code 1 */
while(1) /* continious desplay */
{
};
/* USER CODE END */
}
/* USER CODE BEGIN (4) */
void sciDisplayText(sciBASE_t *sci, uint8 *text,uint32 length)
{
while(length--)
{
while ((UART->FLR & 0x4) == 4); /* wait until busy */
sciSendByte(UART,*text++); /* send out text letter by letter */
wait(200);
sciReceive(UART, 1, &R_Data[length]);
};
}
void wait(uint32 time)
{
time--;
}
/* USER CODE END */
//----------------------------------------------------------------------------------------------------
basically, the T_Data is sent via sciSendByte(UART,*text++); and it is displayed on the terminal
I need the sciReceive(UART, 1, &R_Data[length]); to store the data in R_Data, which I couldn't make it happen
Is my mistake in the configuration part, or in the code part??, I ran out of ideas.. Thank you