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。
Solved! Go to Solution.
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
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
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!
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
Thank You I rewrite the receive function in Interrupt .Now ,SCI works well