Hi, Dear all I'm using a LPC2214 in my project. and have released P2.31:8 as a GPIO but P2.7:0 as an external memory data bus. Strangely, I can't control the behavior of P2.31:8 because I can't find PORT2's GPIO register(IOPIN2,IODIR2..). How can I do this? Thanks for your help! |
|
How can I control GPIO port2/3?
Started by ●May 7, 2004
Reply by ●May 7, 20042004-05-07
This works for me. Regards -Bill Knight theARMPatch /////////////////////////////////////////////////////////////////////////////// // General Purpose Input/Output Registers (GPIO) typedef struct REG32 in; // GPIO Value Register REG32 set; // GPIO Output Set Register REG32 dir; // GPIO Direction Register REG32 clr; // GPIO Output Clear Register } gpioRegs_t; #define GPIO0 ((gpioRegs_t *)0xE0028000) #define GPIO1 ((gpioRegs_t *)0xE0028010) #define GPIO2 ((gpioRegs_t *)0xE0028020) #define GPIO3 ((gpioRegs_t *)0xE0028030) // GPIO Registers #define IO0PIN GPIO0->in /* P0 Pin Value Register */ #define IO0SET GPIO0->set /* P0 Pin Output Set Register */ #define IO0DIR GPIO0->dir /* P0 Pin Direction Register */ #define IO0CLR GPIO0->clr /* P0 Pin Output Clear Register */ #define IO1PIN GPIO1->in /* P1 Pin Value Register */ #define IO1SET GPIO1->set /* P1 Pin Output Set Register */ #define IO1DIR GPIO1->dir /* P1 Pin Direction Register */ #define IO1CLR GPIO1->clr /* P1 Pin Output Clear Register */ #define IO2PIN GPIO2->in /* P2 Pin Value Register */ #define IO2SET GPIO2->set /* P2 Pin Output Set Register */ #define IO2DIR GPIO2->dir /* P2 Pin Direction Register */ #define IO2CLR GPIO2->clr /* P2 Pin Output Clear Register */ #define IO3PIN GPIO3->in /* P3 Pin Value Register */ #define IO3SET GPIO3->set /* P3 Pin Output Set Register */ #define IO3DIR GPIO3->dir /* P3 Pin Direction Register */ #define IO3CLR GPIO3->clr /* P3 Pin Output Clear Register */ On Fri, 07 May 2004 15:16:11 -0000, janesleecn wrote: Hi, Dear all I'm using a LPC2214 in my project. and have released P2.31:8 as a GPIO but P2.7:0 as an external memory data bus. Strangely, I can't control the behavior of P2.31:8 because I can't find PORT2's GPIO register(IOPIN2,IODIR2..). How can I do this? Thanks for your help! |
|
Reply by ●May 7, 20042004-05-07
Thanks! I already found a header file from KEIL: http://www.keil.com/dd/docs/arm/philips/lpc22xx.h #define IOPIN2 (*((volatile unsigned long *) 0xE0028020)) #define IOSET2 (*((volatile unsigned long *) 0xE0028024)) #define IODIR2 (*((volatile unsigned long *) 0xE0028028)) #define IOCLR2 (*((volatile unsigned long *) 0xE002802C)) #define IOPIN3 (*((volatile unsigned long *) 0xE0028030)) #define IOSET3 (*((volatile unsigned long *) 0xE0028034)) #define IODIR3 (*((volatile unsigned long *) 0xE0028038)) #define IOCLR3 (*((volatile unsigned long *) 0xE002803C)) It's same as you. But I can't find any information about them on philips's datasheet and user manual. It really be there and can be access? Regards --Janeslee-- --- In , "Bill Knight" <BillK@t...> wrote: > This works for me. > > Regards > -Bill Knight > theARMPatch > > /////////////////////////////////////////////////////////////////// //////////// > // General Purpose Input/Output Registers (GPIO) > typedef struct > > REG32 in; // GPIO Value Register > REG32 set; // GPIO Output Set Register > REG32 dir; // GPIO Direction Register > REG32 clr; // GPIO Output Clear Register > } gpioRegs_t; > > #define GPIO0 ((gpioRegs_t *)0xE0028000) > #define GPIO1 ((gpioRegs_t *)0xE0028010) > #define GPIO2 ((gpioRegs_t *)0xE0028020) > #define GPIO3 ((gpioRegs_t *)0xE0028030) > > // GPIO Registers > #define IO0PIN GPIO0->in /* P0 Pin Value Register */ > #define IO0SET GPIO0->set /* P0 Pin Output Set Register */ > #define IO0DIR GPIO0->dir /* P0 Pin Direction Register */ > #define IO0CLR GPIO0->clr /* P0 Pin Output Clear Register */ > #define IO1PIN GPIO1->in /* P1 Pin Value Register */ > #define IO1SET GPIO1->set /* P1 Pin Output Set Register */ > #define IO1DIR GPIO1->dir /* P1 Pin Direction Register */ > #define IO1CLR GPIO1->clr /* P1 Pin Output Clear Register */ > #define IO2PIN GPIO2->in /* P2 Pin Value Register */ > #define IO2SET GPIO2->set /* P2 Pin Output Set Register */ > #define IO2DIR GPIO2->dir /* P2 Pin Direction Register */ > #define IO2CLR GPIO2->clr /* P2 Pin Output Clear Register */ > #define IO3PIN GPIO3->in /* P3 Pin Value Register */ > #define IO3SET GPIO3->set /* P3 Pin Output Set Register */ > #define IO3DIR GPIO3->dir /* P3 Pin Direction Register */ > #define IO3CLR GPIO3->clr /* P3 Pin Output Clear Register */ > > On Fri, 07 May 2004 15:16:11 -0000, janesleecn wrote: > > Hi, Dear all > > I'm using a LPC2214 in my project. and have released P2.31:8 as a > GPIO but P2.7:0 as an external memory data bus. Strangely, I can't > control the behavior of P2.31:8 because I can't find PORT2's GPIO > register(IOPIN2,IODIR2..). How can I do this? > > Thanks for your help! |
|
Reply by ●May 7, 20042004-05-07
Yep. They are really there. I learned from Philips support they forgot to put them in the manual. -Bill On Fri, 07 May 2004 17:00:13 -0000, janesleecn wrote: Thanks! I already found a header file from KEIL: http://www.keil.com/dd/docs/arm/philips/lpc22xx.h #define IOPIN2 (*((volatile unsigned long *) 0xE0028020)) #define IOSET2 (*((volatile unsigned long *) 0xE0028024)) #define IODIR2 (*((volatile unsigned long *) 0xE0028028)) #define IOCLR2 (*((volatile unsigned long *) 0xE002802C)) #define IOPIN3 (*((volatile unsigned long *) 0xE0028030)) #define IOSET3 (*((volatile unsigned long *) 0xE0028034)) #define IODIR3 (*((volatile unsigned long *) 0xE0028038)) #define IOCLR3 (*((volatile unsigned long *) 0xE002803C)) It's same as you. But I can't find any information about them on philips's datasheet and user manual. It really be there and can be access? Regards --Janeslee-- --- In , "Bill Knight" <BillK@t...> wrote: > This works for me. > > Regards > -Bill Knight > theARMPatch > > /////////////////////////////////////////////////////////////////// //////////// > // General Purpose Input/Output Registers (GPIO) > typedef struct > > REG32 in; // GPIO Value Register > REG32 set; // GPIO Output Set Register > REG32 dir; // GPIO Direction Register > REG32 clr; // GPIO Output Clear Register > } gpioRegs_t; > > #define GPIO0 ((gpioRegs_t *)0xE0028000) > #define GPIO1 ((gpioRegs_t *)0xE0028010) > #define GPIO2 ((gpioRegs_t *)0xE0028020) > #define GPIO3 ((gpioRegs_t *)0xE0028030) > > // GPIO Registers > #define IO0PIN GPIO0->in /* P0 Pin Value Register */ > #define IO0SET GPIO0->set /* P0 Pin Output Set Register */ > #define IO0DIR GPIO0->dir /* P0 Pin Direction Register */ > #define IO0CLR GPIO0->clr /* P0 Pin Output Clear Register */ > #define IO1PIN GPIO1->in /* P1 Pin Value Register */ > #define IO1SET GPIO1->set /* P1 Pin Output Set Register */ > #define IO1DIR GPIO1->dir /* P1 Pin Direction Register */ > #define IO1CLR GPIO1->clr /* P1 Pin Output Clear Register */ > #define IO2PIN GPIO2->in /* P2 Pin Value Register */ > #define IO2SET GPIO2->set /* P2 Pin Output Set Register */ > #define IO2DIR GPIO2->dir /* P2 Pin Direction Register */ > #define IO2CLR GPIO2->clr /* P2 Pin Output Clear Register */ > #define IO3PIN GPIO3->in /* P3 Pin Value Register */ > #define IO3SET GPIO3->set /* P3 Pin Output Set Register */ > #define IO3DIR GPIO3->dir /* P3 Pin Direction Register */ > #define IO3CLR GPIO3->clr /* P3 Pin Output Clear Register */ > > On Fri, 07 May 2004 15:16:11 -0000, janesleecn wrote: > > Hi, Dear all > > I'm using a LPC2214 in my project. and have released P2.31:8 as a > GPIO but P2.7:0 as an external memory data bus. Strangely, I can't > control the behavior of P2.31:8 because I can't find PORT2's GPIO > register(IOPIN2,IODIR2..). How can I do this? > > Thanks for your help! Yahoo! Groups Links |