Shop OBEX P1 Docs P2 Docs Learn Events
SX TIMER as frequency generator - resolution? — Parallax Forums

SX TIMER as frequency generator - resolution?

Alex41Alex41 Posts: 112
edited 2008-01-01 20:51 in General Discussion
Hello,

I have enclosed the following SX/B program. It is just a simple program I made to use the SX-48 protoboard as a frequency generator. I'm·need to make a "slow" frequency, below 200Hz.

My question is - why can't I get better than 2Hz resolution? I have a 10K pot using RCTIME. I'm using a 1.0 uF capacitor which should return enough resolution to do this.
I've tried smaller caps, 0.1 uF and 0.01 uF, but same problem with the 2Hz steps. Also same problem with a 20 turn pot.

Also same results if I use the·chip's clock, an external resonator, or the clock on the key.

Any ideas?

I'm measuring the frequency with my new Parallax USB O'scope - it is working fine.

Thanks,
Alex

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.

Comments

  • BeanBean Posts: 8,129
    edited 2007-12-30 20:43
    Alex,
    Everytime the TIMER PWM command is execute, the timer is reset back to zero.

    This is done because if you change R1 or R2 to a value lower than what the timer currently is, the timer will have to wrap around before the PWM output changes state (could be a long ON or OFF time).

    What I would do, is ONLY execute the TIMER PWM command if the rcvalue has changed significantly.
    Or you should be able to monitor the PWM output pin, wait until it changes state, then modify R1 and R2 using the TIMER1 R1 and TIMER1 R2 commands instead of using the TIMER1 PWM command.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com



    Post Edited (Bean (Hitt Consulting)) : 12/30/2007 8:55:05 PM GMT
  • Alex41Alex41 Posts: 112
    edited 2008-01-01 20:51
    Bean,

    Thanks, that makes sense.

    So what·I need to do is connect a pin to the timer output pin and wait for it to change state, then use the TIMER R1 and TIMER R2 command to change the frequency at the right time.

    I'll give that a shot and see how it comes out. I may also incorporate the feature you mentioned of only changeing the values if the RCTIME value has changed.

    Thanks for the help,

    Alex

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If at first you don't succeed, then skydiving is not for you.
Sign In or Register to comment.