Changing parameters on the fly, when the code was generated with PE

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

Changing parameters on the fly, when the code was generated with PE

Jump to solution
427 Views
om
Contributor III

Hi

I started to use PE and suddenly I realize that it might not be the right tool to use, cause when I configure parameter in the PE, it is hard coded in the code that is generated.

For example:

Suppose I created driver for UART, with baud rate of 115200.

Suppose that the user of my program wants to send me a message to change baud rate to 9600, on the fly, while the program is running.

Can it be done?

(Cause I set the baud one tine in PE, compile it (with IAR) and then it is fixed)

Can I tell PE that I want to add a Auto created function that does some activity – like change the baud rate on the fly ?

(Or do something else)

Thanks a lot

  OM

1 Solution
300 Views
BlackNight
NXP Employee
NXP Employee

Hi OM,

sure you can change the baud at run time.

Got to the baud setting in PEx, and then change it to 'list of values'

5038_5038.png

Then specify all the values you need. With this you have a list of modes (starting with 0).

With this, you have SetBaudRateMode() available which you can use to change the baud at runtime:

5042_5042.png

The header file of the component will create defines for the modes which you can use:

#define AS1_BM_38400BAUD      0/* Baud rate constant for switch to the baud rate mode 0 */
#define AS1_BM_9600BAUD       1/* Baud rate constant for switch to the baud rate mode 1 */


I hope this helps.

View solution in original post

1 Reply
301 Views
BlackNight
NXP Employee
NXP Employee

Hi OM,

sure you can change the baud at run time.

Got to the baud setting in PEx, and then change it to 'list of values'

5038_5038.png

Then specify all the values you need. With this you have a list of modes (starting with 0).

With this, you have SetBaudRateMode() available which you can use to change the baud at runtime:

5042_5042.png

The header file of the component will create defines for the modes which you can use:

#define AS1_BM_38400BAUD      0/* Baud rate constant for switch to the baud rate mode 0 */
#define AS1_BM_9600BAUD       1/* Baud rate constant for switch to the baud rate mode 1 */


I hope this helps.