Timers and clocks - help for the hard of thinking.
Hugh
Posts: 362
I'm afraid this is one of these posts where I think I am thick!
Using the code:
an LED on pin 16 blinks on and off like a lighthouse - one second on, one second off, etc, If I uncomment the statements in the CON block it doesn't work at all. Does this mean my crystal is suspect?
seems to give a frequency of about 5 kHz ('scoped at 4 divisions at 50 µs per division) which seems very slow.
Do I carry on with this board or consider it suspect and get hold of a new one?
Thanks
Hugh
Using the code:
[B]CON[/B] ' [B]_clkmode = xtal1 + pll16x[/B] ' use crystal x 16 ' [B]_xinfreq [/B]= 5_000_000 ' 5 MHz crystal (sys clock = 80 MHz) [B]PUB [/B]Blink [B]dira[/B][16]~~ [B]outa[/B][16]~ [B]repeat[/B] ![B]outa[/B][16] [B]waitcnt[/B]([B]cnt[/B]+80_000_000)
an LED on pin 16 blinks on and off like a lighthouse - one second on, one second off, etc, If I uncomment the statements in the CON block it doesn't work at all. Does this mean my crystal is suspect?
[B]PUB [/B]Blink [B]dira[/B][16]~~ [B]outa[/B][16]~ [B]repeat[/B] ![B]outa[/B][16] [B]waitcnt[/B]([B]cnt[/B]+1000)
seems to give a frequency of about 5 kHz ('scoped at 4 divisions at 50 µs per division) which seems very slow.
Do I carry on with this board or consider it suspect and get hold of a new one?
Thanks
Hugh
Comments
The code should work.
Sounds like the PLL is not working?
Works fine on a QuickStart.
The Xtal is swap-able. Do you have another Xtal you can try?
A new xtal hasn't changed things... :-(
with
_clkmode = xtal1 + pll16x ' use crystal x 16
_xinfreq = 5_000_000
80 Mio ticks are counted up in one second
without
_clkmode = xtal1 + pll16x ' use crystal x 16
_xinfreq = 5_000_000
the propellerchip runs on a lower frequency.
I haven't tested this yet but coding NO clkmode and no xinfreq may leave the prop undefined
did you try any other clkmodes like rcslow rcfast?
best regards
Stefan
Using rcfast (which should be the default(?)) with a waitcnt of 12_000_000 gives the expected one second delay.
All a bit odd. I needed an excuse to get a new board...
Hugh