On Thu, 16 May 2013 07:37:38 -0700 (PDT), "Clyde W. Phillips Jr."
<
cwp...@gmail.com> wrote:
>The LPC1114 is from NXP and they have a usb stick eval board
>and a eclipse development ide supporting c/c++.
...
>If anyone has created code you can share to init this serial port
>for polling i/o I'd appreciate using it.
See the MPE Arm/Cortex cross compiler Stamp edition. It includes
polled and two serial drivers for the LPC11xx CPUs.
The problems are nearly always in the pin set up and clock selection
routines.
: initUART \ divisor base --
\ *G Initialise the UART with the given baud rate divisor.
swap >r
0 over UnACR + ! \ turn off autobaud
$10 over UnFDR + ! \ turn off fractional baud rate
1 over UnFCR + ! \ enable FIFOs
$83 over UnLCR + ! \ 8 data, 1 stop, no parity, enable DLAB
r@ 8 rshift $FF and over UnDLM + ! \ set divisor
r> $FF and over UnDLL + !
$03 over UnLCR + ! \ clear DLAB
drop
;
: init-ser0 \ --
\ *G Initialise serial port 0
$1:0040 _SYSCON SYSAHBCLKCTRL + or! \ Enable IOCON and GPIO clocks
_IOCONFIG IOCON_PIO1_6 + dup @ \ RXD input, no pull up/down
$03 invert and
$01 or
swap !
_IOCONFIG IOCON_PIO1_7 + dup @ \ TXD output, no pull up/down
$03 invert and
$01 or
swap !
bit12 _SYSCON SYSAHBCLKCTRL + or! \ Enable UART clock
pcdU0 _SYSCON UARTCLKDIV + ! \ set clock divider
u0-divisor _UART0 initUART
;
Stephen
--
Stephen Pelc,
steph...@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel:
+44 (0)23 8063 1441, fax:
+44 (0)23 8033 9691
web:
http://www.mpeforth.com - free VFX Forth downloads