Shop OBEX P1 Docs P2 Docs Learn Events
help with BASIC STAMP 2 sampling — Parallax Forums

help with BASIC STAMP 2 sampling

dynamitekilladynamitekilla Posts: 3
edited 2008-08-20 02:53 in BASIC Stamp
Dear Reader,

·· I am trying to perform ADC with my BASIC stamp 2 but need to know the sampling frequency that the stamp reads in the data using the AD0831 chip. Please tell me if I am wrong with the following; using a basic stamp 2 module with a clock of 20MHz, the ADC needs about 8 clock cycles to convert the data and another 8 clock cycles are needed to transmit the data to the pc so this means 16 clock cycles in all. With a 20Mhz clock, 1 clock cycle = 0.05us so 16 clock cycles means 0.8us. Is the sampling frequency then 1/8 clock cycles = 250kHz ?


Alternatively, if I were to read the state change on a pin for a TTL input(0 and 5 only) then is the sampling frequency = 1 clock cycle =0.05us = 20Mhz ?

Thank you for taking the time to read my post. Have a pleasant day.

Comments

  • metron9metron9 Posts: 1,100
    edited 2008-08-17 03:55
    The ADC0831 uses a CLK pin so it dosen't matter what speed it is running at.


    Attached file is from a google search of "AD0831"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-08-17 04:11
    dynamitekilla

    I can tell you that it reads very fast depending how long you rountine is and whether or not use any pauses in you routine if you are going to use a LCD
    Display you do have to put little pause because they·are so fast that then LCD Display can not keep up I am just using pause 100 and that works great

    It still is very fast· as fast as an volt meter is··When it is ·read voltage changes

    I hope this helps


    This is the link where I working on a project using the ADC 0831 Chip

    http://forums.parallax.com/showthread.php?p=743395


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 8/17/2008 4:16:37 AM GMT
  • dynamitekilladynamitekilla Posts: 3
    edited 2008-08-17 15:08
    thank for the replies folks, but to produce accurate sampling I need to determine if I am fulfilling the Nyquist criterion or not to avoid aliasing and unwanted artifacts. I am sorry but I should have been more clearer. I am not using a display but rather I am saving the data to a file.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-08-17 16:06
    You're not reading PBASIC Help --

    Quick Facts
    attachment.php?attachmentid=74044

    255 x 257 - 11K
    642 x 100 - 3K
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2008-08-17 18:07
    The BASIC Stamp does not run anywhere near that fast. PBASIC is an interpreted language, which takes many many clock cycles at 20 mhz to read, decode and execute program tokens that are stored in a serial eeprom. Therefore the shortest time intervals for execution are on the order of 100 microseconds, and program times are measured in milliseconds, not microseconds. If you need sampling as fast as you say, you should consider the Propeller or the SX microcontroller instead of the Stamp. And that rapid of sampling will require machine language programming.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • dynamitekilladynamitekilla Posts: 3
    edited 2008-08-20 02:53
    thank you PJ Allen for the timing diagram and Tracy Allen for the further clarification and confirmation. DO sincerely appreciate the help smile.gif
Sign In or Register to comment.