tcs3200 with propeller
j_roddy
Posts: 6
hello, i'm trying to use the tcs3200 with my propeller chip, but can't figure out how to count the pulses. i looked at the basic code, and it has a count function, which i think is comparable to the cntra registers on the propeller. right? i'm just looking to do simple pulse measuring for a specified time period, like the sample basic code does.
what counter mode do i need to use for measuring pulses with this sensor? what register holds the number of pulses in a time period? also, how do i set the duration of time to wait while counting pulses?
sorry for all the questions, but there are no good resources out there for this sensor with a propeller chip.
what counter mode do i need to use for measuring pulses with this sensor? what register holds the number of pulses in a time period? also, how do i set the duration of time to wait while counting pulses?
sorry for all the questions, but there are no good resources out there for this sensor with a propeller chip.
Comments
The TCS3200, looks pretty easy to use. You use the S2 and S3 pins to set which diode type you want to use and then read the frequency output like you would with the TSL230.
To:
As part of my attempt to understand the different was of reading encoders, I wrote a small program to count pulses three different ways. Here's a link to the program.
I also trimmed the program down to use just the counter method and I'm attaching the modified program to this post.
As the program is currently setup, it will display the number of pulses received every quarter of a second. Again, the interval can be easily changed. To change this program to count pulses for ten seconds change these constants.
To:
I doubt you'll want to count pulses longer than a second in this application.
I haven't done a proper test of this program but I think it should work as expected.
I usually cut and paste other people's code whenever I need to use the Propeller's counters. In this particular case I used the code examples of the Propeller Education Kit (PEK) as a guide. IIRC the example code was on page 150 of the PEK. A pdf of the PEK can be found in the Propeller Tool's help menu.
BTW, Welcome to the forum. I have links to some other Propeller tutorials in post #3 of my index (see my signature).
I hope you let us know how your project turns out.
p.s. i dont know why it won't let me post [%]01010, but that's the setting in my actual code, without brackets.
-Phil
is something wrong with my code then? its above. I have a basic stamp mobo too, and ran the sample code from the product page for it on that to see if my sensor was busted...worked just fine though.
You will have to change the values of S2, S3, and OUT to correspond to your pinouts.
-Phil