Here’s the code I’m using so far, it doesn’t work tho as it doesnt seem to want to flash to my lpc2378 chip.
uart0Write("414243");
void uart0Write(char *data)
{
char ch;
char* temp;
temp = hex2asc(data);
while ((ch = *temp) && (uart0WriteByte(ch) >= 0))
data++;
}
static char *cpHex = "0123456789ABCDEF";
static int _Char2Index(char cHexChar) {
char* cpPtr;
cpPtr = strchr(cpHex, toupper(cHexChar));
if (NULL == cpPtr) return(0);
return((int)(cpPtr - cpHex));
}
char* hex2asc(char* cpSrc) {
char* cpBuffer;
char* cpDst;
cpBuffer = malloc( strlen(cpSrc)/2 + 1 );
cpDst = cpBuffer;
while ('\0' != *cpSrc) {
*cpDst = _Char2Index(*cpSrc)*16 + _Char2Index(*(cpSrc+1));
cpDst++;
cpSrc +=2;
}
*cpDst = '\0';
return (cpBuffer);
}