Welcome in the forum and in the fascinating world of PSoCs!
We here usually do not solve your programming problems, you'll have to learn C-language for yourself.
Setting up a timer and following your given rules is not so difficult. A Counter has got the choice of a "Capture" that saves the current counted value, an enable input will ensure that counts occur only while that input is logic High.
When you get stuck you may post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file, we will have a look at and comment.
1) Range of time values you want to measure ?
2) Resolution of time values to be measured ?
3) Accuracy of time values to be measured.
The C required for this rather simple. Google "C Language Training" there are
many videos/courses you can take.
PSOC Creator training -
C Book attached for reference.
I will check files that you send.
As your questions go:
1. Each timer 100 mS MAX
2. Resolution 0.1 mS
3. Accuracy 0.1 mS
Something like this might do it -
TR enables them all to start counting. When MPn occurs a capture of that timer is made and an interrupt
occurs so you can save its value to its respective channel timer variable. When last timer event occurs
you reset all with control reg RestartAll and com out the results.
You can also envision doing this with one timer. TR starts it, each time an MPn occurs
you do a capture/save and subtract the previous saved value captured to get the clocks
from MPn-1 to Mpn.
Just a thought.
When I try to do what you send me, I can't.
How to make "Timer" like yours?
When I take "Timer" it's have only "clock" and "reset". Don't have "enable" and "capture" in "fix mode".
Double clcik component and config its properties -
This is what I did so far.
I need to send each interupt to COM Port (RS232) and to reset after 300 mS.
I will try example of simple COM Port, but how to add each interupt to COM Port?
Project_1.jpg 116.3 K
In the components catalog view there is a system folder,
in that is an ISR component.
You can create a C ISR for each ISR by doing the following -
http://www.cypress.com/?rID=38267 AN54460 - PSoC® 3, PSoC 4, and PSoC 5LP Interrupts
CY_ISR_PROTO(MyIntFunc); // Prototype declaration
CY_ISR(MyIntFunc) // Interrupt function definition
// Place code here
In initialization part of the program
isr_StartEX(MyIntFunc); // Start Interrupt with my handler
CY_ISR-macro have a look into the "System Reference Guide" under Help -> Documentation..
Keep in mind I showed you the brute force way of doing the design, using a timer
for each channel, but I do think 1 32 bit timer would do the job with successive
reads each time an event occurs. And subtracting prior reading to get event to
In case you run out of HW resources.