I want to use Ulink for downloading frimware as well as the µvision debug serial window to diplay result. I can display the string but not hex values.
my code is
#include <LPC21xx.H>
#include <DebugIO.H>
#include <stdio.h>
void init_serial(void)
{
PINSEL0 |= 0x00000005;
U0LCR = 0x83;
U0DLL = 16; /* 57600 Baud rate @ 15MHz VPB clock */
U0LCR = 0x03;
}
int putchar (int ch) /* write character to serail port */
{
#ifdef DEBUG
return (__dbg_putchar(ch));
#else
if (ch == '\n')
{
while(!(U0LSR & 0x20));
U0THR = '\r';
}
while (!(U0LSR & 0x20));
return (U0THR = ch);
#endif
}
int getchar (void) /* Read character from serial port */
{
#ifdef DEBUG
return (__dbg_getkey());
#else
while(!(U0LSR & 0x01));
return (U0RBR);
#endif
}
void puthex (int hex)
{
if (hex > 9) putchar('A' + (hex-10));
else putchar('0' + hex);
}
void putstr (char *p)
{
while(*p)
{
putchar (*p++);
}
}
int main ()
{
#ifndef DEBUG
init_serial();
#endif
putstr("\n");
putstr("\n The value in hex is 0x");
puthex((byte >> 4) & 0x0F); / byte = 8 bit char value */
puthex (byte & 0x0F);
}
I can see the result on Hyperterminal but on serial window of IDE. I see only my srting The Value in hex is 0x and not hex values which I want to display.
where am I doing wrong.
Please help me out.
regards,
Sridhar
Read-Only
Author Reinhard Keil
Posted 23-May-2005 08:03 GMT
Toolset ARM
RE: Debug Communication Channel
Reinhard Keil
I have tried to duplicate your problem. But everything is working just fine. Basically I copied your routines into the example:
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.