Getting data using Uart on Mc9s08mp16

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

Getting data using Uart on Mc9s08mp16

跳至解决方案
1,312 次查看
abhisheksaxena
Contributor II

Hello guys,

                    I am working with Mc9s08mp16 processor for controlling BLDC motor and in that process I want to get some parameters of BLDC out from the board.I am hoping that there is a way to get data through UART communication.

                     Any tutorials/documentation on how to accomplish that are appreciated.

                                       Thank you in advance for your time.

标签 (1)
0 项奖励
回复
1 解答
1,120 次查看
vicentegomez
NXP TechSupport
NXP TechSupport

Hi Abhishek

to set the SCI you need to use the following register

// Following a reset, BUSCLK ~ 4.20MHz

  SCIBD = 27;           // SCI baud rate = 4.20MHz/(16*27)=9722 bps

  SCIC1 = 0;  //default settings

  //enable transmitter and receiver pins, enables receiver interrupt

  SCIC2 =  SCIC2_TE_MASK |  SCIC2_RE_MASK | SCIC2_RIE_MASK;

Just check the bus clock that you has, in order to set the SCIBD

this is sample for and interrupt

interrupt VectorNumber_Vscirx void SCIRX_ISR(void)

{

  unsigned char u8receiver;

  (void) SCIS1;       // read SCIS1 register for clear RDRE flag

  u8receiver = SCID;

  

  SCID = u8receiver;

}

I hope this will help you

Regards

Vicente Gomez

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,121 次查看
vicentegomez
NXP TechSupport
NXP TechSupport

Hi Abhishek

to set the SCI you need to use the following register

// Following a reset, BUSCLK ~ 4.20MHz

  SCIBD = 27;           // SCI baud rate = 4.20MHz/(16*27)=9722 bps

  SCIC1 = 0;  //default settings

  //enable transmitter and receiver pins, enables receiver interrupt

  SCIC2 =  SCIC2_TE_MASK |  SCIC2_RE_MASK | SCIC2_RIE_MASK;

Just check the bus clock that you has, in order to set the SCIBD

this is sample for and interrupt

interrupt VectorNumber_Vscirx void SCIRX_ISR(void)

{

  unsigned char u8receiver;

  (void) SCIS1;       // read SCIS1 register for clear RDRE flag

  u8receiver = SCID;

  

  SCID = u8receiver;

}

I hope this will help you

Regards

Vicente Gomez

0 项奖励
回复