hi i'm using PSoC 1 for my MSc project and i'm not familiar with it at all. i need to use it as a counter to convert pulses(1ms) to frequency.i need guides about how to use it as a counter! plzfrom what I have been able to deduce (although I have not looked into it much) it is a programmable embedded system-on-chip integrating configurable analog and digital peripheral functions, memory and a microcontroller on a single chip.
the one I have has the following:
Up to 24 MHz, 4 MIPS
Flash 4 KB to 32 KB
SRAM 256B to 2 KB
Operation 1.7V to 5.25V
1 Delta-Sigma ADC (6 to 14-bit)
131 ksps @ 8-bit
Voltage Precision ±1.53%
Up to 2 DACs (6- to 8-bit)
Active: 2 mA, Sleep: 3 μA
FS USB 2.0, I2C, SPI, UART, LIN
Requires ICE Cube and FlexPods
Up to 64 I/O
This probably explains why nobody is using it.i'm not familiar with this at all. ... dose anyone have an idea about how can i use it???
thanks for your reply , in puts are pulses of avalanche photo diode and at the out i need to calculate frequencies of these pulses, the duration is 1ms . thats y im using PSoCIs 1 ms the width of the pulses or the repetition rate? Can you give us some examples of your input and the corresponding output?
P.S. -- You should have started a new thread rather than hijacking an old one.
Generally speaking you use the available hardware to measure a period and convert it to frequency by taking the reciprocal.
yes i got it thanks , no i just have pulses and need to convert them to frequency so i was wondering how can i use counter(the pulses have different duration ex:1ms,2ms..) ? there is no example in this hardware which has used a counter.So the pulses are 1 ms wide and you need to compute the time between pulses. In the limit you could have a new pulse arrive every millisecond for a frequency of 1 kHz. Any slower arrival rate would result in a frequency between DC and 1 kHz. Look for some hardware in the PSOC referred to as "input capture". What this will do is "capture" the value of a free running timer of a known frequency. An incoming pulse triggers a capture and you save that number. You rearm the capture mechanism and wait for the next trigger pulse and that capture gives you the second number. Now if you subtract the first number you captured from the second number this will be the elapsed time in units of the basic "tick time" of the free running clock. The reciprocal of this number is the frequency of the pulse arrival.
For example:
If the free running clock is 25 kHz., and the first number you capture is 2,537 and the second number you capture is 13,744 you would do the following:
Do you get the basic idea?
- Pulse Arrival Period = 13,744 ticks - 2,537 ticks = 11,207 ticks
- Tick Period = 1 / 25 kHz = 40 μsec = 40e-6 seconds
- Pulse Arrival Period (seconds) = 11,207 ticks * 40e-6 seconds/tick = 0.448280 seconds
- Pulse Frequency = 1 / .448280 ≈ 2.230 Hz.
i got it thanks alot.So if the pulses have different lengths then what you need is only slightly more complex. Let's say the pulses are positive, i.e. the voltage goes up on the leading edge and goes down on the trailing edge. Now you arm the capture mechanism and trigger on the first rising edge. Now you disable looking for rising edges and look for a falling edge. Once you see the falling edge you look for the next rising edge, which would be your third capture. Now you use the 1st and 3rd captures to compute the frequency, and you use the 1st and 2nd to compute the pulse width.
Revised example:
If the free running clock is 25 kHz., and the first number you capture is 2,537, the second number you capture is 2,575, and the third number you capture is 13,744 you would do the following:
Now as you continue to collect numbers you can build a histogram table of pulse width and pulse frequency.
- Pulse Arrival Period = 13,744 ticks - 2,537 ticks = 11,207 ticks
- Tick Period = 1 / 25 kHz = 40 μsec = 40e-6 seconds
- Pulse Arrival Period (seconds) = 11,207 ticks * 40e-6 seconds/tick = 0.448280 seconds
- Pulse Frequency = 1 / .448280 ≈ 2.230 Hz.
- Pulse Width = 2,575 ticks - 2537 ticks = 38 ticks
- Pulse Width = 38 ticks * 40e-6 seconds/tick = 1.52e-3 seconds = 1.53 milliseconds
If you just want to count the pulses you can still use the capture mechanism to record the times and increment a counter each time you do a capture.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | Understanding the Linker Script in PSoC Creator Cypress Dock Project | Software & IDEs | 4 | |
PsOC 4 BLE (pins problems) | Wireless & RF Design | 0 | ||
S | Simulate PSoC in Proteus | PCB Layout , EDA & Simulations | 3 | |
PSoC KitProg Question | Microcontrollers | 2 | ||
A couple of newbie questions about PSoC | Microcontrollers | 13 |