cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ Creator & Designer

Anonymous
Not applicable

hi every one 

   

I wish to read a pwm signal by using only an input pin + timer, so I make an interruption relied to my pin and then I make a delay of 1ms but when I send the data to my application to read it, its send to me 0 value, I think my interruption doesn't work correctly, any suggestion please thank you ^^

0 Likes
1 Solution
Bob_Marlowe
Expert II

Your interrupts are not associated with a signal or a component, you just call the handlers from software. This might not be what you want.

   

A component is connected to an interrupt handler by using the Component_StartEx() API.

   

 

   

Bob

View solution in original post

0 Likes
7 Replies
Bob_Marlowe
Expert II

Can you please 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. Please be a bit more clear what you want to perform, delay the signal by 1 ms?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

hi bob

   

 I want to read a pwm signal like you see in my project, I want to read the frequency (counting the number of pulses in a period).

   

 

   

thank you bob

   

0 Likes
Bob_Marlowe
Expert II

Your interrupts are not associated with a signal or a component, you just call the handlers from software. This might not be what you want.

   

A component is connected to an interrupt handler by using the Component_StartEx() API.

   

 

   

Bob

View solution in original post

0 Likes
Anonymous
Not applicable

hi bob, thank you for your answear 🙂

   

i want to read a pwm signal, thats why i use the bloc of TCPWM juste only for test, and then i send it to --->read_PWM_MOT, and the interrupt nam isr_1, sow i make my interruption on a rising edge like this :

   

CY_ISR(isr_speed)
{        
     cont++;
}

   

and then i call it : " isr_1_StartEx(isr_speed);"

   

and when i send the value of the counter in my buffer is send to me 000 

   

           TransmittData[0]=cont;

   

thank you for your answear ^^

0 Likes
Bob_Marlowe
Expert II

To "read" a PWM signal you probably mean to measure pulse width. This is done best using a Timer Counter component. Configure that for capture on falling edge and a count input. Set interrupts on capture and on terminal count.

   

Connect your signal to measure to both capture and count inputs, select the clock frequency as desired.

   

Write an interrupt handler that reads the captured value, stops the counter, set counter to zero and starts counter again.

   

 

   

Bob

Anonymous
Not applicable

hi bob thank u for your answer, can u take a look plz, i juste make the modification  that u suggeste, but my buffer usb =0x00

   

​thank u 

   

0 Likes
Bob_Marlowe
Expert II

Connect your CounterISR to the interrupt signal on Counter_Spd.

   

Configure Counter_Spd to reload at tc and cc

   

In CY_ISR(cont_handler) you need to read the isr cause (see datasheet) to clear the interrupt and decide if it was a tc (no input signal) or a cc.

   

 

   

Bob