Shop OBEX P1 Docs P2 Docs Learn Events
Counter Module - Counting down event — Parallax Forums

Counter Module - Counting down event

tdeyletdeyle Posts: 85
edited 2011-02-14 11:45 in Propeller 1
Would I be able to use one of the counters in a cog to countdown an event by throwing a negative number in the FRQa/b register?

Say, to put out a clock signal for a specified number of pulses?

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-02-13 17:04
    tdeyle wrote: »
    Would I be able to use one of the counters in a cog to countdown an event by throwing a negative number in the FRQa/b register?
    Counting down, yes (negative number). Not entirely sure about you definition of event though, can you elaborate?
    tdeyle wrote: »
    Say, to put out a clock signal for a specified number of pulses?
    Check this post [post=967493]Counter module and pulse counting[/post].
  • tdeyletdeyle Posts: 85
    edited 2011-02-13 17:48
    Once I posted this thread, I noticed at the bottom of the page, there was a similar threads section. The link you posted was one of them.

    That is essentially what I would like to do, but I wanted to use only one counter. I don't think I will be able to do that.

    Basically, I want to pulse a pin, then countdown 65ms to pulse again and not repeat until signaled to do so again. But in between this, I wanted to pulse a clock pin, (@ 50ns positive and negative pulse width) a set number of times.

    I would have liked to do this within the same cog utilizing two counters, but don't think it is possible.
  • kuronekokuroneko Posts: 3,623
    edited 2011-02-13 17:53
    What else is the cog going to do? You could easily generate the clock with a counter and do the pulse generation manually (PASM).
  • tdeyletdeyle Posts: 85
    edited 2011-02-13 17:56
    It will be handling an ADC chip.
  • kuronekokuroneko Posts: 3,623
    edited 2011-02-13 18:12
    Do you have a link to the datasheet?
  • tdeyletdeyle Posts: 85
    edited 2011-02-13 18:36
    MAX1274

    I cobbled an assembly program that gets a 12bit sample in ~4us, but, I would like to use this as a call to perform the read from the TSL1401 linescanning module that I am using. In order to get an output on the module, I need to pulse the SI pin, then pulse the CLK pin 129 times. The exposure time starts from the SI pin pulse and ends at a second SI pulse.

    I wanted the space between the two SI pulses to be timed.

    I am thinking now, that I would be able to take a CNT measure, pulse the SI pin, send a pulse train down the CLK pin 129 times, then pulse the SI pin when the exposure time is done.

    Now, in order to measure the voltage on the AO pin from the imager, I need to pulse the CLK pin to shift out the data. But, I wanted to setup another exposure, timed from the most recent SI pulse, to another, that is equal to the exposure time.

    Well, I guess, considering that the ADC takes 4.4us to sample the voltage, with 128 pixels, it would only take around 563us. Considering that an exposure would be from 1/30s to 1/125s, the conversion would be over before the SI pulse would be needed to end the exposure.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2011-02-13 22:01
    The protocol for the MAX1274 calls for a High->Low on the CNVST pin to start the conversion (track->hold; enable output drivers) and 16 rising clock edges to perform conversion of 12 bits. I have trouble reconciling that with the description of 129 clock pulses and 2 separate pulses on an SI pin. Please clarify.
  • kuronekokuroneko Posts: 3,623
    edited 2011-02-13 22:18
    I believe the 129 cycle business applies to the TSL1401 which he mentions (the data sheet suggests as much).
  • tdeyletdeyle Posts: 85
    edited 2011-02-14 03:21
    Correct Kuroneko. The ADC is measuring the voltage from the TSL1401.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2011-02-14 11:45
    I get it. So it needs an A/D conversion as each of the 128 pixels is shifted out. 129 clocks for the 128 TSL1401 pixels, and 16 clocks to the MAX1274 ADC, for each pixel. And associated activation or chip select.

    I don't know if it will help, but I'm attaching an updated version of my NCOburst object. It corrects a couple of issues with the math in the earlier version, and now it can generate any given number of pulses from Spin, (up to 26 second burst length) at frequencies from 1 Hz to 39.999999 MHz (clkfreq=80MHz).
Sign In or Register to comment.