Hi All,
Anyone feel like going though this code line by line with me as im new to this language and trying to get a pic working. Its supposed to output values that were gotten in hex as strings.
Many Thanks and happy christmas / new year.
Code://usart.c #ifndef USART_H #define USART_H #include <pic18.h> #include <stdio.h> #include "usart.h" #include "Compiler.h" #include "portmap.h" void putch(char c) { while( !DEBUG_TXIF); DEBUG_TXREG = c; } const char hexDigit[] = "0123456789ABCDEF"; void puthexdigit(unsigned char c) { putch(hexDigit[c]); } void putdec(unsigned char c) { if(c >= 200) { putch('2'); c -= 200; } else if(c >= 100) { putch('1'); c -= 100; } if(c >= 10) putch('0' + (c / 10)); else putch('0'); putch('0' + (c % 10)); } void puthex(unsigned char c) { puthexdigit(c >> 4); puthexdigit(c & 0x0F); } void puthex2(unsigned int c) { puthex(c >> 8); puthex(c); } void puthex4(unsigned long int c) { puthex(c >> 24); puthex(c >> 16); puthex(c >> 8); puthex(c); } void puthexstr(const char* str, int numBytes) { for(; numBytes--; ++str) puthex(*str); } #endif