PDA

View Full Version : _clkmode



samsearcher
11-13-2006, 08:13 AM
I'm using this code to flash a LED every second on pin 17 and it works fine

CON
_clkmode = xtal1
_xinfreq = 5_000_000

PUB Toggle
dira[17]~~
repeat
!outa[17]
waitcnt(clkfreq + cnt)


This doesn't work

CON
_clkmode = xtal1 + pll1x
_xinfreq = 5_000_000

PUB Toggle
dira[17]~~
repeat
!outa[17]
waitcnt(clkfreq + cnt)

Am I missing something here?
I'm using a 5MHz Crystal Digi-key P/N CTX081-ND
is this the wrong code or part?
Thanks

Tracy Allen
11-13-2006, 10:57 AM
If the first code works, then the choice of xtal surely has nothing to do with it.

Okay, I tried it, and both versions worked okay. Are you sure you didn't lose something in the formating of the REPEAT loop in the second case? You can maintain the indents in your post by enclosing the text in code tags.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com (http://www.emesystems.com)

samsearcher
11-13-2006, 11:54 AM
I'm sure the indenting was the same. I couldn't make the second example work so what I did is comment out the pll1x to create the first example that will work.

[
This will work

CON
_clkmode = xtal1' + pll1x
_xinfreq = 5_000_000

PUB Toggle
dira[17]~~
repeat
!outa[17]
waitcnt(clkfreq + cnt)

This will not work

CON
_clkmode = xtal1 + pll1x
_xinfreq = 5_000_000

PUB Toggle
dira[17]~~
repeat
!outa[17]
waitcnt(clkfreq + cnt)
code]

I'm beginning to think maybe I damaged the chip. When I first setup the board I missed the ground to the 3.3v power supply and when I tested the voltage going to the chip it was about 4.5 volts. I fixed the problem and every thing has been fine until I tried the PLL Constant.
I figured that if the chip worked it was fine, now I'm wondering if you can damage part of the chip and not effect the rest.

samsearcher
11-13-2006, 12:01 PM
I tried to use the code tag in the previous post but obviously I didn't get that right ether. Anyway I did palace two spaces before !outa[17] and
waitcnt(clkfreq + cnt) in both examples.

Thanks for trying this for me.

Chris Savage
11-14-2006, 01:25 AM
Sam,

It would appear that the excessive voltage has damaged the PLL circuit on the Propeller. We have seen this happen at least once before, so it is a good bet.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support