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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
903 次查看
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 解答
776 次查看
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.

在原帖中查看解决方案

1 回复
777 次查看
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.