From b628079cea68842768b49a8ad31454be9bc6e593 Mon Sep 17 00:00:00 2001
From: VytorCalixto <vytorcalixto@gmail.com>
Date: Sat, 20 Jun 2015 23:42:44 -0300
Subject: [PATCH] Sorting and printing order changed

Sorting now occurs when getting a char
Data is now sent in ascending order
---
 cMIPS/tests/uart.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cMIPS/tests/uart.c b/cMIPS/tests/uart.c
index 09d01e3..ac16363 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
+}
-- 
GitLab