Page 1 of 1
115.2 Kbaud on SuperPRO
Posted: Sat Jul 28, 2018 1:37 pm
by basicchip
The SuperPRO (LPC1756), DataLogger (LPC4330), BASICchip (LPC1114) use an internal PCLK of 24 MHz. For generating the baud rate clock at 115.2 Kb this is too coarse and the standard BAUD(x) call needs to be modified.
use --
Code: Select all
#include "LPC17xx.bas" ' or the appropriate include file
...
BAUD(1)=125000 ' enable UART1, standard call for 115.2 is too coarse -- needs fractional rate
UART1_FDR = &HC1 ' fractional divider of 1.083333
...
TXD(1) = &H33 ' print an ASCII 3
Re: 115.2 Kbaud on SuperPRO
Posted: Sat Jul 28, 2018 9:16 pm
by olzeke51
Thanks for the update
Gary
Re: 115.2 Kbaud on SuperPRO
Posted: Mon Jul 30, 2018 8:44 pm
by basicchip
I did have to add a delay at the end of the BASIC program, because when a BASIC program ends, all interrupts are turned off (except systick and UART0)
To compensate for that, I added a WAIT(1000) at the end of the program.
Code: Select all
#include "LPC17xx.bas"
SUB PrintUART1 (Astr(100) as STRING)
DIM I as INTEGER
I=0
WHILE Astr(I)
TXD(1) = Astr(I)
I=I+1
LOOP
END SUB
'...
main:
BAUD(1)=125000 ' enable UART1, standard call for 115.2 is too coarse -- needs fractional rate
UART1_FDR = &HC1
for i= 1 to 10
PrintUART1 ("Hello World") ' Send a string of characters serially out UART1
TXD(1)=13
next
wait(1000)
Re: 115.2 Kbaud on SuperPRO
Posted: Wed Aug 01, 2018 12:28 am
by basicchip
and now the receive side. I used a USB dongle connected to P2.1 and P2.0
Code: Select all
#include "LPC17xx.bas"
SUB PrintUART1 (Astr(100) as STRING)
DIM I as INTEGER
I=0
WHILE Astr(I)
TXD(1) = Astr(I)
I=I+1
LOOP
END SUB
'...
main:
BAUD(1)=125000 ' enable UART1, standard call for 115.2 is too coarse -- needs fractional rate
UART1_FDR = &HC1
for i= 1 to 10
PrintUART1 ("Hello World") ' Send a string of characters serially out UART1
TXD(1)=13
next
' now echo the first 10 charaters sent to UART1
x = 10
while x>0
y = RXD(1)
while y = -1
y = RXD(1) ' when -1 there is no character available
loop
TXD(0)=y ' echo the character to BASICtools
x=x-1
loop