Yahoo Groups archive

Lpc2000

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

Thread

I could use some IAR blinking code.

I could use some IAR blinking code.

2006-05-22 by cacheman22

I am looking for some code to toggle a pin on the LPC-2119 using the
IAR  KickStart compiler. P1.16 in particular. I have an LED hooked up
and am looking to make it blink. The trouble I'm having is not with C,
but setting up the project and environment. I have code downloading to
a ET_ARM STAMP LPC-2119 by ETT.

I have this code compiling:

/***************************************************************/

#include <IOLPC2119.H>                     // LPC2119 MPU Register

/* pototype  section */
void delay_led(unsigned long int);       // Delay Time Function

int main(void)
{  
   PINSEL2 &= 0xFFFFFFFC;                // Makesure GPIO1.16 = GPIO
Function
   IO1DIR   = 0x00010000;                // Set GPIO1.16 = Output
   IO1SET   = 0x00010000;                // Set GPIO1.16 Output Pin
(OFF LED)

   // Loop Blink LED on GPIO1.16 //
   while(1)                              // Loop Continue
   {
      IO1CLR = 0x00010000;               // Clear Output Pin P1.16 (ON
LED)
      delay_led(1500000);                // Display LED Delay
      IO1SET = 0x00010000;               // Set Output Pin P1.16
(OFF LED)	    
      delay_led(1500000);                // Display LED Delay
   }   
}	  

/******************************************************/
/* Delay Time Function                                                 */
/* 1-4294967296                                                        */
/******************************************************/

void delay_led(unsigned long int count1)
{
   while(count1 > 0)                     // Loop Decrease Counter	
   {
      count1--;
   }
}


Any help would be appreciated.

Re: I could use some IAR blinking code.

2006-05-22 by pfavr2

Hi,

I'm currently trying to the same thing (i.e. making a LED blink on
port 1.24 of an LPC2148). I'm using GNU tools and openocd. So far I
haven't succeeded.

Looking at your source code, I believe that you need to assign all
zeros to PINSEL2 register. Writing ones means turning on Debug or
Trace according to the User Manual page 80.

Good luck!

Best regards,

Peter

--- In lpc2000@yahoogroups.com, "cacheman22" <cacheman22@...> wrote:
>
> I am looking for some code to toggle a pin on the LPC-2119 using the
> IAR  KickStart compiler. P1.16 in particular. I have an LED hooked up
> and am looking to make it blink. The trouble I'm having is not with C,
> but setting up the project and environment. I have code downloading to
> a ET_ARM STAMP LPC-2119 by ETT.
> 
> I have this code compiling:
> 
> /***************************************************************/
> 
> #include <IOLPC2119.H>                     // LPC2119 MPU Register
> 
> /* pototype  section */
> void delay_led(unsigned long int);       // Delay Time Function
> 
> int main(void)
> {  
>    PINSEL2 &= 0xFFFFFFFC;                // Makesure GPIO1.16 = GPIO
> Function
>    IO1DIR   = 0x00010000;                // Set GPIO1.16 = Output
>    IO1SET   = 0x00010000;                // Set GPIO1.16 Output Pin
> (OFF LED)
> 
>    // Loop Blink LED on GPIO1.16 //
>    while(1)                              // Loop Continue
>    {
>       IO1CLR = 0x00010000;               // Clear Output Pin P1.16 (ON
> LED)
>       delay_led(1500000);                // Display LED Delay
>       IO1SET = 0x00010000;               // Set Output Pin P1.16
> (OFF LED)	    
>       delay_led(1500000);                // Display LED Delay
>    }   
> }	  
> 
> /******************************************************/
> /* Delay Time Function                                             
   */
> /* 1-4294967296                                                    
   */
Show quoted textHide quoted text
> /******************************************************/
> 
> void delay_led(unsigned long int count1)
> {
>    while(count1 > 0)                     // Loop Decrease Counter	
>    {
>       count1--;
>    }
> }
> 
> 
> Any help would be appreciated.
>

Re: I could use some IAR blinking code.

2006-05-22 by pfavr2

Hmm it might be my advice is no good, as I was looking in the LPC2148
manual. Sorry.

Peter

--- In lpc2000@yahoogroups.com, "pfavr2" <pfavr2@...> wrote:
Show quoted textHide quoted text
>
> Hi,
> 
> I'm currently trying to the same thing (i.e. making a LED blink on
> port 1.24 of an LPC2148). I'm using GNU tools and openocd. So far I
> haven't succeeded.
> 
> Looking at your source code, I believe that you need to assign all
> zeros to PINSEL2 register. Writing ones means turning on Debug or
> Trace according to the User Manual page 80.
> 
> Good luck!
> 
> Best regards,
> 
> Peter
> 
> --- In lpc2000@yahoogroups.com, "cacheman22" <cacheman22@> wrote:
> >
> > I am looking for some code to toggle a pin on the LPC-2119 using the
> > IAR  KickStart compiler. P1.16 in particular. I have an LED hooked up
> > and am looking to make it blink. The trouble I'm having is not with C,
> > but setting up the project and environment. I have code downloading to
> > a ET_ARM STAMP LPC-2119 by ETT.
> > 
> > I have this code compiling:
> > 
> > /***************************************************************/
> > 
> > #include <IOLPC2119.H>                     // LPC2119 MPU Register
> > 
> > /* pototype  section */
> > void delay_led(unsigned long int);       // Delay Time Function
> > 
> > int main(void)
> > {  
> >    PINSEL2 &= 0xFFFFFFFC;                // Makesure GPIO1.16 = GPIO
> > Function
> >    IO1DIR   = 0x00010000;                // Set GPIO1.16 = Output
> >    IO1SET   = 0x00010000;                // Set GPIO1.16 Output Pin
> > (OFF LED)
> > 
> >    // Loop Blink LED on GPIO1.16 //
> >    while(1)                              // Loop Continue
> >    {
> >       IO1CLR = 0x00010000;               // Clear Output Pin P1.16 (ON
> > LED)
> >       delay_led(1500000);                // Display LED Delay
> >       IO1SET = 0x00010000;               // Set Output Pin P1.16
> > (OFF LED)	    
> >       delay_led(1500000);                // Display LED Delay
> >    }   
> > }	  
> > 
> > /******************************************************/
> > /* Delay Time Function                                             
>    */
> > /* 1-4294967296                                                    
>    */
> > /******************************************************/
> > 
> > void delay_led(unsigned long int count1)
> > {
> >    while(count1 > 0)                     // Loop Decrease Counter	
> >    {
> >       count1--;
> >    }
> > }
> > 
> > 
> > Any help would be appreciated.
> >
>

RE: [lpc2000] Re: I could use some IAR blinking code.

2006-05-22 by Andrew Berney

Hi,

Kind of right... but Pinsel2 should be: &= 0xFFFFFFF3;

bits 0..1 are reserved with reset value 0x0 (obviously And them with 1 to
preserve)
bit 2 is 0 for GPIO for P1.16-31 and 1 to turn on Debug Port
bit 3 is 0 for GPIO for P1.16-31 and 1 to turn on Trace

table 63 in the manual for pinsel2.

Andy
Show quoted textHide quoted text
-----Original Message-----
From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com]On Behalf
Of pfavr2
Sent: 22 May 2006 14:31
To: lpc2000@yahoogroups.com
Subject: [lpc2000] Re: I could use some IAR blinking code.


Hmm it might be my advice is no good, as I was looking in the LPC2148
manual. Sorry.

Peter

--- In lpc2000@yahoogroups.com, "pfavr2" <pfavr2@...> wrote:
>
> Hi,
>
> I'm currently trying to the same thing (i.e. making a LED blink on
> port 1.24 of an LPC2148). I'm using GNU tools and openocd. So far I
> haven't succeeded.
>
> Looking at your source code, I believe that you need to assign all
> zeros to PINSEL2 register. Writing ones means turning on Debug or
> Trace according to the User Manual page 80.
>
> Good luck!
>
> Best regards,
>
> Peter
>
> --- In lpc2000@yahoogroups.com, "cacheman22" <cacheman22@> wrote:
> >
> > I am looking for some code to toggle a pin on the LPC-2119 using the
> > IAR  KickStart compiler. P1.16 in particular. I have an LED hooked up
> > and am looking to make it blink. The trouble I'm having is not with C,
> > but setting up the project and environment. I have code downloading to
> > a ET_ARM STAMP LPC-2119 by ETT.
> >
> > I have this code compiling:
> >
> > /***************************************************************/
> >
> > #include <IOLPC2119.H>                     // LPC2119 MPU Register
> >
> > /* pototype  section */
> > void delay_led(unsigned long int);       // Delay Time Function
> >
> > int main(void)
> > {
> >    PINSEL2 &= 0xFFFFFFFC;                // Makesure GPIO1.16 = GPIO
> > Function
> >    IO1DIR   = 0x00010000;                // Set GPIO1.16 = Output
> >    IO1SET   = 0x00010000;                // Set GPIO1.16 Output Pin
> > (OFF LED)
> >
> >    // Loop Blink LED on GPIO1.16 //
> >    while(1)                              // Loop Continue
> >    {
> >       IO1CLR = 0x00010000;               // Clear Output Pin P1.16 (ON
> > LED)
> >       delay_led(1500000);                // Display LED Delay
> >       IO1SET = 0x00010000;               // Set Output Pin P1.16
> > (OFF LED)
> >       delay_led(1500000);                // Display LED Delay
> >    }
> > }
> >
> > /******************************************************/
> > /* Delay Time Function
>    */
> > /* 1-4294967296
>    */
> > /******************************************************/
> >
> > void delay_led(unsigned long int count1)
> > {
> >    while(count1 > 0)                     // Loop Decrease Counter
> >    {
> >       count1--;
> >    }
> > }
> >
> >
> > Any help would be appreciated.
> >
>








Yahoo! Groups Links

Re: I could use some IAR blinking code.

2006-05-22 by pfavr2

Hi,

Thanks Andy it works now on my Olicom LPC2148. Here is my code for
reference:

#include "LPC214x.h"

volatile unsigned int j=1000000;

int main(void)
{
  unsigned int i;

  PINSEL2&= 0xfffffff3;   // Make sure GPIO1.24 = GPIO Function
  IODIR1= 1<<24;          // Set GPIO1.24 = Output
  j=5000000;
  while(1) {
    IOCLR1 = 1<<24;
    for(i=0;i<j;i++);
    IOSET1 = 1<<24;
    for(i=0;i<j;i++);
  }
}


--- In lpc2000@yahoogroups.com, "Andrew Berney" <amb@...> wrote:
> Kind of right... but Pinsel2 should be: &= 0xFFFFFFF3;
> 
> bits 0..1 are reserved with reset value 0x0 (obviously And them with
1 to
Show quoted textHide quoted text
> preserve)
> bit 2 is 0 for GPIO for P1.16-31 and 1 to turn on Debug Port
> bit 3 is 0 for GPIO for P1.16-31 and 1 to turn on Trace
> 
> table 63 in the manual for pinsel2.
> 
> Andy

Re: I could use some IAR blinking code.

2006-05-23 by pfavr2

Hi,

I just learned that the example code below shouldn't be put into flash
- if you still want to use the JTAG that is ;-)

The JTAG shares the GPIO1 port, so setting everything in IODIR1 will
disable JTAG. This means that after flashing I cannot use the JTAG
anymore :-(

The line:

   IODIR1= 1<<24;          // Set GPIO1.24 = Output

Should (probably) have been:

   IODIR1|= 1<<24;         // Set GPIO1.24 = Output

If anyone has a good idea on how I recover my board (i.e. JTAG) I
would be very grateful. Mabye it can be done without any hardware
changes or the Philips ISP (as I don't have one)?

Best regards,

Peter

--- In lpc2000@yahoogroups.com, "pfavr2" <pfavr2@...> wrote:
Show quoted textHide quoted text
>
> Hi,
> 
> Thanks Andy it works now on my Olicom LPC2148. Here is my code for
> reference:
> 
> #include "LPC214x.h"
> 
> volatile unsigned int j=1000000;
> 
> int main(void)
> {
>   unsigned int i;
> 
>   PINSEL2&= 0xfffffff3;   // Make sure GPIO1.24 = GPIO Function
>   IODIR1= 1<<24;          // Set GPIO1.24 = Output
>   j=5000000;
>   while(1) {
>     IOCLR1 = 1<<24;
>     for(i=0;i<j;i++);
>     IOSET1 = 1<<24;
>     for(i=0;i<j;i++);
>   }
> }
> 
> 
> --- In lpc2000@yahoogroups.com, "Andrew Berney" <amb@> wrote:
> > Kind of right... but Pinsel2 should be: &= 0xFFFFFFF3;
> > 
> > bits 0..1 are reserved with reset value 0x0 (obviously And them with
> 1 to
> > preserve)
> > bit 2 is 0 for GPIO for P1.16-31 and 1 to turn on Debug Port
> > bit 3 is 0 for GPIO for P1.16-31 and 1 to turn on Trace
> > 
> > table 63 in the manual for pinsel2.
> > 
> > Andy
>

RE: [lpc2000] Re: I could use some IAR blinking code.

2006-05-23 by Andrew Berney

Should be relatively simple... use the philips LPC2000 flash utility to talk
to the board via serial and erase the flash.
Pin P0.14 can be used for ISP Select for this purpose... it's how I'm
talking and programming the board on my desk at the moment actually.

Andy
Show quoted textHide quoted text
-----Original Message-----
From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com]On Behalf
Of pfavr2
Sent: 23 May 2006 13:24
To: lpc2000@yahoogroups.com
Subject: [lpc2000] Re: I could use some IAR blinking code.


Hi,

I just learned that the example code below shouldn't be put into flash
- if you still want to use the JTAG that is ;-)

The JTAG shares the GPIO1 port, so setting everything in IODIR1 will
disable JTAG. This means that after flashing I cannot use the JTAG
anymore :-(

The line:

   IODIR1= 1<<24;          // Set GPIO1.24 = Output

Should (probably) have been:

   IODIR1|= 1<<24;         // Set GPIO1.24 = Output

If anyone has a good idea on how I recover my board (i.e. JTAG) I
would be very grateful. Mabye it can be done without any hardware
changes or the Philips ISP (as I don't have one)?

Best regards,

Peter

--- In lpc2000@yahoogroups.com, "pfavr2" <pfavr2@...> wrote:
>
> Hi,
>
> Thanks Andy it works now on my Olicom LPC2148. Here is my code for
> reference:
>
> #include "LPC214x.h"
>
> volatile unsigned int j=1000000;
>
> int main(void)
> {
>   unsigned int i;
>
>   PINSEL2&= 0xfffffff3;   // Make sure GPIO1.24 = GPIO Function
>   IODIR1= 1<<24;          // Set GPIO1.24 = Output
>   j=5000000;
>   while(1) {
>     IOCLR1 = 1<<24;
>     for(i=0;i<j;i++);
>     IOSET1 = 1<<24;
>     for(i=0;i<j;i++);
>   }
> }
>
>
> --- In lpc2000@yahoogroups.com, "Andrew Berney" <amb@> wrote:
> > Kind of right... but Pinsel2 should be: &= 0xFFFFFFF3;
> >
> > bits 0..1 are reserved with reset value 0x0 (obviously And them with
> 1 to
> > preserve)
> > bit 2 is 0 for GPIO for P1.16-31 and 1 to turn on Debug Port
> > bit 3 is 0 for GPIO for P1.16-31 and 1 to turn on Trace
> >
> > table 63 in the manual for pinsel2.
> >
> > Andy
>









Yahoo! Groups Links

Re: [lpc2000] Re: I could use some IAR blinking code.

2006-05-23 by Tom Walsh

pfavr2 wrote:

>Hi,
>
>I just learned that the example code below shouldn't be put into flash
>- if you still want to use the JTAG that is ;-)
>
>If anyone has a good idea on how I recover my board (i.e. JTAG) I
>would be very grateful. Mabye it can be done without any hardware
>changes or the Philips ISP (as I don't have one)?
>
>  
>
Hold down the P0.14 pin and reset the board.  Continue to hold that pin 
to Ground for about two or three seconds and remove the Ground.  You 
should be able to now use your JTAG.

Holding P0.14 would put you into the ISP (In System Programming) mode 
and will bypass your code entirely.

TomW

-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

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.