Keil Logo Arm Logo

Discussion Forum

Debug Communication Channel

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Sridhar Gadda
Posted
19-May-2005 16:23 GMT
Toolset
ARM
New! Debug Communication Channel
Hi,

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
New! RE: Debug Communication Channel
I have tried to duplicate your problem. But everything is working just fine. Basically I copied your routines into the example:

Keil\ARM\Boards\Keil\MCB2100\DebugIO\Test1

Reinhard

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.