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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
910件の閲覧回数
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 解決策
783件の閲覧回数
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 返信
784件の閲覧回数
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.