hello everyone;
im going to build a code file for my pic16f877a but i stacked and i need some help
im want to build a code for get ascii via uart from pc.
for example; im want to read a string from pc which is like "Q45" and then i want to convert it to ascii codes[example:Q-->81 , 4-->52 , 5-->53 and i need to see on UART 815253 ]
ineed this cause i ll gonna process after all.
here is my some codes;
char q[5]={'ef'};
char isascii[8] ;
int c=5;
int convint=5;
itoa (isascii,c,10); // convert integer to string
UART_send_string(isascii);// i can see "5" on my terminal
UART_send_string("__");
convint = atoi( q ); // convert string to integer
itoa (k,convint,10);
UART_send_string(k); // i can only see "0" on my terminal
the code is so much ruined, i know. i tried every possible thing and now here i am. i m a newbie in this forum guys
i can also be grateful if you guys have any idea or codes for me . im using mplab xc8 compiler for this project.
thanks in advance and sorry for my english
im going to build a code file for my pic16f877a but i stacked and i need some help
im want to build a code for get ascii via uart from pc.
for example; im want to read a string from pc which is like "Q45" and then i want to convert it to ascii codes[example:Q-->81 , 4-->52 , 5-->53 and i need to see on UART 815253 ]
ineed this cause i ll gonna process after all.
here is my some codes;
char q[5]={'ef'};
char isascii[8] ;
int c=5;
int convint=5;
itoa (isascii,c,10); // convert integer to string
UART_send_string(isascii);// i can see "5" on my terminal
UART_send_string("__");
convint = atoi( q ); // convert string to integer
itoa (k,convint,10);
UART_send_string(k); // i can only see "0" on my terminal
the code is so much ruined, i know. i tried every possible thing and now here i am. i m a newbie in this forum guys
i can also be grateful if you guys have any idea or codes for me . im using mplab xc8 compiler for this project.
thanks in advance and sorry for my english