This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM GPIO addressing (!understanding) fail - please help

Hi All,
I´am ARM noob and I need help...
(noob! previously some experience's with AVR-8b (only), self-multi-graphical/BW aps´ w 1-W/I2C/485/RTC/COM/.../other..., only as hobbyst-enthusiastics :D - not for commerce use)

So,
1 year ago I bought some PCB´s with ARM uC for my "selfeducation" - uC LPC2366.
Yesterday I received ULINK-2 programmer. IDE Keil 5.xx 'free' was successfuly tested. My first program (debug) "LED_blink" - all OK - as in AVR...
I discovered on web example project called 'HID-USB' with LCD "driver" (like hd44780).

HELP:
Anybody know what menas:

Commented:
/*
PINS: Yea... all is in datasheet :D - DB4 = P1.24 - DB5 = P1.25 - DB6 = P1.26 - DB7 = P1.27 - E = P1.31 (for V1 P1.30) - RW = P1.29 - RS = P1.28 */
*/ Wtf ???
Definitions:
//#define MCB2300_V1 /* First version of MCB2300 */
#define PIN_E 0x30000000
#define PIN_RW 0x20000000
#define PIN_RS 0x10000000
#define PINS_CTRL 0xB0000000
#define PINS_DATA 0x0F000000

Anybody know 'THE math' formula for recalculation "RW = P1.29" -> to "0x20000000" ???
I tryed do some calculation on paper, hex / bcd / real conversion :) but no success...

Thansk for all replies...
I think, that many people trying find same answers...

Parents
  • You have a 32-bit processor, and the ports are 32-bit wide.

    So each pin of the port is controlled by one bit.

    RW = P1.29 -> (1u << 29) -> 0x20000000

    And in some of the configuration registers, it takes two bits to configure the pin, so you have two 32-bit registers for configuring the mode of the 32 pins of a port.

    If E is P1.31 (or for older board P1.30) then the constant
    #define PIN_E 0x30000000
    is wrong.

    Should be 0x80000000 if P1.31
    Should be 0x40000000 if P1.30

Reply
  • You have a 32-bit processor, and the ports are 32-bit wide.

    So each pin of the port is controlled by one bit.

    RW = P1.29 -> (1u << 29) -> 0x20000000

    And in some of the configuration registers, it takes two bits to configure the pin, so you have two 32-bit registers for configuring the mode of the 32 pins of a port.

    If E is P1.31 (or for older board P1.30) then the constant
    #define PIN_E 0x30000000
    is wrong.

    Should be 0x80000000 if P1.31
    Should be 0x40000000 if P1.30

Children