How write a function which change frequency every 100hz by using sw2 and sw3 buttons? nxps32k144evb

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How write a function which change frequency every 100hz by using sw2 and sw3 buttons? nxps32k144evb

Jump to solution
1,623 Views
miketorres
Contributor II

Hi,

 

I have program from example application - ftm_pwm_s32k144. I set frequency at 1000HZ in flexTimer. I would like to change frequency every 100HZ by using Sw2 and SW3 buttons. How Can i do it? I defined in my program this buttons and what should I do next? Could you help me, do you have similar code or advice?

Regards

Mike 

0 Kudos
1 Solution
1,562 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@miketorres

      I have answered you under your other questions.

BR!

     Jim,

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

3 Replies
1,611 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@miketorres

Hi, Mike

I give you a hint.

1.How to change PWM frequency?

please refer to example "ftm_signal_measurement_s32k144 "

 

2.How to use SW1 or SW2.

please refer to example "power_mode_switch_s32k144"

In this example,SW3 was used to wake up the CPU from power mode.

/* Interrupt service routine for SW3 */
void ButtonISR(void)
{
    /* Clear button IRQ flag */
    PINS_DRV_ClearPortIntFlagCmd(PORTC);
}

or you just keep reading SW(I/O) status without using interrupt. 

pins_channel_type_t PINS_DRV_ReadPins(const GPIO_Type * const base)

 

BR!

     Jim,

0 Kudos
1,590 Views
miketorres
Contributor II

Hi,

 

what's wrong with this code? Could you help me? Where are mistakes? I don't understand. I would like to this code generate digital square signal - 1000hz frequency. By using sw2 and sw3 buttons I would like to change frequency. If I pushed once for example sw2 button frequency should increase about 100HZ. Could you correct my mistake in this code? I will be very grateful. 

0 Kudos
1,563 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@miketorres

      I have answered you under your other questions.

BR!

     Jim,

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------