Tool/software: Code Composer Studio
Hello
I have a char array "RXData[6]" which has a start but 4-digit data and a stop bit. Eg: $1234%. From this, I need the no 1234 to be stored into an int variable "Code". My program is as follows:
unsigned int j, z, f=1000;
for(j=0;j<6;j++)
{
while (!(UCA1IFG & UCRXIFG)) /*EMPTY*/;
RXData[j] = UCA1RXBUF;
}
__delay_cycles(10000);
__no_operation();
//z = (int)(RXData[1]);
code1=0;
for(j=1;j<5;j++)
{
temp1 = RXData[j];
code1 = (code1 + (f * temp1));
f = f/10;
}
The above code doesn't work because RXData is char and I need it to be in Int. I tried converting it to int (z = (int)(RXData[1]);) but this doesn't work. I tried 'otai' function as well but it's not recognized. How do I go about this conversion?
Thank you
Varun R