Shop OBEX P1 Docs P2 Docs Learn Events
BS2px as Frequency Divider — Parallax Forums

BS2px as Frequency Divider

KovaKova Posts: 12
edited 2005-10-24 00:12 in BASIC Stamp
Hi, has anyone tried to build a Frequency Divider with BS2px and following characteristics:

Inputs
Impedance ....100k Ohms
Wave form ....Sine, Square or Pulse.
Freq. Range ..0.5Hz to 1Megahertz
Level ....... 3.0V min. 0.5Hz to 1MHz
············· ·.25V min. 2Hz to 200kHz
············· ·.1V min. 10Hz to 50kHz

Output
Impedance ....<200 ohms
Level ........5V P-P, Square Wave
Freq. Range ..Input frequency divided by integer steps from 1 to 9,999.

I need to have 4 switches to set divider.

Thanks for your help.

Kova

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-20 14:43
    I just don't see any possible way to do what you want with a Basic stamp unless you are using it to control an external divide by n circuit. The maximum number of operations/second for the px is 19,000, this means the maximum possible input signal (using square wave) will be half that or 9.5 kHz or 1/100th the maximum input clock you are looking for. The SX and SX/B could do it quite easily.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • KovaKova Posts: 12
    edited 2005-10-20 23:41
    I don't really have any preferences... BS2 or SX, that's fine. I just need to replace a unit that I use now,
    and I wanted to see if BS2 can do the job. If you have any schematics and/or code for SX it would be a great help. Thanks in advance,
    Kova
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-21 13:48
    I dont have any code to share, but If I were doing this I would attach an 8 bit parallel ADC capable of 1Msps, then write a program which does peak detection (find high and low values of input signal), then find the midpoint (signal ground) as the reference for a zero cross unit, the output then fed to a divide by N counter whose roll over bit is your downsampled signal. Except the ADC, all this can be done in software. If the output of the zero-cross unit is jittery, then implement hysterisis, if its still jittery devise a software PLL.

    I don't know what level of experience you have, and Ive thrown out alot of terms in this post, ask and I will·explain anything you don't understand.

    Another thing, how are you going to specify a range for N to be 1-9,999 when you only have 4 switches (16 states)?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 10/21/2005 1:57:07 PM GMT
  • KovaKova Posts: 12
    edited 2005-10-24 00:12
    Hi Paul, I understood everything you said, but it looks like to much work for something that I can buy for ~$500. A unit that I wanted to replace has 4 dial switches for 1s, 10s, 100s and 1000s. I wanted to have a "counter" (4 DI of BS2) to do the same thing. Maybe one more switch for "START/STOP" would be even better solution. I was looking for some schematics and code to start with, but I'll check what's available on
    market. I need to build DAQ for 8 strain gages, 2 load cells, 6 RTDs, 8 TCs, 2 vibration sensors and 2 freq. inputs. Those frequencies are to high for my tape recorded, so I needed that divider to be able to record them. A mounting rack that is available for my DAQ is very small, so I had to look for something portable. However, this is not the end of my idea to use BS2 for this test, so I'll check what I can do to take a sample readings from "analog streams" (as faster as possible) with BS2 and save them on USB drive with USBWiz. I know this is to much work for only one BS2 so I'll try Master/Slave communication between those two. If you have any ideas/schematics/code for this I'll appreciate it. Sincerely,
    Kova
Sign In or Register to comment.