Last active
August 29, 2015 14:10
-
-
Save jamsesso/fb0b2b5b3c535b38687d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void outchar(char ch) { | |
volatile int* JTAG_UART = (int*) 0x00008840; | |
*JTAG_UART = ch; // Write char to display. | |
} | |
char bin2hex(char hex) { | |
hex &= 0x0F; // Mask last 4 bits. | |
return hex <= 9 ? hex + '0' : hex - 10 + 'A'; | |
} | |
void outhex(char n) { | |
char msn = n >> 4; // put first 4 bits into msn (most significant nibble) | |
outchar(bin2hex(msn)); | |
outchar(bin2hex(n)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment