microcontroller - Sending wrong data by TX/ UART -


i'm working pic32mx795f512l , mplabx v2.10 , xc32 on little project et need send data (for now, 0 or 1) via rx/tx "something" convert usb.

the problem i'm receiving strange things

 #define uart_baud_rate 9600  char* cmd;  int main(void) {       uartconfigure(uart1, uart_enable_pins_tx_rx_only);      uartsetfifomode(uart1, uart_interrupt_on_tx_not_full | uart_interrupt_on_rx_not_empty);      uartsetlinecontrol(uart1, uart_data_size_8_bits | uart_parity_none | uart_stop_bits_1);      uartsetdatarate(uart1, getperipheralclock(), uart_baud_rate);      uartenable(uart1, uart_enable_flags(uart_peripheral | uart_rx | uart_tx));      while (1)      {          cmd="1";          uart_send_data((byte*)cmd,1); 

the uart_send_data function is:

void uart_send_data(byte *buffer, uint8 size) {     uint8 i;     for( i=0; i<size; i++ )     {         uart_put_c(*buffer);         buffer++;     }      while(!uarttransmissionhascompleted(uart1)); } 

and uart_put_c:

void uart_put_c(char c) {     while(!uarttransmitterisready(uart1));     uartsenddatabyte(uart1, c); } 

so, i'm sending 1 or on tx1. but, when @ i'm receiving on usb port (thanks docklight) in ascii: ð |ð, in hex: 0c f0 00 f0 0c ect ... so, knows problem coming from?

thansk in advance.

cheers


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -