Connecting the BASIC Serial Interface remotely using modems

application note #2 for the Basic Serial Interface

Use the Basic Serial Interface to control devices remotely by using modems and the public telephone system.

The BASIC Serial Interface (BSI) can be used to interface and control devices remotely via the telephone system by using modems. The following is a short discussion of how to do this including examples of the program required. It is intended to demonstrate the concept and is intentionally kept short and simple. It is left to the reader to fancy up the application to fit their particular needs.

First it is appropriate to mention that there is some inherit problems to controlling devices directly from the BSI output ports when hooked directly to a modem. The BSI output ports will exactly follow the data stream from the modem, which includes data generated my the modem when powered on, during negotiation, and when accessed my a foreign system other than the one intended. Therefor, if the BSI is to be used directly from a modem the devices hooked to the "out" ports should be coded and latched in order to prevent "false" activation. Conversely, reading data from the BSI when hooked directly to a modem is straight forward and any difficulties can easily be handled by software.

The following diagram shows the basic configuration:

Connecting the BSI to a modem:
Please refer to the standard test diagram in the Basic Serial Interface theory of operations or application note #1 and

note that the BSI serial cable must have pins 2 and 3 switched from the configuration shown in the diagram.

The black wire (serial in/SI) goes to pin 3 on the 25 pin D-connector and the red wire (serial out/SO) goes to pin 2.After making this change the BSI is plugged directly in to the modem and the modem is connected to the telephone line. The test fixture is hooked to the BSI as shown in the diagram.

This test circuit uses a Hayes 1200 baud modem set in the default factory configuration except that Auto Answer is turned on (dip switch settings 1, 3, 8 down). The BSI is set for 1200 baud also. Although a Hayes 1200 modem is used in this application there is every reason to believe that just about any other modem will work as well provided that it is configured correctly.

Programming: The following program can be used to test the BSI "output" operation:

30 OPEN"COM1:1200,N,8,2"AS #1
40 PRINT#1"ATDT 5551515"
60 PRINT#1,CHR$(A);
70 GOTO 30

Line 10 turns off the BASIC key displayed across the bottom of the screen in most versions of BASIC, Clears the screen, and closes any files that might be open. Line 20 opens the computer's serial communications port number 1 as device #1 and sets it to a bit rate of 1200, no parity, 8 bit words, and two stop bits. Line 30 dials the telephone number of the remote modem. Line 50 accepts a number typed from the computer keyboard. Line 60 converts the number to its appropriate ASCII equivalent (which will be the value of the number typed) and outputs it to communications port 1. Line 70 starts the program over again. For instance, if 65 was typed on the computer keyboard when the "return "key is pressed pins 6 and 12 of the 6402 UART (IC1) will go high and pins 11,10,9, 8, 7,and 5 will remain low. This bit pattern represents the binary number 10000010 or 65 in decimal.

The following program can be used to test reading data from the BSI's "in" ports:

30 OPEN"COM1:1200,N,8,2"AS #1
40 PRINT#1"ATDT 5551515"
50 IF LOC(1) <1 THEN 50
60 A$=INPUT$(1,#1)
80 GOTO 50

This program is the same as program 1 except for lines 50, 60, and 70. Line 50 pauses the program until some data is received. Line 60 receives the data word sent to the computer's serial communications port 1 and assigns it to the string variable A$. Line 70 prints the ASCII character ) to the screen. for instance if pin 2 and 37 on the BSI are high and pins 27,28,29,30,31, and 33 are low the 8 bit data word transmitted would be 01000001 or 65 in decimal which is the ASCII character "A". Note, that before data will be sent by the BSI Data Strobe (DS) must be toggled. Toggling of the Data Strobe in the test configuration is done by pushing the momentary switch shown in the diagram. The Data Strobe can be toggled by software command if Data Strobe is connected to "out" port 8 of the BSI and the following statement is executed:

PRINT#1,CHR$(128):PRINT #1,CHR$(0);

Additional information on toggling the Data Strobe is contained in application note#1.

return to jerry's home page

E-Mail to:

Copyright ©1996, Jerry Baumeister
Revised - 8-31-96