- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm making a color sensor (TCS3200), and i have a issue trying to make a function that works the same way as pulsin() from arduino.
In a code i take my output value like this on arduino: PulsIn() function definition from arduino
// Reading the output frequency
greenFrequency = pulseIn(sensorOut, LOW);
and i have to do somthing like that on PSoC creator.
Right now i only get 0 and 1 as output (the value of what i set my pins to).
in the attached code you can see what im trying to do.
Thanks
Solved! Go to Solution.
- Labels:
-
PSoC 5 Device Programming
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The PulsIn() seems to be a frequency counter.
The following document seems to be very helpful.
http://www.cypress.com/file/144696/download
I also tried this with PSoC 5LP board, as I don't have the sensor
I fed the pulse from my funcgen program with another MCU
via Pin P6[6] as SensorOut.
It is measuring frequency (Hz), so probably you need to adjust counter parameters.
Attached is my test project based on your project.
I hope this can be a little help.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
There is no direct replacement for PulseIn Function in Creator.
You may have to use a GPIO and Timer or PWM and interrupt to implement similar functionality.
These links may be useful:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The PulsIn() seems to be a frequency counter.
The following document seems to be very helpful.
http://www.cypress.com/file/144696/download
I also tried this with PSoC 5LP board, as I don't have the sensor
I fed the pulse from my funcgen program with another MCU
via Pin P6[6] as SensorOut.
It is measuring frequency (Hz), so probably you need to adjust counter parameters.
Attached is my test project based on your project.
I hope this can be a little help.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can see that you use the:
volatile uint32_t dummy;
what is this variable used for?
Because its set but not used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Actually it was a little bit difficult for me to use these two counters.
During the debug, when the loop timeout-ed, I wanted to check the
frequency count without overwriting the real value, so I used dummy.
Then as you noticed, as I did not use dummy anywhere else,
the compiler optimized the variable so I could not see the value
from the debugger. Then I used "volatile" key word to prevent the
compiler to opt-out the variable.
Anyway, now it does not affect anything else... I hope.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the fast respons btw, it REAALY helped me alot