theincrediblepeep Posted January 7 Share Posted January 7 Happy 2023, all! Wishes for an exciting new orbit around the sun. I have been playing with the RS-232 serial interface in TI BASIC, and it has lots of fun potential. However, what I don't understand is how to read from RS232 in a non-blocking way. Considering this simple example: 10 OPEN #1:"RS232.BA=9600.DA=8.PA=N.CR.LF",INPUT 20 INPUT #1:D$ 30 PRINT D$ 40 GOTO 20 Above, the computer waits on line 20 until there is a sufficient parcel of incoming data, and then proceeds; no other code can be run during that time. Is there a way to "peek" the serial queue in a non-blocking way for if an I/O READ would return data? I have tried using the EOF function, to see if that could be used to detect incoming serial data, but it returns an error on the serial device when in BASIC. I did not venture coding something like this in assembly until I could get past the issue in BASIC, but perhaps BASIC has no way to do it? In assembly, I've considered that it might be accomplished by hooking into an interrupt to fire when data is available, which I've never done before. Any insight? 1 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted January 7 Share Posted January 7 There is a reference to "pending input condition" if you follow the variable with a comma for INPUT (with files) in the XBASIC manual. That might let you do what you want. ?? EDIT: I tried this and it still blocked. 3 Quote Link to comment Share on other sites More sharing options...
Stuart Posted January 7 Share Posted January 7 (edited) In assembly you can poll the RS-232 chip (TMS9902) directly to see if a character has been received and if it has, read it, otherwise do something else. I believe you can do it using interrupts as well. Edited January 7 by Stuart 4 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted January 7 Share Posted January 7 48 minutes ago, Stuart said: In assembly you can poll the RS-232 chip (TMS9902) directly to see if a character has been received and if it has, read it, otherwise do something else. I believe you can do it using interrupts as well. I do this in my Forth system. It's easier than using the DSR. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.