PropBasic- \CLKSET and BAUD
camelot2
Posts: 54
What I want to do is run a program at a system freq of 100MHz, send some
data to the serial terminal then change the system freq to 50MHZ and send
some more data to the serial terminal then end. When I run the following
program the serial terminal displays
Dave1_
`0?<x?f<??
and not
Dave1
Dave2
It seems that when the system freq is changed the BAUD is not adjusted
correctly. How do you change the system freq and have a correct BAUD???
Here is the program - thanks for your help - Dave
' Device Settings
'
DEVICE P8X32A, XTAL1, PLL16X
XIN 6_250_000
'
Baud CON "T9600"
CR CON 13
'
' I/O Pins
'
RX PIN 31 INPUT
TX PIN 30 HIGH ' set to idle (true)
'
' Cog Variables (Long only)
'
NewFreq VAR LONG
'
' SUB/FUNC Definitions
'
' ======================================================================
PROGRAM Start
' ======================================================================
Start:
SEROUT 30, Baud, "Dave1"
SEROUT 30, Baud, CR
NewFreq = %01101110 'set the clk to PLL8X
\CLKSET NewFreq 'system clk should now be 50MHz ???
PAUSE 1000 'pause 1000ms
SEROUT 30, BAUD , "Dave2"
END
data to the serial terminal then change the system freq to 50MHZ and send
some more data to the serial terminal then end. When I run the following
program the serial terminal displays
Dave1_
`0?<x?f<??
and not
Dave1
Dave2
It seems that when the system freq is changed the BAUD is not adjusted
correctly. How do you change the system freq and have a correct BAUD???
Here is the program - thanks for your help - Dave
' Device Settings
'
DEVICE P8X32A, XTAL1, PLL16X
XIN 6_250_000
'
Baud CON "T9600"
CR CON 13
'
' I/O Pins
'
RX PIN 31 INPUT
TX PIN 30 HIGH ' set to idle (true)
'
' Cog Variables (Long only)
'
NewFreq VAR LONG
'
' SUB/FUNC Definitions
'
' ======================================================================
PROGRAM Start
' ======================================================================
Start:
SEROUT 30, Baud, "Dave1"
SEROUT 30, Baud, CR
NewFreq = %01101110 'set the clk to PLL8X
\CLKSET NewFreq 'system clk should now be 50MHz ???
PAUSE 1000 'pause 1000ms
SEROUT 30, BAUD , "Dave2"
END
Comments
thanks for your help - Dave
Just use twice the baud rate when you change to 50MHz.
Bean