HP Forums
HPBasic code for RS-232 on a 9826 with a 98626A card? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HPBasic code for RS-232 on a 9826 with a 98626A card? (/thread-22238.html)



HPBasic code for RS-232 on a 9826 with a 98626A card? - mrcity - 08-29-2024 06:46 AM

Hey folks, I just installed a card called the IEM RI-8632 into my 9826. It's basically three 98626A's in one, each with its own DB9 (DE9) connector, and actually shows up like that at boot time. Best part is it's only $12 shipped to the lower 48 on eBay, and there are more available.

I have been able to write messages from my 9826 and have them manifest on my laptop using PuTTY and a serial-to-USB converter. It seems like the default settings are 9600/8/N/1 and then the top 5 DIP switches set the device ID. Say I have devices 9, 10, and 11 as my three RS-232s. I can write

Code:
CONTROL 9,12;176

to disable all three types of flow control on device 9 through register 12 by writing 128 + 32 + 16. Then by also disabling flow control in PuTTY, it's an easy way to get the outbound communication working. Then, I can write something along the lines of

Code:
OUTPUT 9;"Help, I've been trapped in this box since 1982"

And then it'll write that cheeky little message in my PuTTY window.

Now the problem comes when I'm trying to read data from the serial port into the 9826. I can use the ENTER command to do this (yes, highly search engine optimized keyword ?), but it requires a variable instantiated to hold its output. Fine, I can write this:

Code:
10 LET E = 5
20 ENTER 9;E$

But then when I run this, the 9826 gives me a cursor after which I enter something, it hangs until I reset BASIC. The PuTTY window doesn't let me type anything, and then no communication works in either direction until I restart PuTTY and reset Register 12 as above.

Any advice on where I'm going wrong with the ENTER command? Or is it messing up because of flow control? Or do I somehow need a different device ID for input? Or do I need to let E$ be a string so it's the same on lines 10 & 20? It'd be really slick to get two-way communication going!


RE: HPBasic code for RS-232 on a 9826 with a 98626A card? - J-F Garnier - 08-29-2024 07:10 AM

(08-29-2024 06:46 AM)mrcity Wrote:  
Code:
10 LET E = 5
20 ENTER 9;E$

But then when I run this, the 9826 gives me a cursor after which I enter something, it hangs until I reset BASIC. The PuTTY window doesn't let me type anything, and then no communication works in either direction until I restart PuTTY and reset Register 12 as above.

Any advice on where I'm going wrong with the ENTER command? Or is it messing up because of flow control? Or do I somehow need a different device ID for input? Or do I need to let E$ be a string so it's the same on lines 10 & 20? It'd be really slick to get two-way communication going!

Better to ask such specialized questions on the Vintage HP Computer group.
But, some indications:
- The 9000 BASIC provides living keyboard, so you can type a command during program execution.
However, the processing of this command has to wait for the end of the current program line, which in this case is stuck in the ENTER statement. So the computer may look as hung.
- The HP ENTER statement, by default, usually waits for a CR/LF (or just LF) terminator. Try to type LF (ctrl-J) on your terminal.

J-F


RE: HPBasic code for RS-232 on a 9826 with a 98626A card? - mrcity - 08-30-2024 12:15 AM

(08-29-2024 07:10 AM)J-F Garnier Wrote:  Try to type LF (ctrl-J) on your terminal.

That helped! Smile In addition:
  • I switched to a regular serial cable and used an old GRiD laptop running ProComm Plus.
  • I changed the code just a bit:
    Code:
    10 LET E$="hi"

This way, it initializes a string variable, and now I can send messages from the GRiD to the 9826. I'll have to learn more about strings to see if I can capture more than 16 characters at a time.

However, I still can't transmit from my laptop using the USB serial adapter. But now I know there is some kind of hardware misconfiguration. Thanks for your help!


RE: HPBasic code for RS-232 on a 9826 with a 98626A card? - cruff - 08-30-2024 02:11 PM

You probably have to configure it to ignore the modem control signals or jumper them so the laptop thinks it is ok to transmit. You might also need to disable flow control in the program you are using to access the serial port.

For example if using Kermit:
set flow-control none
set carrier-watch off


RE: HPBasic code for RS-232 on a 9826 with a 98626A card? - Martin Hepperle - 08-30-2024 04:47 PM

You should not have to preset the variable E$.
Just use it and it should be dimensioned to the correct length by the ENTER command.
As already mentioned above, ENTER reads up to the defined end of line character (see registers of the I/O card).

Instead of a string you can also use a numeric variable, e.g. for reading voltage from a DMM
(It's all described in the BASIC and card manuals, the IEM card behaved like a HP RS232C card only with 3 select codes).

Martin


RE: HPBasic code for RS-232 on a 9826 with a 98626A card? - J-F Garnier - 08-30-2024 08:34 PM

(08-30-2024 04:47 PM)Martin Hepperle Wrote:  You should not have to preset the variable E$.
Just use it and it should be dimensioned to the correct length by the ENTER command.

Unless explicitly declared, string variables have a maximum length of 18 characters.
Larger string variables must be declared (dimensioned) with the DIM statement e.g. DIM E$[80] , up to 32767 characters.

J-F