Hi,
I am trying to use the USART for UART communication on the CC1110f32. I am using the following code and I am receiving data on the other end as expected (every three seconds) but every time I receive the wrong character. Instead of receiving the character a (0x61) every three seconds I am instead receiving the character á (0xe1) every three seconds. I have tried different characters with the same problem and also the code sample UART_CC111x_CC251x_ISR.c which again had the same problem when connected to my computer.
I am fairly confident that everything is set up correctly and that I am using the correct baud rate on my terminal.
#include "hal.h" #include "hal_types.h" #include "hal_defs.h" #include "cc8051/hal_cc8051.h" #include "ioCCxx10_bitdef.h" #include <ioCC1110.h> void sleepMS(int ms) { int j; while (--ms > 0) { for (j=0; j<400;j++) asm (" NOP"); // about 1 millisecond }; } int main(void) { /* Set function of P0_0 to general purpose I/O */ P0SEL &= BIT0; /* Write value to pin. Note that this is a direct bit access. * Also note that the value is set before the pin is configured * as an output, as in some cases the value of the output needs * to be defined before the output is driven (e.g. to avoid * conflicts if the signal is shared with an other device) */ P0_0 = 1; char ch = 'a'; /* Change direction to output */ P0DIR |= BIT0; UART_SETUP(0,9600,HIGH_STOP); while(1) { sleepMS(3000); UART_SEND(0, ch); P0_0 ^= 1; } return 0; }
Thank you for your help,
Robert Nash.