New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If i use WHILE (1), waiting for the serial port data will cause blocking, how to solve this problem? #140
Comments
str = uart.getchar( id, [timeout], [timer_id] )
Read a single character from the serial port
*Arguments*:
- *id* - the ID of the serial port
- *timeout (optional)* - timeout of the operation, can be either
*uart.NO_TIMEOUT* or 0 for non-blocking operation, *uart.INF_TIMEOUT* for
blocking operation, or a positive number that specifies the timeout in
microseconds. The default value of this argument is *uart.INF_TIMEOUT*.
- *timer_id (optional)* - the ID of the timer used for measuring the
timeout. If not specified it defaults to the system timer
<http://www.eluaproject.net/doc/v0.9/en_arch_platform_timers.html#the_system_timer>
.
Take a look at the second argument: timeout (
- *uart.NO_TIMEOUT*)
;)
Le lun. 16 juil. 2018 à 23:50, zhang402368157 <notifications@github.com> a
écrit :
… If i use WHILE (1), waiting for the serial port data will cause blocking,
how to solve this problem?
Attached code:
while(1)
do
str = uart.getchar( 0 )
if(str == '\a')
then
break
else
uart.write( 0, str)
end
end
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#140>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANAZZ7iqQY3xNLJXOpF8PWRCD0mA17Xks5uHVENgaJpZM4VSGVC>
.
--
Gabriel Duarte
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
|
Another question,whether the serial port can receive by interrupt ? |
Virtually, yes. Take a look again at the documentation:
http://www.eluaproject.net/doc/v0.9/en_inthandlers.html
:)
Le dim. 22 juil. 2018 à 23:28, zhang402368157 <notifications@github.com> a
écrit :
… Another question,whether the serial port can receive by interrupt ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#140 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AANAZULv15YW6ygKLKT0RZSp7blGLimoks5uJTTNgaJpZM4VSGVC>
.
--
Gabriel Duarte
Rio de Janeiro / RJ
http://genericdev.wordpress.com/
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If i use WHILE (1), waiting for the serial port data will cause blocking, how to solve this problem?
Attached code:
while(1)
do
str = uart.getchar( 0 )
if(str == '\a')
then
break
else
uart.write( 0, str)
end
end
The text was updated successfully, but these errors were encountered: