Jump to content
IGNORED

RS-232 on TI BASIC or assembly


Recommended Posts

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?

  • Like 1
Link to comment
Share on other sites

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.

 

 

  • Like 3
Link to comment
Share on other sites

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 by Stuart
  • Like 4
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...