Shop OBEX P1 Docs P2 Docs Learn Events
meaning of CLK — Parallax Forums

meaning of CLK

qiuqiuaaaqiuqiuaaa Posts: 37
edited 2012-08-14 22:37 in General Discussion
On the sensor, there is a Pin named SCL, and I know it means clock. I do not know the exact function of the clock, and can it be used as a timer in my program to control the time spent of a loop? Thanks. (I'm using Basic Stamp)

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-14 01:31
    The 'clock pin' provides a control of the rate and coordination of data being transferred.

    If you look at a serial in parallel out chip, you will see the basic principle - a series of latches collect the serial data and converts it into useful parallel data (bytes or words) for the chip to use or to store for later use.
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2012-08-14 02:32
    I am trying to find a method to measure time, and I think there is no timer in Basic Stamp itself. I don't know how to do it.
  • GadgetmanGadgetman Posts: 2,436
    edited 2012-08-14 04:59
    Which sensor are you trying to use?

    How accurate do you want the timing?
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-14 06:49
    The sensor's SCL pin is provided by the Stamp and controls the timing of the transfer of data to and from the sensor. It has nothing to do with the measuring of time. The Stamp, although it has a resonator to produce its own clock pulses, has no real-time-clock. The Stamp can do some crude timing using its PAUSE statement which provides pretty accurate millisecond timing and you can use the PULSIN statement to measure the width of an external pulse to a resolution of 20us.
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2012-08-14 07:05
    Actually, I want to make an inertial system. I am trying to use Gyroscope Module 3-Axis L3G4200D and MMA7455 3-Axis Accelerometer Module. First I want to get the angle from gyroscope, that is to say integrate the angular rate. So, I want the timer to get "delta t", and sum the terms of "angular rate * delta t" to obtain the angle. So I think the accuracy may be micron.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-14 08:03
    The Stamps are not going to be able to do timing accurately enough for inertial navigation. For that, you'll need some kind of external timer. Errors are cumulative in inertial navigation and you either need high accuracy or some way to recalibrate periodically against landmarks. You may want to consider using a Propeller for this. It's much faster, can do several things at once, and can do accurate timing.
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2012-08-14 19:39
    Mike Green wrote: »
    The Stamps are not going to be able to do timing accurately enough for inertial navigation. For that, you'll need some kind of external timer. Errors are cumulative in inertial navigation and you either need high accuracy or some way to recalibrate periodically against landmarks. You may want to consider using a Propeller for this. It's much faster, can do several things at once, and can do accurate timing.

    Thank you. I am not familiar with Propeller. Can it be mounted on my Boe-bot instead of Stamp? And is it hard to learn the language? I have only used Pbasic...
  • SRLMSRLM Posts: 5,045
    edited 2012-08-14 20:06
    It's not the language of the Propeller that is difficult, it is the language of the math: http://en.wikipedia.org/wiki/Kalman_filter

    But no, it's not hard to learn the language of the Propeller. Spin was designed to be simple, and it's very similar to PBasic.

    And, as a nice coincidence to your thread title, the Propeller does have a CLK type variable: CNT! It's the system counter, and can be used for most timekeeping purposes.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-14 20:34
    There is a version of the Propeller called the SpinStamp that can be mounted on the BoeBot. There's also a Propeller version of the Board of Education (see here). Spin is pretty easy to learn. You can also use C. There are several versions of Basic available as well although different from PBasic.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-08-14 21:34
    There are lots of ways to add a Propeller to a BOE-Bot. Probably the easiest way is to use the Prop-BOE as Mike mentioned. Here's my PropBOE-Bot. I personally think the record and play back feature is pretty cool.

    Several forum members have used QuickStart boards with a BOE-Bot. Here's Jose's version.

    The Propeller Protoboard (regular and USB versions) fit the BOE-Bot just fine. Here's a link to a robot using a Propeller Protoboard. I originally used the board with a BOE-Bot but transferred it to the omni bot. I added a breadboard to the bottom of the Propeller Protoboard so I could add experimental circuits to it.

    You'll be amazed at what the Propeller can do compared with a Basic Stamp. If you get stuck on some aspect of the Prop, just ask a question in the Propeller forum. People there are very helpful.
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2012-08-14 22:37
    Thank you all for your great kindness, and I will try PropBOE.:smile:
Sign In or Register to comment.