- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,sir,
for PSOC4100S series, is it possible to use GPIO to simulate timer interrupts in addition to the 5-way PWM?
If it is possible, can you provide the example program?
Thanks for the answer!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> Interrupt interval can be 1ms or 2ms
Then you should be able to use SysTick Timer.
Please refer to the links in my previous response.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
From your description, I could not figure out what you want to do with the 5-way PWM.
So I just wrote a sample which takes a GPIO input (SW as active-low) for interrupt source
and just toggle an output LED. (You can change sw_isr() to do what you want with the PWM)
I used a TSoC board which has CY8C4146LQI-S433.
schematic
SW config
LED config
Pins
main.c
#include "project.h"
#define LED_ON (1u)
#define LED_OFF (0u)
CY_ISR(sw_isr)
{
SW_ClearInterrupt() ;
if (LED_Read() == LED_ON) {
LED_Write(LED_OFF) ;
} else {
LED_Write(LED_ON) ;
}
}
void init_hardware(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
LED_Write(LED_OFF) ;
isr_1_ClearPending() ;
isr_1_StartEx(sw_isr) ;
}
int main(void)
{
init_hardware() ;
for(;;)
{
/* Place your application code here. */
}
}
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Demi1 ,
Can you please let us know in which software you are simulating this project?
Can you please clarify about 5-way PWM and simulating timer interrupts? Are you referring to the 5 TCPWM blocks present in the 4100s device?
If this is the case, you may re-route the PWM output(s) to a different pin(s) by using Smart-IO. You can refer to smart i/o_pwm_ramping_led to know about Smart I/O.
You can use the following code example as a reference (for ModusToolbox): mtb-example-psoc4-tcpwm-interrupt and mtb-example-psoc4-gpio
Please also refer to:-
PWM Timer and De multiplexer on PSOC4100S
GPIO Interrupts
Warm Regards
Gautami J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Gautami J
thank you for your help, this is how the customer simulates this project in PSOC creator software.
The customer is already using 5 TCPWM modules as PWM outputs in the 4100S device; he also wants to use timer interrupts, how do I implement it?
Thank you for your answer!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
What is the required interval of timer interrupt?
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If the interval can be in the order of ms, SysTick Timer can be used.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,Sir,
Interrupt interval can be 1ms or 2ms
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> Interrupt interval can be 1ms or 2ms
Then you should be able to use SysTick Timer.
Please refer to the links in my previous response.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your patience in answering my questions.