Beginners: please read this post and this post before posting to the forum.

0 Members and 2 Guests are viewing this topic.

void input_test(void){while(1) { long int temp; temp=uart1GetByte(); if (temp != -1)//if data received { rprintf ("You sent: %d \n", temp); } }}

void input_test(void){ unsigned long int temp; while(1) { temp=uart1GetByte(); if (temp != -1)//if data received { rprintf ("You sent: %lu \n", temp); } }}

array digits[]int numberint power = 0for (i=number_of_digits -1 i>=0 i--) number = number + 10^power * digits[i] power++

In pseudo-code it would look like this:int Number=0;while(1) { temp=uart1GetByte(); if ((temp >= '0') && (temp <= '9')) Number = Number * 10 + temo -'0'; else if (temp == 13) { // Do something with the number! rprintf("got this: %d", Number); // Start the next number Number := 0; }}