Other Parts Discussed in Thread: C2000WARE
I am trying to send a message repeatedly from SCI with an integer value counting up. The messages should look like this:
"The number is 0 The number is 1 The number is 2 ..."
What I have so far is this:
int n = 0;
unsigned char *msg;
msg = "\r\nThe number is";
for(;;)
{
SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 15);
?????
n++;
}
Which function should I use for the line I marked ????? in order to send the value of n? All library functions for SCI are for sending chars. I tried including "stdlib.h" and using the itoa() function, but it doesn't work for some reason returning the error:
unresolved symbol _itoa, first referenced in ./main.obj
#include "stdlib.h"
...
void main(void){
... //Initialize SCI
int n = 0;
unsigned char *val;
unsigned char *msg;
while(1)
{
msg = "\r\nNo: ";
SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 4);
itoa(n, val, 10);
SCI_writeCharArray(SCIA_BASE, (uint16_t*)val, sizeof(val));
n++;
}
}
I also tried using sprintf to create a new string but it didn't work either. Is there a simple way of including an integer into the message sent by SCI?