Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #22711
| From | stephenXXX@mpeforth.com (Stephen Pelc) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: LPC1114 Serial Init translated from c to forth issue |
| Organization | MPE |
| Message-ID | <5195ff98.124884556@news.demon.co.uk> (permalink) |
| References | <ca6c0939-9608-48aa-92cc-c48639fb5dcf@googlegroups.com> |
| Date | 2013-05-17 10:05 +0000 |
On Thu, 16 May 2013 07:37:38 -0700 (PDT), "Clyde W. Phillips Jr."
<cwpjr02@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, stephenXXX@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
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
LPC1114 Serial Init translated from c to forth issue "Clyde W. Phillips Jr." <cwpjr02@gmail.com> - 2013-05-16 07:37 -0700 Re: LPC1114 Serial Init translated from c to forth issue "Elizabeth D. Rather" <erather@forth.com> - 2013-05-16 11:30 -1000 Re: LPC1114 Serial Init translated from c to forth issue David Schultz <abuse@127.0.0.1> - 2013-05-16 18:12 -0500 Re: LPC1114 Serial Init translated from c to forth issue stephenXXX@mpeforth.com (Stephen Pelc) - 2013-05-17 10:05 +0000 Re: LPC1114 Serial Init translated from c to forth issue "Clyde W. Phillips Jr." <cwpjr02@gmail.com> - 2013-05-17 17:57 -0700
csiph-web