- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I have CY8CKIT PSoC 5LP KIT and I want to measure time between 6 signals that coming on 6 different pins.
First signal is TR. When TR happened (rising edge) 5 time counters start.
When MP1 happened (rising edge) first counter stop.
When MP2 happened (rising edge) counter 2 stop.
All same to MP5.
After 100 ms send 5 time values ( number in ms) to COM Port (RS232).
If I have 2 TR before MP that counter send message AAAAAAAA.
If MP don't happened 100 ms after TR that counter send message CCCCCCCC.
I am new to PSoC and don't have C code experience.
Can somebody help me with this?
Thanks
Val
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Questions -
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.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks
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
Thanks
again
Val
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dana
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".
Thanks
Val
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Double clcik component and config its properties -
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
then
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..
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
event counts.
In case you run out of HW resources.
Regards, Dana.