Content originally posted in LPCWare by Superfred on Mon Apr 02 08:18:02 MST 2012
Hello,
to simplify my GPIO access I ported some Arduino functions to my LPCXpresso1769:
pinMode
digitalWrite
digitalRead
millis (needs CMSISv2p00_LPC17xx)
delay (needs CMSISv2p00_LPC17xx)
maybe someone finds it useful, see attachment.
Please note that not all ports are tested, please tell me problems.
Please respond if you are interrested in more functions like beep, serial,...
Original Attachment has been moved to: 1100720_src.zip
Unfortunately the attachments referenced above did not pull across as part of the LPCware forum migration to the NXP community site. But you can currently access the LPCware thread at:
https://www.lpcware.com/content/forum/lpc1769-arduino-gpio-functions
Regards,
LPCXpresso Support
I can´t see the attachment, could you send it to me?
Content originally posted in LPCWare by Superfred on Sun May 13 08:30:52 MST 2012
Hello renenguyen,
see description in the manual (user.manual.lpc17xx.pdf):
8.3 Pin function select register values
The PINSEL registers control the functions of device pins as shown below. [B]Pairs[/B] of bits in these registers correspond to specific device pins.
Table 75. Pin function select register bits
PINSEL0 to PINSEL9 Values:
[B]00[/B] Primary (default) function, typically [B]GPIO[/B] port 00
01 First alternate function
10 Second alternate function
11 Third alternate function[/SIZE]
3 is the inverted binary "00", and this means GPIO.
By the way, I found a small problem in my library for Port2, here is the corrected version:
temp = pin; temp = ~(3 << (temp << 1)); LPC_PINCON->PINSEL0 &= temp; |