ABOUT MM9z1_638 SCI interface

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ABOUT MM9z1_638 SCI interface

Jump to solution
866 Views
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。

Tags (1)
0 Kudos
1 Solution
614 Views
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

View solution in original post

0 Kudos
4 Replies
615 Views
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 Kudos
614 Views
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 Kudos
614 Views
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

614 Views
ztzzzttt
Contributor I

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

0 Kudos