PDA

View Full Version : Accessing the second serial port on NMIN-2107


les@windstream
04-22-02, 10:03 PM
How does one attach the second serial port to the TIB in place of the one that's initially connected to it? Or is that possible? Does one have to use the registers to access the second port or is there a way to redirect the I/O between the primary serial port and the second one with regard to the TIB? Can the two be used simultaneously, switching the connection to the TIB back and forth between the two? Is it SCI 1 or SCI 2 that's initially connected to the TIB?

rob
04-23-02, 01:31 AM
The text interpreter is hooked right to the first serial port. If you want to interpret code from a different port, you can use INTERPRET. This word will interpret text in the TIB buffer up to the terminating zero which should also agree with #TIB. Also make sure to set >IN to 0 to start interpreting at the start of the tib buffer (TIB @).
QUERY fills up the tib buffer from serial port 1.

Rob

les@windstream
05-04-02, 11:14 AM
I understand the use of INTERPRET, but how does one hook the TIB to the second serial port? In what you've said, you imply that the text interpreter does not use the TIB as a collection point for data from the first serial port. Am I understanding your comment correctly? (If yes, it would explain the odd results I've gotten in trying to copy input text in the TIB prior to it being interpreted. It might help me if you could provide a somewhat more detailed description of that part of the internal plumbing, both for the first serial port, as well as the second. I'm still assuming that I have to read the appropriate serial register of the second serial port to get data, but it would be great if I could use some of the built in mechanisms to do that. Thanks, again, in advance.

rob
05-06-02, 02:43 PM
Perhaps a related example would help. This example gathers text and then copies it to TIB before interpreting it. It can be used to interpret strings or you could put input from a second serial port into TIB in this manner:

: EVAL ( s -- ) COUNT DUP #TIB ! 0 >IN !
TIB @ 2DUP + 0 SWAP C! SWAP CMOVE INTERPRET ;

: TEST 0 WORD EVAL ;

And some test code:

TEST .S
EMPTY OK
TEST 1 2 3 4 .S
4
3
2
1 OK

If you try and interactively put stuff into TIB or manipulate it while it is being used by INTERPRET, your results will be unpredictable. Without seeing your code or knowing specifically how you are going about your task, I can only give you general pointers. For gathering text from a second serial port and interpretting it, you should gather all the characters until you have an end of line and then create a string and call EVAL or use parts of its definition to achieve your task.

Rob