Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: IO0DIR changing VPBDIV ??

2005-04-01 by Adam and Simon

Sorry guys.  Guess I should have checked the Errata first.

Changing the standard UART0 code from (a) to (b) sorted it.

(a)

static unsigned int
peripheralClockFrequency(void)
{
  unsigned int divider;
  switch (VPBDIV & 3)
    {
      case 0:
        divider = 4;
        break;
      case 1:
        divider = 1;
        break;
      case 2:
        divider = 2;
        break;
    }
  return processorClockFrequency() / divider;
}

(b)
static unsigned int
peripheralClockFrequency(void)
{
  unsigned int divider;
  unsigned int vpbdivtemp;
  
  vpbdivtemp = VPBDIV;
  vpbdivtemp = VPBDIV;

  switch (vpbdivtemp & 3)
    {
      case 0:
        divider = 4;
        break;
      case 1:
        divider = 1;
        break;
      case 2:
        divider = 2;
        break;
    }
  return processorClockFrequency() / divider;
}

/******************************************************************/
There are 10 kinds of people: those who understand binary and those 
who don't.
/******************************************************************/


--- In lpc2000@yahoogroups.com, Adam Wilkinson <lpc2129@y...> wrote:
> Love the LPC2129.
>  
> Can anyone explain why the following line of code is 
changing/resetting VPBDIV from 0x01 to 0x00??
>  
> IO0DIR = 0x006F0001;
>  
> Prior to this line IO0DIR is set to 0x006FFF01;
>  
> ??  Thanks ??
> 
> 
> Send instant messages to your online friends 
http://uk.messenger.yahoo.com 
> 
> [Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.