How to change parity at runtime

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

How to change parity at runtime

887 次查看
steve_erickson
Contributor I

Using CodeWarrior 10.5, Kinetis MK12DX and Processor Expert.  For AsynchroSerial component, is there a way to change the parity, width and stop bits at runtime?

0 项奖励
回复
1 回复

819 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Steve Erickson o,

    In my own opinion, you can modify the register directly, don't need to use the API.

   Please note, if you want to enable the parity, then you need to modify data bit to 9bits to keep the data still be 8 data.

 Just

1. UARTx_C1[M]=1 Use—start + 9 data bits (MSB/LSB first as determined by MSBF) + stop.

     9 data bits is 8 bit data+1 bit parity.

 2. UARTx_C1[PE] =1 Parity Enable

 3. UARTx_C1[PT] =0 even parity, 1 odd parity.

pastedImage_1.png

  Wish it helps you!


Have a great day,
Kerry

-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

0 项奖励
回复