Specifications

PROGRAMMING EXAMPLES
VISUAL BASIC EXAMPLE (Microsoft Visual Studio)
'To open Com:
SerialPort1.PortName = "COM1"
SerialPort1.BaudRate = "9600"
SerialPort1.Open()
'To Transmit:
SerialPort1.Write(chr(XOut)) 'XOut is channel code
'To Receive:
XIn = SerialPort1.ReadByte 'XIn is analog data
'To Close Comm:
SerialPort1.Close()
C# EXAMPLE (Microsoft Visual Studio)
serialPort1.PortName = "Com1";
serialPort1.BaudRate = 9600;
serialPort1.Open();
//To Transmit:
serialPort1.Write(channelByte,0,1); //channelByte is channel code
//To Receive:
InByte[i] = serialPort1.ReadByte(); //InByte[i] is analog array
serialPort1.Close();
The entire source code program examples and the complete project code are provided on your installation CD along
with additional source code examples in other programming languages. The programs are intended to demonstrate
the fundamentals needed for development of your own software. The program examples may be copied to your
program and used as a subroutine if desired.
These examples will run in all versions of Visual Studio including Visual Studio Express. The installation CD will have
examples in all the programming languages used with Microsoft Visual Studio including Visual Basic, Visual C#,
Visual C++ and ASP .Net. Additional source code examples are available in several other variations which may be
more suitable for alternate programming languages (including interfacing to older DOS programs using GW Basic or
QuickBasic if needed). Please contact EECI technical support for more information.
Page 14
SYSTEMS LEVEL BAUD RATE SELECTION
The baud rate for IBM & compatibles may be selected by turning on Baud Rate MSB LSB (decimal)
the baud rate latch (bit 7 of the line control register) and setting the 300 1 128
registers as shown to the right. Basic programmers may use the OPEN 600 0 192
COM command to set the baud rate for COM 1 & 2 in place of this 1200 0 96
method. The baud rate and protocol for COM 3 & 4 should be selected 9600 0 12
from Basic by using the above procedure and the OUT command. An 19200 0 6
example is provided on the test disk using COM 3 & 4 from Basic.
Other standard baud rates may be selected by adjusting the given values. EXAMPLE: 4800 baud = 1/2 of 9600 = 24
The COM port register locations for COM 1 through COM 4 are shown below.
COM 1 COM 2 COM 3 COM 4 (hex values shown)
3F8 2F8 3E8 2E8 Transmitter/Receiver
3F8 2F8 3E8 2E8 Baud Latch LSB
3F9 2F9 3E9 2E9 Baud Latch MSB
3FB 2FB 3EB 2EB Line Control
LINE CONTROL
(Bit 0) (Bit 1) Word Length NOTE: The ADC-16 will function with any RS-232 COM
0 0 5 data bits port (or RS-422 & RS-485 with option).
1 0 6 data bits
0 1 7 data bits
1 1 8 data bits
(Bit 2) 0 = 1 stop bit
1 = 2 stop bits
(Bit 3) 0 = no parity
1 = parity enabled
(Bit 4) 0 = even parity
1 = odd parity
(Bit 5) 0 = logical 1
1 = logical 0
(Bit 6) 1 = break command
(Bit 7) 0 = baud latch off
1 = baud latch on
Page 15