diff --git a/cMIPS/tests/uart.c b/cMIPS/tests/uart.c index 09d01e3be8eaa2f9caa190b3b2972d3167ff65bd..ac163630c1b66439accf877ef4fa1b2c9500b1b8 100644 --- a/cMIPS/tests/uart.c +++ b/cMIPS/tests/uart.c @@ -84,6 +84,7 @@ int main(){ v[i] = n; n = 0; i++; + insertionSort(v,i); }else{ h = ctoi(c); if(h != EOF) { @@ -94,10 +95,10 @@ int main(){ } } - insertionSort(v,i); char hex[9]; - for(;i>0;i--){ - itoc(v[i-1], hex); + int count; + for(count = 0; count < i; count++){ + itoc(v[count], hex); n = 0; while(hex[n] != '\0') { Putc(hex[n]); @@ -110,7 +111,6 @@ int main(){ writeFirstChar(); } - int count; for(count=0;count<1000;count++); //Wait for the remote uart return 0; @@ -239,4 +239,4 @@ void itoc(int n, char* result) { j = 1; } result[j] = '\0'; -} \ No newline at end of file +}