How to mimic the PulsIn() function from arduino into PSoC Creator (PSoC LP5)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
user_3678521
Level 3
Level 3
5 likes given First like given

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).

rgb.JPG

in the attached code you can see what im trying to do.

Thanks

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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.

TeraTermLog.JPG

Attached is my test project based on your project.

I hope this can be a little help.

moto

View solution in original post

5 Replies