ABOUT MM9z1_638 SCI interface

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

ABOUT MM9z1_638 SCI interface

跳至解决方案
1,678 次查看
ztzzzttt
Contributor I

i used KT9z1_638_sci_demo to run communicatinon。
try sci DEMO Driver interface
len=SCIReadCh(&cmd[0])
works OK ,i can receive a word。eg:n or  m
but try
len=SCIReadLine(&cmd[0]).eg:123   or abc
it works incorrect,received nothing。
it's len=0 always。

标记 (1)
0 项奖励
回复
1 解答
1,426 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

If I understand, the SCI example code doesn’t work unless you replace the SCIReadLine function with the SCIReadCh function. Or have you somehow modified the code? The SCIReadLine function takes not only a pointer to the received buffer but its length as well.  

Regards,

Daniel

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,427 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

If I understand, the SCI example code doesn’t work unless you replace the SCIReadLine function with the SCIReadCh function. Or have you somehow modified the code? The SCIReadLine function takes not only a pointer to the received buffer but its length as well.  

Regards,

Daniel

0 项奖励
回复
1,426 次查看
ztzzzttt
Contributor I

Thanks for your response。

That is a mistake in cellphone writing before;

I mean that  SCIReadCh function works well、 SCIReadLine function   works incorrect,can't get the right result len=0 always。

I have connected  SCI port to PC(Serial Interface) through a  https://community.nxp.com/thread/?keyword=" style="color: #4285cc; text-decoration: none;inverter(.74lvc04), PC  received  data from MM9z1638 with Baud https://community.nxp.com/thread/?keyword=" style="color: #4285cc; text-decoration: none;rate 34800 and works well.but  MM9z1638 can't readline with SCIReadLine() function ,only can read one word with 

SCIReadCh( )function.if there something wrong with HardWare,or SCI configuration. 

Thanks for your help!

捕获.jpg

0 项奖励
回复
1,426 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

The function actually works correctly.

There is a difference between these two functions.

The SCIReadCH function returns TRUE whenever a character has been received.

Whereas the SCIReadLine function reads the received string and returns its length only if '\n' character is received at the end of the string.

Otherwise the function returns zero.

Regards,

Daniel

1,426 次查看
ztzzzttt
Contributor I

Thank You I rewrite the receive function in Interrupt .Now ,SCI works well

0 项奖励
回复