Frequency for square wave
Hello,
Bean gave me some code:
DEVICE SX28,OSCHS2,TURBO,OPTIONX,STACKX
FREQ 50_000_000, 34_000_000
OutPin PIN RA.0 OUTPUT
INTERRUPT NOCODE 2_000_000
OutPin = ~OutPin
RETURNINT
PROGRAM Start
Start:
END
It worked well, I want to know if I can go as low as 53 khz?
Will it work for a 4MHz resonator as well?
I apologize for the simple questions.
Thank you,
Curtis
Bean gave me some code:
DEVICE SX28,OSCHS2,TURBO,OPTIONX,STACKX
FREQ 50_000_000, 34_000_000
OutPin PIN RA.0 OUTPUT
INTERRUPT NOCODE 2_000_000
OutPin = ~OutPin
RETURNINT
PROGRAM Start
Start:
END
It worked well, I want to know if I can go as low as 53 khz?
Will it work for a 4MHz resonator as well?
I apologize for the simple questions.
Thank you,
Curtis
Comments
It probably won't be perfect, but should get you close.
INTERRUPT NOCODE 106_000
OutPin = ~OutPin
RETURNINT
My questions are:
1. I will be sending the square wave to a tank circuit (coil and capacitor). LC tank circuits can produces high voltages and current. Should I put a resistor or diode to protect my sx28 pin?
2. Is there is any code I can use to keep the frequency stable? I am a beginner in the sxb.
3. I will be reading the voltage on the coil using a voltage divider and ADC0831 later. Any thoughts are appreciated.
Thanks,
Curtis
For example assume you are using a 4MHz resonator. The resonator could be off by +/- 100ppM or so.
Then you have the ratio. 4_000_000 / 106_000 = 37.7, so this should get rounded to 38. So 4_000_000 / 38 = 105_263 / 2 = 52631 Hz.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
·The next time you need a hero don't look up in the sky...Look in the mirror.
·
I understand the concept now. I can now experiment with my tank circuit and my experiments.
Curtis