parallel output

Questions on other types of hardware and getting it talking to the ARM CPU
Post Reply
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

parallel output

Post by YahooArchive »

I need to bit bang some outputs in a parallel fashion (simultaneous changes).
After looking in this forum, I've discovered that the Armmite BASIC doesn't
support this directly but it's possible to do this using direct access to the
hardware. But after looking at the datasheet for the LPC2103, I'm still unsure
how to do this. I'm pretty sure I'll have to use pointers to get direct access
to ARM peripheral registers. I've also found that tracing the hardware reveals
that IO pin 0 is actually pin 30 on the LPC2103 which is P0.9, likewise IO1 is
pin 29 P0.8, and IO2 is pin 15 P0.30. At this point, I ran out of steam - does
anyone have sample code for parallel bit banging and a map of IO pins to P0 port
pins? A mask will be needed as some pins are input and some output.

Thanks
J



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: parallel output

Post by YahooArchive »

BASIC uses the fast GPIOs in the LPC2103 (details in the User manual). BASIC
only uses FIODIR, on read FIOPIN, and FIOSET/FIOCLR for writes.

FIOMASK is left in the default state. You can use it to control outputs in
parallel. The code to do this would be (samples in BASIClib)

#define FIOMASK * $3FFFC010
#define FIOPIN * $3FFFC014

FIOMASK = whatever
FIOPIN = something

As for mapping BASIC IOs to GPIO on the LPC (refer to the schematic)

Another place this information is at, is on the C side there is a map of IOs to
GPIOs. (in coridium.c) For the ARMmite

const int gpioPinMap[24] = {
0x00000200 //P0.9 PWM22
,0x00000100 //P0.8 PWM21
,0x40000000 //P0.30
,0x00200000 //P0.21 PWM30
,0x00100000 //P0.20
,0x20000000 //P0.29
,0x00000010 //P0.4
,0x00000020 //P0.5 PWM01
,0x00000040 //P0.6
,0x00000080 //P0.7 PWM20
,0x00002000 //P0.13 PWM11
,0x00080000 //P0.19 PWM12
,0x00040000 //P0.18
,0x00020000 //P0.17
,0x00010000 //P0.16 PWM02
,0x00008000 //P0.15
// A/Ds
,0x00400000 //P0.22
,0x00800000 //P0.23
,0x01000000 //P0.24
,0x00000400 //P0.10
,0x00000800 //P0.11
,0x00001000 //P0.12
,0x02000000 //P0.25
,0x04000000 //P0.26
};

Post Reply