SX Frequency selection
I did purchase the SX Tech kit and have been playing with it a bit.
I am confused a bit on how to set the frequency of the chip itself. I understand about setting it at the beginning of the program such as
FREQ···· 4_000_000
I understand this sets the operation of the SX at 4 Mhz.
Can I set it at 3_000_000 if I wanted to?
I'm running SX/B and would like to stay with that for now.
I do know I need the external oscillators to get higher frequencies. My understanding is that the external oscillators are more accurate than the oscillator on the SX chip itself. Can I install an external one and still run the chip at 4Mhz as an example?
I need to run the SX as I need to output a stable frequency and the Stamp is not too well suited for this. I would like it to be as accurate as possible, but don't need to go overboard. At this point I believe 4Mhz would be accurate enough, faster would work too, but be more involved as the Pause commands would need to be much longer - above the range of the word variables. I know this is all doable, just like to keep it as simple as possible.
I've·looked in·the books on the SX, but to me it is not too clear about all this as the books focus on Assembly language with the exception being the SX/B help file. I hear a new book on SX/B is coming out soon.
I have the Basic Stamp Homework board also and have gone through that book and most of the experiments.
Thanks for any help,
Alex
I am confused a bit on how to set the frequency of the chip itself. I understand about setting it at the beginning of the program such as
FREQ···· 4_000_000
I understand this sets the operation of the SX at 4 Mhz.
Can I set it at 3_000_000 if I wanted to?
I'm running SX/B and would like to stay with that for now.
I do know I need the external oscillators to get higher frequencies. My understanding is that the external oscillators are more accurate than the oscillator on the SX chip itself. Can I install an external one and still run the chip at 4Mhz as an example?
I need to run the SX as I need to output a stable frequency and the Stamp is not too well suited for this. I would like it to be as accurate as possible, but don't need to go overboard. At this point I believe 4Mhz would be accurate enough, faster would work too, but be more involved as the Pause commands would need to be much longer - above the range of the word variables. I know this is all doable, just like to keep it as simple as possible.
I've·looked in·the books on the SX, but to me it is not too clear about all this as the books focus on Assembly language with the exception being the SX/B help file. I hear a new book on SX/B is coming out soon.
I have the Basic Stamp Homework board also and have gone through that book and most of the experiments.
Thanks for any help,
Alex
Comments
In general you will want FREQ to match you clock rate or, as in the interrupt case above, your effective clock rate. However, it does not set it.
Correct.
Yes. You can run it at other frequencies, even odd ones, as determined by the clock source you connect to it.
The SX48 has two internal timers that are great for generating stable frequencies. At only $10 for an SX48 protoboard you should definitely consider one!
- Sparks
Thanks for the info.
Right now 4Mhz seems to be fast enough for what I am doing. I'm making a pretty slow frequency - around 200 Hz. The internal clock of the SX has an error of +/- 8%. I'd like to reduce that if I can. It works out to be about·+/- 16 hz at 200Hz. Closer than that would be better.
The two oscillators that come with the SX are set at their own speeds? If I plug one in, can I still set the Freq command at 4Mhz? Or must the chip run at their speeds? Or am I confusing chip and clock speeds?
I'm asking before I try so I don't smoke something.
Good idea on the SX48 board. I'll try a couple of options on the SX28 first, if those don't work I'll look into the SX48 board.
Alex
·
Right now I'm running the SX with the SX Key plugged in to use the DEBUG feature to read my variables.
Any problems running the SX with an oscillator and the SX Key connected at the same time?
I assume the 4Mhz external oscillator would be much more accurate than·the SX chips internal clock?
Thanks for the help,
Alex
The "internal osc" is basically, I believe, an R-C arrangement and hence the variation/inaccuracy.
The Key provides the timing in Debug mode.
PJ,
What sort of oscillator came with the SX? is it a crystal or an external oscillator?·I assume its an external oscillator?
You say I can't use one of them with the SX Key in debug mode?
So can I program the SX with the oscillator installed?
Alex
Post Edited (Capt. Quirk) : 7/16/2007 9:06:36 PM GMT
The little blue items with three pins are resonators. You may leave them installed when you program the SX. However, when they are in place they prevent the DEBUG feature from being able to control the program execution since they provide a clock signal. When an external clock source is connected, the SX runs at that clock speed. For you this will be 4MHz or 50MHz depending on the resonator you select.
The SX-Key has internal clock driver circuitry that can drive your SX at whatever (within reason) frequency you desire. I believe it is about as accurate as the resonators themselves.
I sounds like you should do your programming with the SX-Key in place using a 4MHz clock. Use OSCXT2 instead of OSC4MHZ and set your FREQ to 4_000_000.
When you are happy with the functionality of your SX design, you can program (CTRL-P) the SX and then replace the SX-Key with the 4MHz resonator. If all goes well your circuit should then run on its own without a computer connection!
- Sparks
Thanks for the help. This will get me pointed in the right direction. I wanted to get some advice before I accidently blow something up.
Alex