Stanford Research Systems certifies that this product met its published specifications at the time
of shipment.
Warranty
This Stanford Research Systems product is warranted against defects in materials and workmanship for a period of one (1) year from the date of shipment.
Service
For warranty service or repair, this product must be returned to a Stanford Research Systems
authorized service facility. Contact Stanford Research Systems or an authorized representative
before returning this product for repair.
Information in this document is subject to change without notice.
Copyrightc Stanford Research Systems, Inc., 2003 – 2005. All rights reserved.
Stanford Research Systems, Inc.
1290–D Reamwood Avenue
Sunnyvale, CA 94089 USA
Phone: (408) 744-9040 • Fax: (408) 744-9049
www.thinkSRS.com • e-mail: info@thinkSRS.com
Printed in U.S.A.
SIM900Mainframe
Contents
General Informationiii
Safety and Preparation for Use. . . . . . . . . . . . . . . .iii
Dangerous voltages, capable of causing injury or death, are
present in this instrument. Use extreme caution whenever theWARNING!
instrument covers are removed. Do not remove the covers while
the unit is plugged into a live outlet.
Line Voltage
The universal input power supply of the SIM900 accommodates any
voltage in the range 90 VAC to 260 VAC, with a frequencyin the range
47 Hz to 63 Hz.
Line Fuse
The line fuse is internal to the SIM900 and may not be serviced by
the user. If the Standby LED does not turn on when line power is
provided, contact Stanford Research Systems.
Line Cord
Service
The SIM900 has a detachable, three-wire power cord for connection
to the power source and to a protective ground. The exposed metal
parts of the instrument are connected to the outlet ground to protect
against electrical shock. Always use an outlet which has a properly
connected protective ground.
Do not attempt to service or adjust this instrument unless another
person, capable of providing first aid or resuscitation, is present.
Do not install substitute parts or perform any unauthorized modifications to this instrument. Contact the factory for instructions on
how to return the instrument for authorized service and adjustment.
The SIM900 Mainframe is not intended for hot-swapping applications. Be certain to switch power to Standby before inserting or
ejecting modules in the mainframe. Do not connect a module to the
remote port while power is on.
iii
ivGeneral Information
SymbolDescription
Alternating current
Caution - risk of electric shock
Frame or chassis terminal
Caution - refer to accompanying documents
Earth (ground) terminal
Battery
Fuse
On (supply)
Off (supply)
Symbols you may Find on SRS Products
SIM900Mainframe
General Informationv
Notation
The following notation will be used throughout this manual:
• Front-panel indicators are set as Overload.
• Remote command names are set as *IDN?.
• Literal text other than command names is set as OFF.
Remote command examples will all be set in monospaced font. In
these examples, data sent by the host computer to the SIM900 are
set as straight teletype font, while responses received by the
host computer from the SIM900 are set as slanted teletype font.
Command terminators explicitly sent by the host computer are set
with the symbol “”.
SIM900Mainframe
viGeneral Information
Specifications
Performance Characteristics
Power SuppliesVoltages±15 VDC, ±5 VDC, +24 VDC
Regulation±0.5 % (±15 V, ±5 V)
±2 % (+24 V)
Current limits5 A max (+5 V)
3 A max (all others)
Power limit70 W total, all voltages
TimebaseInternal timebase10 MHz VCXO, ±10 ppm
External connectorRear panel BNC
External input10 MHz, 1 V to 5 V pp
Capture range±50 ppm (±500 Hz)
InterfacesSIM ports8 internal + 1 Remote
DB–15 (female)
Aux. RS-2322; DB–9 (male) DTE
Host interfaceRS-232; DB–9 (female) DCE
GPIB (optional)
EavesdropRS-232; DB–9 (female) DCE
Indicator LightsInterfaceRS-232, GPIB
OperatingTemperature0◦C to 40◦C, non-condensing
General Characteristics
TimebaseInternal, External Lock, External Fault
Activity8 slots, Remote SIM,
Aux A, Aux B,
Mainframe, Data Send,
Data Receive, Data Error
Startup ScriptEnabled
PowerOn, Standby, Overload, Trip
Power90 VAC to 260 VAC, 47 Hz to 63 Hz
150 W max
Weight12.6 lbs
Dimensions17.000W × 5.300H × 9.000D
Rack mountO900RM (optional)
SIM900Mainframe
1Operation
In This Chapter
This chapter describes the operation of the SIM900 Mainframe.
1.1Introduction to the Instrument . . . . . . . . . . . .1 – 2
The SIM900 Mainframe is the platform on which a SIM system is
assembled. The mainframe provides power, computer interfaces,
clock synchronization, and individual module status.
1.1.1Front Panel
The SIM900 front panel consists of a power switch and a collection
of indicator lamps (see Figures 1.1).
Figure 1.1: The SIM900.
Figure 1.2: The SIM900 rear panel (shown with a full complement of
SIM modules).
SIM900Mainframe
1.2Getting Started1 – 3
1.1.2Rear Panel
The SIM900 rear panel is shown in Figure 1.2. In addition to the
host interface connector(s) and power entry module, the rear panel
contains an external timebase reference input, auxiliary RS-232 interfaces, and a window for access to SIM module rear panels.
1.2Getting Started
The SIM architecture does not support hot insertion or extraction
of modules. Before installing or removing any SIM modules, the
mainframe power must be switched to “Standby.”
To install a module, align the back of the module with the black
guide-ramps in the mainframe slot. Ease the module in until the
connector begins to mate. Be careful to not apply pressure directly
on any module display; it is better to push along the upper part of
the edge of the module side covers until a positive “click” is heard.
At this time, the module will be fully mated and locked in place.
To remove a module, press firmly on the ejection button below the
module slot. When ejecting a double-wide module, the left-hand
button must be pressed to eject.
When the arrangement of desired SIM modules is installed, turn on
the mainframe power switch to begin operation.
SIM900Mainframe
1 – 4Operation
1.3Timebase
The SIM900 Mainframe provides a common 10 MHz clock reference
to the SIM modules. By synchronizing clocks, low-frequency mixing products (beat tones) of independently running module clocks
is avoided.A common timebase also allows precision time and
frequency modules to be synchronized.This feature can be enabled or disabled using the rear-panel configuration switches (see
section 1.4.3) or with the CLKD remote command.
In a laboratory employing multiple SIM900’s or where a highprecision clock reference is desired, this feature can be extended by
synchronizing the mainframe(s) to an external 10 MHz reference. An
auto-detect circuit senses the presence of an AC signal at the TIMEBASE IN connector on the rear panel, and attempts to phase-lock the
internal oscillator to the applied signal. The TIMEBASE block of the
SIM900 front panel (see Figure 1.3) indicates the clock status as one
of three states:
Internal 10 MHz :No signal is detected at the timebase input, and the SIM900
internal oscillator is being used.
External Lock :The SIM900 detected an external clock reference and success-
External Fault :An external clock signal was detected, but the SIM900 failed to
The phase-locked loop has a capture range of ±10 ppm (±100 Hz),
and should lock reliably with input signals of 1 V to 5 V peak-topeak amplitude.
1.4Configuration Switches
The rear panel DIP switches (see Figure 1.3) provide basic configuration of the SIM900 Mainframe host interface. The switches selecting
the remote interface are read only at power-up time, but may be
changed at any time.
1.4.1Baud Rate/GPIB Address
The rightmost five (5) switches program either the default baud rate
for the “COMPUTER” RS-232 port, or the GPIB address.
The RS-232 default baud rate can be set to 1200, 9600, 19.2k, 57.6k, or
115.2k. Select one rate by setting that switch in the down position; if
no switch is selected or more than one is down, the SIM900 defaults
to 9600 baud and Error lights for several secondsafter power-up. The
host baud rate can be changed after power-up under remote program
fully phase-locked to it.
phase-lock to it.
SIM900Mainframe
1.4Configuration Switches1 – 5
control (see the BAUD command), but will revert to the rear-panel
default after power cycling or a Device Clear (RS-232 hbreaki) signal.
For GPIB, the 5 switches set the binary-encoded bus address for the
SIM900. To add 2nto the address, set switch An in the lower position.
For example, to set the GPIB address to 19 (= 16 + 2 + 1) set switches
A0, A1, and A4 down (on).
1.4.2Host Select
The next switch to the left of the Rate/Address field (position # 3)
selects the mainframe host interface: up selects RS-232, down selects
the (optional) GPIB interface.
1.4.3Clock Distribution Enable
The next switch to theleft of the Host Select field(position #2) controls
the mainframe timebase distribution. When this switch is in the on
(down) position, the 10 MHz timebase is distributed to all 8 module
slots and the rear-panel Remote SIM port on pins 5 & 12. When the
switch is in the off (up) position, no clock signals are distributed, and
pins 5 & 12 on all SIM ports both idle at 0 V. In either case, all SIM
modules will continue to operate properly.
Figure 1.3: The SIM900 front and rear panels.
SIM900Mainframe
1 – 6Operation
Note that unlike the other DIP switch settings, the Clock Distribution
Enable switch is continuously monitored, and anychanges take effect
immediately (although they can be later overridden with the CLKD
remote command).
1.4.4Startup Script Enable
The SIM900 has a 4000 byte non-volatile memory to store a sequence of remotecommands to execute upon power-up (the “Startup
Script”). In order for a stored script to execute automatically after
power-up, the left-most switch must be in the on (down) position.
When the script is enabled and executed, the front-panel indicator
flashes and then remains lit.
See section 2.5.8 for the remote commands to configure the startup
script.
1.5Activity Monitors
The ACTIVITY section of the front panel monitors data transfer to
and from the mainframe. When bytes are received from any port,
the corresponding port indicator (1–8, Remote SIM, Aux A (RS-232)
or Aux B (RS-232)) flashes together with From SIM. When the mainframe transmits data to the host interface, Mainframe and From SIM
both flash as well.
When data is received at the mainframe host interface or transmitted
to one of the ports, To SIM flashes, along with the corresponding
port indicator.
If a communication error is encountered, Error will flash briefly.
1.6SIM Interface Connector
The DB–15 SIM Interface connector carries all the power and communications lines between the mainframe and SIM modules. The
module-side of the interface is DB–15 male (plug), while the mainframe side is DB–15 female (socket). The connector signals are specified in Table 1.1
Note that all SIM modules are specified to operate with or without
the presence of the ±REF 10MHZ signals, so these lines are optional
in any cabling interface between the mainframe REMOTE SIM port
and a module.
pPort number
i,jIntegers
zLiteral token
bMulti-byte (string) block
(?)Required for queries; illegal for set commands
varParameter always required
{var}Required parameter for set commands; illegal for queries
[var]Optional parameter for both set and query forms
Communications
CONN p,b2 – 15 Connect to Port
SEND p,b [,i]2 – 15 Send Message to Port
SNDT p,b [,i]2 – 15 Send Terminated Message to Port
ECHO? b2 – 16 Echo Message back to Host
BRDC b [,i]2 – 16 Broadcast Message to Ports
BRDT b [,i]2 – 16 Broadcast Terminated Message to Ports
GETN? p,i2 – 16 Get Bytes from Port
RAWN? p,i2 – 17 Get Raw Bytes from Port
PARI(?) p {,z}2 – 24 Parity
PDPE(?) [p,] {i}2 – 28 Port Data Pending Enable
SIM900Mainframe
2.2Alphabetic List of Commands2 – 7
PDPR? [p]2 – 28 Port Data Pending
PLLC(?) {z}2 – 32 Timebase Control
PMON?2 – 33 Primary Power
PRTC(?) {z}2 – 22 Port C Function
PRTD(?) {z}2 – 23 Port D Function
R
RAWN? p,i2 – 17 Get Raw Bytes from Port
RDDR(?) [p,] {i}2 – 19 Receive Data Disable
REQF(?) {z}2 – 39 Announce REQF
REQT(?) {z}2 – 38 Announce REQT
RNSS2 – 30 Run Script
RPER(?) [p,] {i}2 – 19 Receive Pass-Through Enable
S
SBIT(?) p {,i}2 – 24 Stop Bits
SEND p,b [,i]2 – 15 Send Message to Port
SNDT p,b [,i]2 – 15 Send Terminated Message to Port
SRST [p]2 – 35 SIM Reset
SSCR? [p]2 – 25 SIM Status Condition
SSEN(?) [p,] {i}2 – 25 SIM Status Enable
SSEV? [p]2 – 25 SIM Status Event
SSNT(?) [p,] {i}2 – 25 SIM Status Negative Transition
SSPT(?) [p,] {i}2 – 25 SIM Status Positive Transition
VERB(?) [i],{j}2 – 21 Verbosity
VLOC?2 – 33 Timebase Status Analog
VMON?2 – 33 Primary Voltage
VTBI?2 – 31 Timebase Input Analog
VVCO?2 – 33 Timebase VCO
SIM900Mainframe
2 – 8Remote Programming
W
WAIT i2 – 38 Wait
WORD(?) p {,i}2 – 24 Word Length
SIM900Mainframe
2.3Introduction2 – 9
2.3Introduction
The SIM900 Mainframe provides fully buffered multiplexed communications between the host computer and up to 9 SIM modules plus
2 (optionally as many as 4) external RS-232 devices. These SIM/RS232 connections are generically called Ports here, and each port has
a dedicated UART (universal asynchronous receiver & transmitter)
with hardware input and output FIFO buffers. The host computer
(typically a PC) communicates with the mainframe through the host
interface, which can be either RS-232 or (optionally) GPIB. The active
interface is selected with rear-panel DIP switches at power-on.
No protocol requirements are placed on the communications across
the ports—any sequence of bytes can be transmitted to or received
from any port. Simultaneous ongoing communications with multiple ports can be maintained using a packet-message style of com-
mand (see SEND, BRDC, GETN?, RPER commands below). Simple host-to-port communications are provided with the CONN com-
mand.
2.3.1Device Clear
2.3.2Queues and buffers
If the host interface is GPIB, the IEEE–488 DCL (Device Clear) or SDC
(Selected Device Clear) interface messages will cause the mainframe
to flush the host input buffer and output queue, and reset the parser
to the idle state.
If the host interface is RS-232, the same action is initiated by theRS-232 hbreaki
RS-232 hbreaki signal (space level (0) for at least one full character
frame). This single “out-of-band” signal allows the host to reset the
mainframe interface to a known state, independent of the current
operating mode.
In particular, a Device Clear event (either from DCL, SDC, or RS232 hbreaki) will cause the mainframe to abandon an active connect
session (see CONN command).
Each port is separately buffered with a port input buffer and port
output queue, while the host interface is buffered with the host input
buffer and host output queue. All queues and buffers are 512 bytes
deep.
Data is initially received from the host interface into the host input
buffer. If the mainframe is not currently in connect mode, then bytes
from the host input buffer are read by the parser until a valid command is found. Command Errors detected by the parser are reported
SIM900Mainframe
2 – 10Remote Programming
through the CME flag in the ESR register. Mainframe-directed commands and queries are then handled directly, and responses (if any)
transferred to the host output queue for the host computer to read.
2.4Port Communications
2.4.1Message-based communication
Port-directed messages SEND,SNDT and BRDC,BRDT are parsed
for syntax, and then given to the Message Handler for delivery. The
message payload is stripped out of the command, and copied to
the appropriate port output queue(s) for delivery. If the port output queue is full (because the SIM or external RS-232 device has
asserted flow control, or simply because of data rate mismatch), the
mainframe will wait up to TMOT milliseconds until there is suffi-
cient room in the port output queue for the data. In the meantime,
commands and queries from the host will simply accumulate in the
input buffer until that fills as well. At that point, flow control on
the host interface should hold off any further transmissions from the
host until the buffers clear up.
Data received from the ports is initially stored in the corresponding
port input buffer. If the corresponding bit in the ReceivePass-through
Enable Register (RPER) is set and there is sufficient room in the
host output queue, then the data is wrapped into a MSG unit and
transferred to the output queue for delivery to the host. If the output
queue was too full, the message will be sent as soon as sufficient
space becomes available. If the corresponding bit in RPER is clear,
then the corresponding bit in the Port Data Pending Register (PDPR)
is set.
2.4.2Connection-based communication
If the mainframe is connected to a port via the CONN command, the
situation is somewhat different. Bytes received from the host accumulate in the input buffer, where they are scanned for matching the
escape string provided with CONN. Non-matching bytes are directly
transferred to the port output queue. A partial match is held off
until an unambiguous complete match or non-match is present. On
a successful complete match, the connect mode is terminated and the
mainframe is ready for new commands.
Concurrently, bytes received in the port input buffer are transferred
directly to the host output queue. Data received at the unconnected
ports will be held in their port input buffers (causing the corresponding bit(s) in the PDPR to be set).
SIM900Mainframe
2.4Port Communications2 – 11
2.4.3Port map
The SIM900 Mainframe ports are defined in the following table:
PortTypeDescription
1SIMSlot 1 SIM port
2SIMSlot 2 SIM port
3SIMSlot 3 SIM port
4SIMSlot 4 SIM port
5SIMSlot 5 SIM port
6SIMSlot 6 SIM port
7SIMSlot 7 SIM port
8SIMSlot 8 SIM port
9SIMRemote SIM port (DB-15-F back panel connector)
ARS-232Aux–1 DTE (DB–9/M back panel connector)
BRS-232Aux–2 DTE (DB–9/M back panel connector)
CRS-232Eavesdrop DCE (DB–9/F back panel connector)
DRS-232COMM DCE (DB–9/F back panel connector)
Ports 1 through B are always available as user ports, with A & B
as generic RS-232 ports. After power-on, ports 1–B default to 9600
baud, 8-bits, no parity, and 1 stop bit.
Port C (Eavesdrop) is normally dedicated to monitoring communications between the mainframe and host, but can be remapped as
an additional general purpose port with the PRTC command. At
power-on, this port defaults to 9600/8/N/1. Baud rate, parity, word
size, and stop bits can be reconfigured by command after poweron, regardless of whether Port C is used for eavesdrop or general
communications.
Port D (COMM) is normally dedicated as the RS-232 interface to
the host computer. At power-on, this port defaults to the baud rate
selected by the rear-panel DIP switches, or 9600 if the DIP settings are
invalid (8/N/1). If RS-232 is NOT the active host interface, then Port D
is normally inactive, but can be remapped as an additional general
purpose port with the PRTD command. Baud rate, parity, word
size, and stop bits can be reconfigured by command after power-on,
regardless of whether Port D is used for the host interface or general
communications.
When Port C or D are not reconfigured for general port communications, the corresponding PC and/or PD bits in the RPER, BER, and
PDPR registers are undefined; they can be written or read, but will
have no effect.
SIM900Mainframe
2 – 12Remote Programming
2.5Commands
All commands for the SIM900 Mainframe originate at the host computer1, and are sent to the mainframe via the host interface. The
commands are organized according to functional groups, beginning
with commands that directly control communications with the SIM
modules. Other groups of commands configure the mainframe communications hardware, status reporting mechanism, startup script,
internal housekeeping, and host interface.
2.5.1Command syntax
All command names are 4-characters long and are case-insensitive.
IEEE–488.2 defined commands begin with the “*” character followed
by 3 letters, while SIM900-specific commands are composed of 4
letters.
The four letter mnemonic (shown in CAPS) in each command se-
quence specifies the command. The rest of the sequence consists of
parameters.
Commands may take either set or query form, depending on whether
the “?” character follows the mnemonic. Set only commands are
listed without the “?”, query only commands show the “?” after the
mnemonic, and optionally query commands are marked with a “(?)”.
Parameters shown in { } and [ ] are not always required. Parameters in
{ } are required to set a value, and are omitted for queries. Parameters
in [ ] are optional in both set and query commands. Parameters listed
without any surrounding characters are always required.
Do not send ( ) or { } or [ ] as part of the command.
The command buffer is limited to 255 bytes, with multi-byte block parameter bytes separately stored in an independent 255 byte buffer—
any command that exceeds this size will generate a command error
and be discarded.
If the host interface is RS-232, commands are terminated by either
hCRi (ASCII 13) or hLFi (ASCII 10) characters that are outside any
protected binary block or string. If the host interface is GPIB, then
commands are terminated by either hLFi or hEOIi or hLF-EOIi. Execution of the command does not begin until the command terminator
is received.
Unlike most SIM modules, nomulti-command messages(i.e., “;” separated
commands) are allowed for the SIM900.
1
or from the startup script
SIM900Mainframe
2.5Commands2 – 13
The following table summarizes the notation used in the command
descriptions:
symboldefinition
pPort number (1–9, a–d, A–D, but see below)
i,jIntegers
zLiteral token
bMulti-byte (string) block
(?)Required for queries; illegal for set commands
varparameter always required
{var}required parameter for set commands; illegal for queries
[var]optional parameter for both set and query forms
2.5.1.1Ports
Port parameters can be given as either simple decimal integers, or a
single-letter hexadecimal value (without any leading 0x).
Many of the commands to set/query a register accept an optional
port parameter. In these cases, if the optional parameter p is given,
then the command only sets/queries the single bit corresponding to
the binary weight 2p. Typically, this bit represents Port p, but in a
few cases additional flag bits are packed into the register. For these
additional flag bits, the optional p still restricts the command to the
single bit, but it no longer corresponds to a port. Thus, it is possible
in these cases for p to be E, despite the maximum port value of D.
2.5.1.2Integers
2.5.1.3Tokens
SIM900Mainframe
Integer parameters follow “C-language” style. Simple decimal integers are indicated by beginning with a non-zero digit (1–9). Octal
integers are represented with a leading zero digit (0). Hexadecimal
integers are given by a leading 0x or 0X.
For example, 26, 032, 0x1A all refer to the integer value 26.
Tokens are listed here as word–integer pairs, such as AUTO 2. For
set commands, token parameters must either be the exact text word
indicated (case-insensitive), or the corresponding decimal integer
code.For example, to set the response termination sequence to
hCRi+hLFi, the following two commands are equivalent:
TERM CRLF—or—TERM 3
2 – 14Remote Programming
For queries that return token values, the return format (keyword or
integer) is specified with the TOKN command.
2.5.1.4Blocks
Multi-byte block parameters can follow one of 3 formats (4 on GPIB).
Quote-delimited strings :An arbitrary byte sequence bounded by either " or ’ charac-
ters. All characters (including control characters) are allowed.
The quoting character itself (either " or ’) can be included by
escaping with an additional quote. For example,
"It is a ""good"" quote"
is identical to
’It is a "good" quote’.
Hex-formatted binary :#Hxx xx xx, where xx are hexadecimal bytes (00 through ff).
Whitespace is ignored.
Definite-length arb. :#abbbrrrr, where a is a single non-zero digit equal to the digit
count in bbb, bbb is a decimal integer count of the number of
data bytes to follow, and rrrr are the raw data bytes.
Indefinite-length arb. :#0rrrrhLF-EOIi, where rrrr is the raw data block, and
2.5.2Examples
hLF-EOIi is the newline character (ASCII 10) with the GPIB-EOI
line simultaneously asserted. (only on GPIB)
Each command is provided with a simple example illustrating its
usage.In these examples, all data sent by the host computer to
the SIM900 are set as straight teletype font, while responses
received the host computer from the SIM900 are set as slantedteletype font. Command terminators explicitly sent by the host
computer are set with the symbol “”.
The usage examples vary with respect to set/query, optional parameters, and block parameter formats. These examples are not exhaustive, but are intended to provide a convenient starting point for user
programming.
SIM900Mainframe
2.5Commands2 – 15
2.5.3Communication commands
These commands provide the actual communication, through the
SIM900 mainframe, between the host computer and the SIM modules
or external RS-232 devices. Stream-style communications is provided
with the CONN command, while packet messaging is supported
with the remainder of the commands in this section.
Connect to PortCONN p,b
The CONN command establishes a stream-style connection to Port p,
with escape string b.
Executing the CONN command automatically clears the RPER regis-
ter.
In the following, a SIM910 preamp is installed in slot 4 of the SIM900.Example:
CONN 4,"xyz"
IDN?
Stanford Research Systems,SIM910,s/n510998,ver1.0
xyz*IDN?
Stanford Research Systems,SIM900,s/n938272,ver3.4
Send Message to PortSEND p,b [,i]
The SEND command transfers the message b to Port p. If present, i
contains a checksum for b.
The optional checksum is calculated as the unsigned integer sum of
the ASCII value of each byte in b (excluding wrapping characters
such as #H).
SEND 4,"GAIN 10"Example:
Notice the(either hCRi or hLFi) before the closing quote mark;
this is the command terminator for the destination SIM instrument
located at slot 4. See SNDT(below) to have the SIM900 automatically
append the command terminator to outgoing messages to ports.
Send Terminated Message to PortSNDT p,b [,i]
The SNDTcommand transfers the message b followed by the htermi
sequence to Port p. If present, i contains the checksum value for b
(see SEND).
See the TERM command for more about the htermi sequence.
SNDT 4,"GAIN 10"Example:
SIM900Mainframe
2 – 16Remote Programming
Echo Message back to HostECHO? b
The ECHO command transfers the message b+htermi back to the
host output queue.
Note this command does not control character echoing back to a
console terminal; see the CONS (console) command.
ECHO? "Hello ""world."""Example:
Hello "world."
Broadcast Message to PortsBRDC b [,i]
The BRDC command transfers the message b to multiple ports. If
present, i is the checksum on b .
BRDCacts just like SEND, except instead of indicating a specific port
in the command, all ports enabled in the BRER register receive a copy
of the message b.
BRDC "*RST"Example:
Broadcast Terminated Message to PortsBRDT b [,i]
The BRDT command transfers the message b+htermi to multiple
ports. If present, i is the checksum on b.
BRDT #14*RSTExample:
Note the use of a definite-length arbitrary block (see section 2.5.1.4).
Get Bytes from PortGETN? p,i
The GETN command retrieves up to i bytes from Port p and transfers
them to the host output queue.
Data is formatted as a definite-length arbitrary block, #3aaabbbbbb,
where aaa = number of bytes actually retrieved from Port p. Response message may be up to 7 bytes longer than i, for the #3aaa
header + htermi.
SNDT 7,"GAIN?"Example:
GETN? 7,80
#300410
where the query response from Port 7 was “10”, and the response
terminatorwas the two character sequence hCRi+hLFi.
SIM900Mainframe
2.5Commands2 – 17
Get Raw Bytes from PortRAWN? p,i
The RAWNcommand retrieves exactly i bytes from Port p and trans-
fers them to the host output queue.
No header or htermi characters are added. If fewer than i bytes are
available, no bytes are transferred and the EXE flag is set within the
ESR register.
SNDT 7,"GAIN?"Example:
RAWN? 7,2
10
2.5.4Configuration commands
The first five Configuration commands query the current state of
the port I/O buffers, while the remaining commands are used to set
or query registers and other parameters controlling communications
with the SIMs.
See the Register Model section for more about the mainframe registers.
Input Bytes WaitingNINP? p
Query bytes waiting in Port p input buffer.Returns the integer
number of bytes waiting to be read by the host.
NINP? 4Example:
30
Output Bytes WaitingNOUT? p
Query bytes waiting in Port p output queue. Returns the integer
number of bytes waiting to be transmitted to the SIM or RS-232
device.
NOUT? 4Example:
0
SIM900Mainframe
2 – 18Remote Programming
Input Spaces AvailableAINP? p
Query spaces available in Port p input buffer. Returns the integer
number of additional bytes that can be written by the host before
overflowing the port input buffer.
AINP? 4Example:
482
Output Spaces AvailableAOUT? p
Query spaces available in Port p output queue. Returns the integer
number of additional bytes that can be written by the SIM or RS-232
device before overflowing the port output queue.
AINP? 4Example:
512
Transmit CompleteDONE? [p]
DONE? returns 1 if there are no bytes remaining to be transferred,
and 0 if any bytes remain in either port output buffers or in the UART
output FIFO buffers.
If p is given, only the buffers for Port p are checked; otherwise all
port buffers are checked.
DONE?Example:
1
Broadcast EnableBRER(?) [p,] {i}
Set (query) the Broadcast Enable Register [Port p bit] {to i}. The Broadcast Enable Register (BER) selects which ports will receive broadcast
messages via the BRDC and BRDT commands. If p is given, only
the bit corresponding to Port p is set (queried); otherwise the entire
register is indicated.
BRER 4,1Example:
BRER 5,1
BRER 7,1
BRER?
176
SIM900Mainframe
2.5Commands2 – 19
Receive Data DisableRDDR(?) [p,] {i}
Set (query) the Receive Data Disable Register [Port p bit] {to i}. Bits
within the Receive Data Disable Register (RDDR) are used to inhibit
the serial receiver circuitry for the corresponding ports. If p is given,
only the bit corresponding to Port p is set (queried); otherwise the
entire register is indicated.
RDDR 6Example:
disables Ports 1 & 2 (binary weights 21+ 22= 6).
Receive Pass-Through EnableRPER(?) [p,] {i}
Set (query) Receive Pass-Through Enable Register [Port p bit] {to
i}. Bits within the Receive Pass-Through Enable Register (RPER) are
used to enable spontaneous delivery of port data messages to the host
output queue as MSG packets. If p is given, only the bit corresponding
to Port p is set (queried); otherwise the entire register is indicated.
RPER 510Example:
enables Ports 1–8 for Pass-Through.
Maximum MSG LengthMSGL(?) {i}
Set (query) the maximum overall MSG length to i bytes. The data
portion of MSG packets will have 10 or 11 fewer bytes than the
maximum data block length i, corresponding to the characters MSGp,#2yy or MSG p,#3yyy that precede the data block. The command
terminator (either hCRihLFi or hLF-EOIi) is not included in i.
After reset, the default is MSGL 64. The maximum value is 128.
MSGL 128Example:
TimeoutTMOT(?) p,{i}
Set (query) the timeout value for Port p {to i milliseconds}. If TMOT
is non-zero, the mainframe will wait up to i milliseconds while attempting to transfer output to a port output queue that is full (either
due to flow control or simple transfer-rate mismatch). If the timeout
expires before the mainframe is able to transfer the message, an error
is recorded in the Timeout Status Register (TOSR).
If TMOT p,0, the timeout feature is disabled for Port p, and the
mainframe will wait indefinitely on a full output queue.
SIM900Mainframe
After reset, the default is TMOT1000 (1 s) for all ports.
TMOT 4,500Example:
2 – 20Remote Programming
Message TerminationTERM(?) p,{z}
Set (query) the htermi sequence for Port p {to z=CR 0, LF 1, CRLF 2,
LFCR 3, NONE 4}.
The htermi sequence is appended to port messages sent with the
SNDT or BRDT commands, and is constructed of ASCII charac-
ter(s) 13 (carriage return) and 10 (line feed). The token mnemonic
gives the sequence of characters. When the host interface is RS-232,
then TERM D (the host port) also determines the termination for
all mainframe-generated query responses (for GPIB host interface,
query responses always terminate in hLF-EOIi).
At power-on, ports default to TERM p,LF. After *RST, ports are reset
to TERM p,CR. When the host interface is RS-232, Port D defaults to
TERM D,CRLF both at power-on and *RST.
TERM 4,LFExample:
Generate EOI on hLFiCEOI(?) {z}
Set (query) the connect-mode EOI-on-hLFi {to z=(OFF 0, ON 1)}.
CEOIcontrols whether the hEOIi signal is generated on the GPIB host
interface whenever a hLFi character is received from a port during
connect mode. This command has no effect when the host interface
is RS-232. Set z to ON to enable hEOIi generation.
After reset, the default is CEOI ON.
†
CEOI ONExample:
EOI conversion during CONNectEOIX(?) {z}
Set (query) the EOI-conversion-mode {to z=(OFF 0, ON 1)}.
In connect mode, EOIX controls whether the receipt of the hEOIi
signal from the GPIB host interface causes a new hLFi character to
transmitted to the connected port. This command has no effect when
the host interface is RS-232. Set z to ON to enable hLFi generation.
After reset, the default is EOIX ON.
†
EOIX OFFExample:
†
This default setting changed with firmware revision 3 (February 2005).
SIM900Mainframe
2.5Commands2 – 21
2.5.5Eavesdropping commands
By default, Port C is an eavesdropping monitor port. This port can
be configured to provide real-time monitoring of communications
and internal state changes in the SIM900 Mainframe, and is intended
to help users build and debug their SIM applications.
VerbosityVERB(?) [i],{j}
Set (query) the eavesdropping verbosity control [bit i] {to j}.
The verbosity control is an 8-bit register providing on/off control of
separate eavesdropping monitor functions. The bit definitions are:
WeightBitFlag
10MFERRORS
21LONGERRS
42IOMON
83MFMON
164STATMON
325FROMHOST
646TOHOST
1287RTMON
MFERRORS :Error conditions in the mainframe will be reported.
LONGERRS :The long-form (English text) of error messages will be used.
This flag is only functional if MFERRORS is also set.
IOMON :I/O status messages (device-clear, buffer overrun, . . . ) will be
reported.
MFMON :Internal state changes in the mainframe (such as timebase set-
tings) will be reported. Also, if MFMON is set, any bytes sentto Port C will be interpreted as though sent by the mainframe,
and processed as remote commands.
STATMON :Any (enabled) status register changes will be reported.
FROMHOST :All data received by the mainframe from the host interface is
echoed to Port C.
TOHOST :All data sent by the mainframe to the host interface is echoed
to Port C.
RTMON :A summary message of mainframe housekeeping data is re-
ported once a second. The message is formatted as:
<vtbi=#, vloc=#, vvoc=#; vmon=#, imon=#>
where the value of each field corresponds with the query com-
mand of the same name (i.e., see VTBI?, VLOC?, . . . ).
SIM900Mainframe
2 – 22Remote Programming
After reset, the default is VERB 5 (MFERRORS and IOMON).
VERB 127Example:
Echo Message to EavesdropEAVS b
Send message b to the eavesdrop port.
EAVS "This text will appear on the Eavesdrop port"Example:
Identify to EavesdropEIDN
Send the identify message (see *IDN) to the eavesdrop port.
EIDNExample:
2.5.6Serial commands
The Serial commands control the configuration of the serial port
hardware in the SIM900 Mainframe, such as baud rate and parity.
Optional re-mapping of Port C and Port D is also provided with the
PRTC and PRTDcommands.
Port C FunctionPRTC(?) {z}
Set (query) Port C function {to z=(EAVS 0, PORT 1)}.
Ordinarily, Port C is dedicated to eavesdropping on communications
with the host computer. Using PRTC, it is possible to override this
function and make Port C available as a general purpose RS-232 port.
WithPRTCPORT, general communications with Port C are performed
using CONN, SEND, BRDC, etc., just as with other ports.
Set z to EAVS (0) for the default eavesdropping function, or PORT (1)
for the general purpose port.
After reset, the default is PRTC EAVS.
PRTC?Example:
EAVS
SIM900Mainframe
2.5Commands2 – 23
Port D FunctionPRTD(?) {z}
Set (query) Port D function {to z=(COMM 0, PORT 1)}.
Ordinarily, Port D is dedicated to communications with the host
computer (when configured for host RS-232). If the host interface is
GPIB, Port D is normally idle. Using the PRTD command with the
GPIB interface, it is possible to make Port D available as a general
purpose RS-232 port.
Set z to COMM 0 for the default host function, or PORT 1 for the general
purpose port. Note that PRTD PORT will generate an execution error
if the host interface is RS-232.
After reset, the default is PRTD COMM.
PRTD PORTExample:
Baud RateBAUD(?) p {,i}
Set (query) Port p baud rate {to i}.
At power-on, all baud rates default to 9600. The minimum baud rate
for all ports is 110 baud. For Ports 1–9 (SIM ports), rates can be set
to standard values through 38 400; above that, most modules can be
set to the following (non-standard) rates: 62 500, 78 125, 104 167, and
156 250. For Ports A–D (RS-232 ports), high-speed standard rates of
57 600, 115 200, 230 400, and 460 800 are all available.
Changing baud rate must be carefully orchestrated to ensure proper
connectivity throughout the transaction.
Query external Timebase Input detection circuit voltage, in millivolts. The detection circuit is a non-linear AC-detector, see plot for
the typical response versus 10 MHz input amplitude. Note that the
threshold for automatic detection is VTBI=2000 (see TBIN?, above).
SIM900Mainframe
VTBI?Example:
390
2 – 32Remote Programming
Timebase ControlPLLC(?) {z}
Set (query) Timebase PLL Control {to z=(OFF 0, ON 1, AUTO 2)}.
When PLLC AUTO is set, the SIM900 Mainframe will automatically activate the timebase phase-locked loop (PLL) whenever TBIN? TRUE.
To force the PLL to remain either off (free-running clock) or on (al-
ways attempting to lock), set PLLC appropriately.
PLLC?Example:
AUTO
Clock DistributionCLKD(?) {z}
Set (query) the Clock Distribution mode {to z=(OFF 0, ON 1}.
When CLKD ON is set, the SIM900 Mainframe will distribute the
10 MHz timebase signals to all SIM ports (on pins 5 & 12 of the DB–
15 SIM Interface connector. When CLKDOFF, the timebase signals are
turned off, and clock pins idle at 0 V (note, however, that the internal
oscillators in the SIM modules will continue to operate normally).
At reset, the value of CLKD is determined by the rear panel DIP
setting. Subsequent CLKD set commands will override the rear panel
setting. Any changes to the rearpanel setting, however, will takeeffect
immediately.
CLDK OFFExample:
Timebase StatusLOCK?
Query Timebase status token value (FREE 0, LOCKING 1, LOCKED 2,
FAULT 3).
While the PLL is off, LOCK? returns FREE. For 50 ms after activating the PLL, LOCK? will return LOCKING; after that, either LOCKED or
FAULT is returned, indicating whether the loop is successfully tracking the external timebase input.
LOCK?Example:
FREE
SIM900Mainframe
2.5Commands2 – 33
Timebase Status AnalogVLOC?
Query lock detector voltage, in millivolts. When VLOC?≥4000, the
PLL is locked (see LOCK?, above).
VLOC?Example:
940
Timebase VCOVVCO?
Query the VCO control voltage, in millivolts.
VVCO?Example:
4490
Primary VoltageVMON?
Query the SIM900 Mainframe primary power supply voltage, in
millivolts (nominally 24000).
VMON?Example:
23740
Primary CurrentIMON?
Query the SIM900 Mainframe primary power supply current, in
milliamps.
IMON?Example:
430
Primary PowerPMON?
Query the SIM900 Mainframe primary power supply power, in mil-
liwatts. Equal to (VMON?)×(IMON?)/1000.
PMON?Example:
10683
SIM900Mainframe
2 – 34Remote Programming
UndervoltageUNDV?
Query output undervoltage detect.
While an output undervoltage condition exists, UNDV? returns
1; otherwise it returns 0.An undervoltage occurs if any of the
SIM900 Mainframe output voltages droop below their nominal
value, indicating an overload.
UNDV?Example:
0
Elapsed TimeTICK?
Query time elapsed since power-on (each count is 50 ms). The maximum value before wrap-around is 4 294 967 295 (about 6.8 years).
TICK?Example:
114888
2.5.10Interface commands
DIP SwitchDIPS? [i]
Query rear panel dip switch [bit i] value.
DIPS?Example:
64
The interface commands include required IEEE–488.2 common commands, along with additional commands for configuring the interface between the SIM900 Mainframe and the host computer. Additionally, commands for flushing the port input buffers and output
queues are also provided.
SIM900Mainframe
2.5Commands2 – 35
Reset*RST
Reset the mainframe to default configuration.
The following register and command values are established imme-
diately following a *RST:
cmdvalue
BRER0
RDDR0
RPER0
†
TERM
TMOT
MSGL64
CEOI1 ON
EOIX1 ON
PRTC0 EAVS
PRTD0 COMM
PLLC2 AUTO
CLKDdetermined by rear-panel setting
CONS0 OFF
VERB5(MFERRORS and IOMON)
TOKN0 OFF
LKSS1 ON
REQT0 OFF
REQF0 OFF
0
†
1000
†
TERM and TMOT are reset for all ports
*RSTExample:
Flush Output QueueFLOQ
Flush the host output queue.
FLOQExample:
SIM ResetSRST [p]
Sends the SIM Reset signal [to Port p] (default is all SIM ports).
SRST causes a hbreaki signal (MARK level) to be asserted for 100
milliseconds, either to Port p or to all SIM ports. Upon receiving the
hbreaki signal, any connected SIM will flush its internal input buffer,
reset its command parser, and default to 9600 baud communications.
SRSTExample:
SIM900Mainframe
2 – 36Remote Programming
Flush Port Input BuffersFLSI [p]
Flushes port input buffers [associated with Port p].
FLSI 4Example:
Flush Port Output QueuesFLSO [p]
Flushes port output queues [associated with Port p].
FLSO 4Example:
Flush Port BuffersFLSH [p]
Flushes port input buffers & output queues [associated with Port p].
FLSHExample:
Identify*IDN?
Read the mainframe device identification string.
The identification string is formatted as:
Stanford Research Systems,SIM900,s/n******,ver#.#
where ****** is the 6-digit serial number, and #.# is the firmware
revision level.
Reads the serial poll Status Byte register [bit i].
*STB?Example:
16
Service Request Enable*SRE(?) [i,] {j}
Set (query) the Service Request Enable register [bit i] {to j}.
*SRE 0,1Example:
SRE?
1
Standard Event Status*ESR? [i]
Reads the Standard Event Status Register [bit i].
Upon executing *ESR?, the returned bit(s) of the ESR register are
cleared.
*ESR?Example:
32
Standard Event Status Enable*ESE(?) [i,] {j}
Set (query) the Standard Event Status Enable Register [bit i] {to j}.
*ESE 32Example:
Power-on Status Clear*PSC(?) {i}
Set (query) the Power-on Status Clear flag {to j}. The Power-on Status
Clear flag is stored in non-volatile memory in the SIM900 Mainframe,
and thus maintains its value through power-cycle events.
If the *PSC=0, then the Service Request Enable and Standard Event
Status Enable registers (*SRE, *ESE) retain their values through
power-cycles. If *PSC=1, then *SRE and *ESE are cleared upon
power-cycle.
The initial factory default is *PSC 1.
*PSC?Example:
1
SIM900Mainframe
2 – 38Remote Programming
Operation Complete*OPC(?)
Operation Complete. Sets the OPC flag in the ESR register.
The query form *OPC?writesa 1 in theoutput queuewhen complete,
but does not affect the ESR register.
*OPC?Example:
1
Wait to Continue*WAI
Wait to Continue. Equivalent to a no-op.
*WAIExample:
Console ModeCONS(?) {z}
Set (query) the host port Console mode {to z=(OFF 0, ON 1)}.
CONS only has an effect when host interface is RS-232, and causes
each character received at the host input buffer to be copied to the
host output queue.
After reset, the default is CONS OFF.
CONS?Example:
OFF
WaitWAIT i
Wait i milliseconds before processing more commands from the host.
This command can be especially useful programming the Startup
Script.
WAIT 1000Example:
Announce REQTREQT(?) {z}
Set (query) the REQT announce mode {to z=(OFF 0, ON 1)}.
When REQT ON is set, any event which causes a new service re-
quest condition will cause the characters <reqt>+htermi to be spontaneously written to the host output buffer.
On reset, the default is REQT OFF.
SIM900Mainframe
2.5Commands2 – 39
REQT?Example:
OFF
Announce REQFREQF(?) {z}
Set (query) the REQF announce mode {to z=(OFF 0, ON 1)}.
When REQF ON is set, any event which causes the Master Sum-
mary Status message to become false will cause the characters
<reqf>+htermi to be spontaneously written to the host output buffer.
After reset, the default is REQF OFF.
REQF?Example:
OFF
Execution ErrorLEXE?
Query the last Execution Error code. Valid codes are:
ValueDefinition
0No execution error since power-on
1Invalid port
2Invalid token
3Command failed
4Timeout
5Invalid bit
6Invalid value
7Checksum failed
8Invalid host interface
SIM900Mainframe
*STB? 12Example:
LEXE?
5
The error code (5) corresponds to “Invalid bit,” since *STB? only
allows bit-specific queries of 0–7.
2 – 40Remote Programming
Command ErrorLCME?
Query the last Command Error code. Valid codes are:
ValueDefinition
0No parser error since power-on
1Illegal first character
2Illegal name
3Undefined command
4Extra questio mark
5No query allowed
6Only query allowed
7Missing parameter(s)
8No parameters allowed
9Premature command terminator
10Message buffer overflow
11Illegal half-byte in hex parameter
12Command buffer overflow
13Illegal extra string parameter
14Illegal extra hex parameter
15Illegal extra binary parameter
16Illegal byte-digits count
17Illegal bytes count
18Null parameter
19Extra parameter(s)
20Illegal port
21Illegal short integer
22Illegal long integer
23Illegal token integer
24Unknown token
25Illegal string parameter
26Illegal hex parameter
27Illegal binary parameter
28hEOIi without hLFi on indef. arb. block
*IDNExample:
LCME?
6
The error (6, “Only query allowed”) is due to the missing “?”.
Token ModeTOKN(?) {z}
Set (query) the Token Query mode {to z=(OFF 0, ON 1)}.
If TOKN ON is set, then queries to the SIM900 mainframe that return
tokens will return the text keyword; otherwise they will return the
decimal integer value.
After reset, the default is TOKNOFF.
TOKN ONExample:
SIM900Mainframe
2.6Register Model2 – 41
2.6Register Model
Registers in the SIM900 Mainframe are divided into 2 broad categories: control registers and status registers. Control registers govern the operation of the mainframe (specifically, controlling the automatic routing of port data), while status registers (and their associated configuration registers) govern the monitoring and reporting
of status conditions within the mainframe.
The registers are represented as either 8-bit or 16-bit unsigned integer
values. Individual flags within a register correspond to an integer
weight of 2n. Most commands for setting or reading the registers
have an optional parameter to select a single bit within the register.
Using this optional parameter, all flag values are either 0 or 1. In
the default (whole-register) form, the commands treat the register
as a single integer value by summing the weighted values of the
individual flags.
2.6.1Control registers
2.6.1.1Receive Data Disable (RDDR)
This is a 16-bit wide register that controls transfers of data from the
ports to the port input buffers.
If the bit corresponding to a particular port is set in the RDDR,
and data from that port arrives at the mainframe, it is immediately
discarded. If the corresponding bit is cleared, then data flows as
normal from the port hardware into the port input buffer.
SIM900Mainframe
If a bit is set in RDDR while data is already in the corresponding
port input buffer, that data remains available to the host computer,
2 – 42Remote Programming
but no further data from the port will be accepted until the RDDR
bit is cleared. No flow control signals are asserted to stop the port from
transmitting data.
At power-on, this register is cleared.
2.6.1.2Receive Pass-Through Enable (RPER)
This is a 16-bit wide register that controls transfers of data from the
ports to the mainframe output queue.
If the bit corresponding to a particular port is set in the RPER when
data from that port arrives at the mainframe, it is immediately encapsulated into MSG packet(s) by the mainframe and transferred to
the output queue without further host intervention (i. e., no query
command is needed).
Messages are formatted as: MSG p,b
where p is the port the message came from, and b is a definite-length
arbitrary binary data block (see section 2.5.1.4 for format).
Since the mainframe imposes no protocol requirements on the data
transferred to or from the SIMs and external RS-232 devices, the
MSG packets are divided at arbitrary points in the data stream. To
correctly reconstruct the byte stream from a particular port, the host
must concatenate the contents of all packets from that port in the
order received.
The data block b of the MSG packets are guaranteed not to exceed
the byte limit set by the MSGL command. If fewer bytes are re-
ceived from a port, then a MSG packet is generated after a timeout of
approximately 5 serial-byte times (5 or 6 ms at 9600 baud).
SIM900Mainframe
2.6Register Model2 – 43
When the mainframe is switched to connect mode to a port (via
CONN), the RPER is cleared to all zeros. This prevents data from any
of the unconnected ports from being interspersed in theoutput queue
with data bytes from the connected port.Upon leaving connect
mode the RPER remains cleared, so the host must reprogram RPER
if needed.
At power-on, this register is cleared.
2.6.1.3Broadcast Enable (BER)
This is a 16-bit wide register that selects ports to receive broadcast
If the bit corresponding to a particular port is set in the BER, then
any broadcast messages sent from the host to the mainframe will be
transferred to that port. Note that the Port C and Port D bits are only
effective if PRTC PORT (or PRTDPORT) have been set.
This register is cleared on power-on.
2 – 44Remote Programming
2.6.2Status registers
The SIM900 Mainframe status registers follow the hierarchical IEEE–
488.2 format. A block diagram of the entire status register array is
given in Figure 2.1.
There are four broad categories of registers in the status model of the
mainframe:
Condition Registers :These read-only registers correspond to the real-time condi-
tion of some underlying physical property being monitored.
Queries return the latest value of the property, and have no
further side effects. Condition register names end with CR.
(such as 0 → 1 or 1 → 0). The event is then defined by the
selected transition in the value of the underlying condition
register. Transition register names end with PT or NT.
Event Registers :These read-only registers record the occurrence of defined
events within the mainframe. If the event occurs, the corresponding bit is set to 1. Upon querying an event register, any
set bits within it are cleared2. These are sometimes known as
“sticky bits,” since once set, a bit can only be cleared by reading
its value. Event register names typically end with SR.
Enable Registers :These read/write registers define a bitwise mask for their cor-
responding event register. If any bit position is set in an event
register while the same bit position is also set in the enable
register, then the corresponding summary bit message is set.
Enable register names typically end with SE.
2
Except for any summary bit messages.
SIM900Mainframe
7
X
5
4
3
2
1
0
SSSB: SIM Status Summary Bit
RQS / MSS: Master Summary Status
ESB: Event Status Bit
MAV: Message Available
IDLE
CESB: Comm Error Summary Bit
FCSB: Flow Control Summary Bit
PDSB: Port Data Pending Summary Bit
7
6
5
4
3
2
1
0
Status Byte
SB SRE
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SSCR SSPT SSNT SSEV SSEN
SIM Status
STATUS1
STATUS2
STATUS3
STATUS4
STATUS5
STATUS6
STATUS7
STATUS8
STATUS9
undef
undef
undef
undef
undef
undef
undef
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
OPC: Operation Complete
undef
DDE: Device Error
EXE: Execution Error
CME: Command Error
undef
PON: Power On
QYE: Query Error
ESR ESE
Standard Event Status
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DataAvail1
DataAvail2
DataAvail3
DataAvail4
DataAvail5
DataAvail6
DataAvail7
DataAvail8
DataAvail9
DataAvailA
DataAvailB
DataAvailC
DataAvailD
undef
undef
Port Data Pending
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
TOSR TOSE
TimeoutGPIB
Timeout1
Timeout2
Timeout3
Timeout4
Timeout5
Timeout6
Timeout7
Timeout8
Timeout9
TimeoutA
TimeoutB
TimeoutC
TimeoutD
undef
undef
Timeout Status
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DCAS
CommErr1
CommErr2
CommErr3
CommErr4
CommErr5
CommErr6
CommErr7
CommErr8
CommErr9
CommErrA
CommErrB
CommErrC
CommErrD
IOSB
CESR CESE
Comm Error Status
TOSB
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
CTSR CTSE
CTS Event Status
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
undef
RTS_Halted1
RTS_Halted2
RTS_Halted3
RTS_Halted4
RTS_Halted5
RTS_Halted6
RTS_Halted7
RTS_Halted8
RTS_Halted9
RTS_HaltedA
RTS_HaltedB
CTS_HaltedC
CTS_HaltedD
undef
FCSR FCSE
Flow Control Status
CTSB
undef
00
PDPR PDPE
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
undef
CTS1
CTS2
CTS3
CTS4
CTS5
CTS6
CTS7
CTS8
CTS9
CTSA
CTSB
RTSC
RTSD
undef
undef
CTCR
(only neg. transitions CTCR ➜ CTSR)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
IOSR IOSE
InovrGPIB
Inovr1
Inovr2
Inovr3
Inovr4
Inovr5
Inovr6
Inovr7
Inovr8
Inovr9
InovrA
InovrB
InovrC
InovrD
undef
undef
Input Overrun Status
2.6Register Model2 – 45
SIM900Mainframe
Figure 2.1: Status Register Model for the SIM900 Mainframe.
2 – 46Remote Programming
2.6.2.1Status Byte (SB)
This is an 8-bit wide register defined by IEEE–488.2. It can be read
either by a GPIB serial poll, or through the *STB? command. The
Status Byte is the top-level summary of the SIM900 Mainframe status
model.
WeightBitFlag
10PDSB
21FCSB
42CESB
83IDLE
164MAV
325ESB
646RQS/MSS
1287SSSB
Bit 6 returns the RQS message during a GPIB serial poll, and MSS
when queried with *STB?
PDSB :Port Data Pending Summary Bit. Indicates whether one or
more of the enabled flags in the Port Data Pending Status Register has become true.
FCSB :Port Flow Control Summary Bit. Indicates whether one or more
of the enabled flags in the Port Flow Control Status Register has
become true.
CESB :Comm Error Summary Bit. Indicates whether one or more of
the enabled flags in the Comm Error Status Register has become
true.
IDLE :Indicates that the input buffer is empty and the command
parser is idle. Can be used to help synchronize mainframe
query responses.
MAV :Message Available. Indicates whether or not the output queue
has any data pending for the host.
ESB :Event Status Bit. Indicates whether one or more of the enabled
events in the Standard Event Status Register is true.
RQS :IEEE–488 Request Service message, indicating this device (the
SIM900 Mainframe) requested service.
MSS :Master Summary Status. Indicates whether one or more of the
enabled status messages in the Status Byte register is true.
SSSB :SIM Status Summary Bit. Indicates whether one or more of
the enabled event flags in the SIM Status Event Register has
become true.
SIM900Mainframe
2.6Register Model2 – 47
Bits in the Status Byte are not cleared by the *STB? query. These
bits are only cleared by reading the underlying event registers, or by
clearing the corresponding enable registers.
2.6.2.2Service Request Enable (SRE)
This is an 8-bit wide register defined by IEEE–488.2. Each bit in the
SRE corresponds one-to-one with a bit in the SB register, and acts as
a bitwise AND of the SB flags to generate MSS/RQS. Bit 6 of the SRE
is undefined - setting it has no effect, and reading it always returns
0. This register is set and queried with the *SRE(?) command.
At power-on, this register is cleared if *PSCis non-zero. It retains its
value if *PSC 0.
2.6.2.3Standard Event Status (ESR)
This is an 8-bit wide register defined by IEEE–488.2. These event
flags are all “sticky bits” that are set by the corresponding event,
and cleared only by reading or with the *CLS command. Reading a
single bit (with the *ESR? i query) clears only bit i.
WeightBitFlag
10OPC
21undef (0)
42QYE
83DDE
164EXE
325CME
646undef (0)
1287PON
OPC :Operation Complete. Set by the *OPC command.
QYE :Query Error. Indicates either (1) an attempt to read data when
no output is present or pending (only valid for GPIB), or (2)
data in the output queue has been lost.
DDE :Device Dependent Error. Indicates a mainframe power supply
undervoltage.
EXE :Execution Error. Indicates an error in a command that was
successfully parsed. Out-of-range parameters are an example.
The error code can be queried with LEXE?.
CME :Command Error. Indicates a parser-detected error. The error
code can be queried with LCME?.
SIM900Mainframe
PON :Power On. Indicates that an off-to-on transition has occurred.
2 – 48Remote Programming
2.6.2.4Standard Event Status Enable (ESE)
This is an 8-bit wide register defined by IEEE–488.2. It acts as a
bitwise AND with the ESR register to produce the single bit ESB
message in the Status Byte Register (SB). It can be set and queried
with the *ESE(?) command.
At power-on, this register is cleared if *PSCis non-zero. It retains its
value if *PSC 0.
2.6.2.5SIM Status Condition (SSCR)
This 16-bit wide register monitors the −STATUS line from the 9 SIM
ports (1–9). There is no corresponding signal for the RS-232 ports.
SSCR is a read-only register.
The −STATUS output signal from a SIM idles high, indicating no
special status information to report, and set or pulsed to low to
indicate some (device-dependent) status message. The SSCR records
the complement of the signal, so −STATUS True (low) appears as a
1 in the SSCR, while −STATUS False (high) appears as a 0. Reads
to the SSCR (via SSCR?) return the present value of the −STATUS
signal for Port n as bit Statusn.
2.6.2.6SIM Status Positive/Negative Transition (SSPT/SSNT)
These two 16-bit wide registers control the mapping of transitions in
the SSCR to setting flags in the SSEV register. For any particular SIM
port, if the corresponding bit is set in SSPT, then a 0 → 1 transition
in the SSCR causes the bit to be set in the SSEV. Likewise, if a bit is
set in SSNT, then a 1 → 0 transition in the SSCR causes the bit to be
set in the SSEV.
SIM900Mainframe
2.6Register Model2 – 49
All combinations of SSPT and SSNT settings for the 9 SIM ports are
valid. At power-on, both SSPT and SSNT are cleared.
2.6.2.7SIM Status Event (SSEV)
This 16-bit wide register monitors selected events in the SSCR, based
on transitions selected in SSPT and SSNT. When the selected transition(s) occur, the corresponding bit is set. Reading the register clears
it (reading a single bit clears only that bit). This register is cleared by
the *CLS command.
2.6.2.8SIM Status Enable (SSEN)
This is a 16-bit wide register that masks the SSEV register.The
logical OR of the bitwise AND of SSEV and SSEN produces the SSSB
message in the Status Byte register (SB).
2.6.2.9Communications Error Status (CESR)
This is a 16-bit wide register that monitors communications errors
on the ports.
DCAS :Device Clear Active State. Set by the mainframe receiving a
Device Clear event (either from DCL, SDC, or RS-232 hbreaki.
CommErrp :Communication Error for Port p. Set by the mainframe de-
tecting a serial error (such as parity violation or framing error,
or an input buffer overflow) on the corresponding port input
hardware.
SIM900Mainframe
TOSB :Timeout Summary Bit message. TOSB indicates the logical OR
of the bitwise AND of TOSR and TOSE (see below).
2 – 50Remote Programming
IOSB :Input Overflow Summary Bit message.IOSB indicates the
logical OR of the bitwise AND of IOSR and IOSE (see below).
This register (with the exception of the TOSB & IOSB bits) is cleared
either by reading, or with the *CLS command.
2.6.2.10Communications Error Status Enable (CESE)
This is a 16-bit wide register that masks the CESR register.The
logical OR of the bitwise AND of CESR and CESE produces the
CESB message in the Status Byte register (SB).
At power-on, this register is cleared.
2.6.2.11Timeout Status (TOSR)
This is a 16-bit wide register that monitors timeout errors.
If an attempt to write to a port output queue fails due to a timeout
error, the corresponding bit in the TOSR is set. (This can also be
thought of as an output overflow error.) The register is cleared either
by reading, or with the *CLS command.
2.6.2.12Timeout Status Enable (TOSE)
This is a 16-bit wide register that masks the TOSR register. The
logical OR of the bitwise AND of TOSR and TOSE produces the
TOSB message in the Communications Error Status Register (CESR).
SIM900Mainframe
2.6Register Model2 – 51
2.6.2.13Input Overflow Status (IOSR)
This is a 16-bit wide register that monitors input overflow errors.
When data is received by the mainframe at a port, it is initially stored
in the 512-byte port input buffer, on a first-in, first-out (FIFO) basis. If
an input buffer overflows, an error condition is recorded in the IOSR,
and the corresponding input buffer is flushed. If the host input buffer
overflows, then the host output queue is also flushed (as though a
Device Clear had occurred).
The register is cleared either by reading, or with the *CLS command.
2.6.2.14Input Overflow Status Enable (IOSE)
This is a 16-bit wide register that masks the IOSR register. The logical
OR of the bitwise AND of IOSRand IOSE produces the IOSB message
in the Communications Error Status Register (CESR).
2.6.2.15Flow Control Status (FCSR)
This 16-bit wide register monitors the flow-control hardware of the
ports. If the mainframe stops the incoming flow of data from a port
(by deasserting RTS), then the corresponding bit in the FCSR is set.
Whether or not this means that data was actually lost depends on
the implementation of the particular SIM or RS-232 device sourcing
data to the mainframe.
Since Ports C and D (EAVS and COMM) are DCE ports rather than
DTE ports, the hardware flow-control outputs are actually CTS for
these two ports.
SIM900Mainframe
2 – 52Remote Programming
Note if FLOW is set to XON or NONE, the FCSR will not be set by flow
control events. Only RTS flow control is monitored by FCSR.
CTSB is the CTS Summary Bit status message, and is the logical OR
of the bitwise AND of CTSR and CTSE (see below).
This register (with the exception of the CTSB bit) is cleared either by
reading. All bits are cleared by *CLS.
2.6.2.16Flow Control Status Enable (FCSE)
This is a 16-bit wide register that masks the FCSR register. The
logical OR of the bitwise AND of FCSR and FCSE produces the FCSB
message in the Status Byte register (SB).
At power-on, this register is cleared.
SIM900Mainframe
2.6Register Model2 – 53
2.6.2.17CTS Status Condition (CTCR)
This 16-bit wide register monitors the CTS line of all ports (1–D).
The CTS output signal from a SIM or RS-232 device is typically used
for hardware flow control, and is asserted high (1) to indicate the
mainframe is Clear To Send new bytes to the device, and deasserted
(0) to stop the flow.
2.6.2.18CTS Status (CTSR)
Since Ports C and D (EAVS and COMM) are DCE ports instead of
DTE ports, the hardware flow-control inputs for these two ports are
actually RTS rather than CTS.
SIM ports (1–9) each have a pull-down resistor wired to the CTS
input, so unconnected slots will show CTCR[p] = 0. The RS-232
ports each have a pull-up resistor wired to the flow-control input, so
unconnected RS-232 ports will show CTCR[p]=1.
Regardless of the current FLOWsetting for a port, the CTCR always
reflects the real-time value of CTS (RTS for Ports C & D).
This is another 16-bit wide register that monitors the flow control
hardware of the ports. A 1 → 0 transition in the CTCR will cause
the corresponding bit in the CTSR to be set. Thus, only Negative
Transitions generate the CTS Status events. When FLOW is RTS, this
indicates the SIM or RS-232 device has halted the flow of data from
the mainframe.
This register is cleared either by reading, or with the *CLS command.
SIM900Mainframe
2 – 54Remote Programming
2.6.2.19CTS Status Enable (CTSE)
This is a 16-bit wide register that masks the CTSR register.The
logical OR of the bitwise AND of CTSR and CTSE produces the
CTSB message in the Flow Control Status register (FCSR).
At power-on, this register is cleared.
2.6.2.20Port Data Pending (PDPR)
This is a 16-bit wide register that monitors incoming data from the
ports to the mainframe.
A bit for a given port in the PDPR is set if any bytes arrive from that
port while it is NOT mapped to the mainframe output queue (either
by the CONN command or through the RPER register). Reading the
register clears it (reading a single bit clears only that bit).
This register is cleared by the *CLS command.
2.6.2.21Port Data Pending Enable (PDPE)
This is a 16-bit wide register that masks the PDPR register. The
logical OR of the bitwise AND of PDPR and PDPE produces the
PDSB message in the Status Byte register (SB).
At power-on, this register is cleared.
SIM900Mainframe
3Communications Examples
This chapter providesdetailed examples of communications with the
SIM900 Mainframe.
The Small Instrumentation Module family supports several styles
of communications between a user’s computer and a collection of
instruments. While it is possible to communicate directly with a SIM
module, this chapter will only consider the case of communication
through a SIM900 Mainframe.
The SIM900 has two host computer interfaces: RS-232 and GPIB.
To switch interfaces, use the rear-panel piano-style DIP switch (see
section 1.4.2). The 5 right-most switches are interpreted based on the
host selection, and determine either default baud rate or instrument
address (see section 1.4.1). Only one host interface can be active, and
the selection is determined at power-on time for the SIM900.
3.1.1Streaming Communications
The simplest style of communication through the SIM900 is the “connection” model, where a single bidirectional I/O stream is managed.
Upon power-on, the streamis initiallydirected tothe SIM900 itself, so
that, for example, an identification query (see *IDN?, section 2.5.10)
will result in the SIM900 ID string as a response back to the host
computer. Using the CONN command (section 2.5.3), the user can
steer the I/O stream to one of the instrument ports of the mainframe
(1–8 for the internal slots, 9 for the remote SIM port, and A or B for
the auxiliary RS-232 ports). After connecting to a particular port, all
I/O is directed from the host computer through the Mainframe to the
target port, and responses from the target port are passed through
the Mainframe back to the host computer.
To end the connection, the host computer sends a preprogrammed
“escape” string. The escape string is provided as the second pa-
rameter in the CONN command, and should be chosen carefully to
ensure that it does not inadvertently occur within the normal stream
of I/O from the host computer to the target. In the example below,
the nonsense sequence XYZZY is chosen as an escape string (note the
string is case-sensitive). When the mainframe is relaying data from
the host computer through to a connected port, it continually scans
for a possible match with the escape string. If the first character of
the string is received, the character is held in a memory buffer of the
mainframe. When the next character is received, it is compared with
the second character of the string; if it matches, it too is added to the
buffer, otherwise both the buffered previous character and the new
character are transmitted to the target port.
SIM900Mainframe
3.1Introduction to Communications3 – 3
As an illustration, consider the following session:
from hostto module
CONN 3,’DEFQ’establish connection
GAIN 10GAIN 10“normal” pass-thru
ABCDEFABCpartial match found
GHIJKDEFGHIJKnot escape string; catch up
ABCDEFQABCconnection ended
Notice that when the host computer transmitted ABCDEF, the last
three characters (DEF) were not retransmitted by the mainframe to the
target module; the mainframe withheld these bytes waiting to see if
the complete escape string was being given. When the next character
(G) was sent, the mainframe determined that this was not the escape
string, and resumed transmission to the target module. There is no
timeout on this partial-match buffering, so the data will be held back
indefinitely until the Mainframe can uniquely disambiguate between
the message data and the escape string.
The situation get more interesting when multiple SIM900s are connected together using the auxiliary RS-232 ports. In this case, different escape strings must be used for the two mainframes to enable
redirection of the downstream SIM900 I/O stream without disconnecting the upstream connection.
3.1.2Message-Based Communications
An alternative to the streaming connection model, message-based
communications treats all transactions as mainframe-directed commands and queries. Transmissions from the host computer to in-
dividual modules are performed with the SEND and SNDT com-
mands; transmissions to multiple modules can broadcast with the
BRDC,BRDT commands (section 2.5.3).
There are several options available for receiving data from modules
back to the host computer under a message-based scheme:
• One or more ports can be enabled for “pass-through” messag-
ing with the RPER register (see sections 2.5.4 and 2.6.1.2). In-
coming data messages from an enabled port are encapsulated
in a MSG packet, and transmitted directly to the host output
queue. The example program below demonstrates this.
• Individual port(s) can be polled for data (with the NINP?query,
or through the RDPR status register). When data is available
from a port, it can be retreived with the GETN? or RAWN?
queries (see section 2.5.3).
SIM900Mainframe
3 – 4Communications Examples
3.1.3Other Styles
It is also possible to combine elements of each communication model.
For instance, messages from the host to the modules can be con-
veniently dispatched with the SEND and SNDT commands, while
query responses can be retrieved by CONNecting to the port and sim-
ply reading the results. The final example program demonstrates this
hybrid style.
3.2Streaming Example
This example demonstrates I/O to multiple SIM modules using the
stream-based connection model. Low-level I/O is handled by function calls to the National Instruments VISA library, and supports
both RS-232 and GPIB.
3.2.1openMainframe()
The most complicated function in this example is openMainframe().
After first performing a number of VISA-related initializations, the
program places the mainframe into a reset state (with *RST). The
next command (VERB127) enables debugging output on the Eaves-consider monitoring the
Eavesdrop port for debuggingdrop RS-232 port. The next two commands (CEOI and EOIX) enable
translation of line-feed characters to EOI messages (and visa-versa)
when connected via GPIB. The host interface terminator is next programmed to line-feed for consistency when connected via RS-232.
3.2.2main()
Because the mainframe serial baud rates are not modified by the
*RST command, the program next loops over all valid port numbers
and commands each port to 9600 baud (the module default).
Finally, all internal port buffers in the mainframe are flushed (FLSH),
and a serial break signal is sent to all SIM modules to force their
communications interfaces to a clean state (SRST).
After first querying the identification string of the mainframe, the
program moves the I/O stream to port 5 and identifies the module
plugged into that slot. Notice the “TERM LF” command that is first
sent to the module—this sets the module to terminate responses with
a line-feed character.This is particularly helpful for GPIB-based
communications.
The dialog is repeated for port 7, after which the program ends.
* example_stream i n g .c -- simple IO
*
* compile l ine :cl ex a m p l e _ s t r e a m i n g .c /l ink visa 3 2 .lib
*/
#include <st d i o .h >
#include <st d l i b .h >
#include <st r i n g .h >
#include <ti m e . h >
#include <vi s a . h >/* external VI S A library */
/* the f ollowing mac r o defines the VIS A resource (uncomment o nly on e ) */
#define VI S A R E S O U R C E " G PIB :: 2 :: IN S T R "/* GPI B Address 2 */
/* #define VI S A R E S O U R C E " A S RL2 : : IN S T R "/* COM 2 (RS -232) */
#define VI S A T I M E O U T1000/* ti meou t , in ms */
/* Define the de f a u l t baud rate for th e host i n t e r f ace (for RS -232).
* Edi t to match the settin g on the rear -pane l DIP sw i tch .
*/
#define DE F A U L T B A U D960 0
/* === function prototypes === */
in t openMainframe ( vo i d );
vo id closeMainframe (voi d );
vo id sendString ( ch ar *m s g );
vo id recvString ( ch ar *msg , int size );
/* ===== = = = = = = = == = = == = = == = == = = == = == = = == = = == = == = = == = == = = == = = == = == = = == = = == */
/* == = This is the ma in progra m . The ma i n f r a m e I D string is qu e ried , = = = */
/* == = and then mo d u l es in slots 5 & 7 are id e n t i f i e d .== = */
/* ===== = = = = = = = == = = == = = == = == = = == = == = = == = = == = == = = == = == = = == = = == = == = = == = = == */
in t main (void ) {
ch ar msg [81];
if (openMainframe () ) return 0;/* at t e m pt to open co m m u n i c a t i o n s */
sen d S t r i n g ("* IDN ?\ n " );/* query m a i n f rame ID string */
rec v S t r i n g (ms g , sizeof ( msg )) ;/* rece i v e r e sponse */
pr i n t f (" MF IDN : % s \n " ,ms g );/* report the re s u l t */
ff l u s h (stdout );
sen d S t r i n g (" CONN 5 ,’ x yZZy ’\ n " );/* co nnect to Slot 5 */
sen d S t r i n g (" TERM LF \ n " );/* set response te r m to LF */
sen d S t r i n g ("* IDN ?\ n " );/* query m odule ID strin g */
rec v S t r i n g (ms g , sizeof ( msg )) ;/* rece i v e r e sponse */
pr i n t f (" S l o t 5: % s\ n" , m sg );/ * repor t the re s u lt */
ff l u s h (stdout );
sen d S t r i n g (" xyZZy " ) ;/* disconnect */
sen d S t r i n g (" CONN 7 ,’ x yZZy ’\ n " );/* co nnect to Slot 7 */
SIM900Mainframe
3 – 6Communications Examples
sen d S t r i n g (" TERM LF \ n " );/* set response te r m to LF */
sen d S t r i n g ("* IDN ?\ n " );/* query m odule ID strin g */
rec v S t r i n g (ms g , sizeof ( msg )) ;/* rece i v e r e sponse */
pr i n t f (" S l o t 7: % s\ n" , m sg );/ * repor t the re s u lt */
ff l u s h (stdout );
sen d S t r i n g (" xyZZy " ) ;/* disconnect */
* low level I/ O funct i o n s :
*op e n M a i n f r a m e () -- open communications ch annel , and in i t i a l i ze
*mai n f r a m e & mo dules
*cl o s e M a i n f r a m e () - close co m m u n i c a t i o n s c h a n n el
*se n d S t r ing () -- --- transmit a null - te r m i n a t e d string
*re c v S t r ing () -- --- receive da ta int o a null - t e r m i n a t e d string
*/
st a t i c ViSession defaul t R M ;
st a t i c ViSession in s t r ;
st a t i c ViStatus st a t u s ;
st a t i c ViUInt32 ret C o u n t ;
st a t i c ViUInt32 write C o u n t ;
st a t u s =viOpenDefaultRM (& defaultRM );
if (status < V I _ S U C C E S S ) {
pr i n t f (" Cou l d not open a s e s s i o n \n ");
ex i t (EXIT_FAILURE );
}
st a t u s = viOpen (d e f aultRM , VI SARESOURCE , VI_N ULL , VI_NUL L , &instr );
if (status < V I _ S U C C E S S ) {
pr i n t f (" Cannot op en a session to the devi c e .\ n");
st a t u s = viClose ( in str );
st a t u s = viClose ( de f a u l t R M );
ex i t (EXIT_FAILURE );
}
/* Set timeout va l u e */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _TMO_VALUE , VI S A T I M E O U T );
/* Set interf a ce - sp e c i f i c config . (RS -2 3 2 or GPIB ...) */
st a t u s = vi G e t A t t r i b u t e (ins tr , VI _ A T T R _INTF_TYPE , &i t y pe );
if (itype == VI _ I N T F _ A S R L ) {/* int e r f a c e is RS - 2 3 2 */
SIM900Mainframe
3.2Streaming Example3 – 7
/* transmit se r i al BREAK to re set SIM9 0 0 host in t e r f a c e */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _END_OUT , VI_ASRL_END_BREAK );
st a t u s = viWrite (i nst r , (ViBuf) buf , 0, &writeCount );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _END_OUT , VI_ASRL_END_NONE );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ASRL_BAUD , DE F A U L T B A U D );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _ D A T A _ B ITS , 8) ;
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S RL_PARITY , VI_ASRL_PAR_NONE );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _ S T O P _ B ITS , VI_AS R L _ S T O P _ O N E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ T E RMCHAR_EN , VI_ T R U E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R_TERMCHAR , 0xA ) ;
} els e if ( itype == VI _ I N T F _ G P I B ) {/* interface is GP I B */
st a t u s = viClear ( in str );/* clear SI M 9 0 0 hos t i n t e r f ace */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ T E RMCHAR_EN , VI _ F A L S E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ S U P P R E S S _ E N D _ E N , VI_FALSE ) ;
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ S E ND_END_EN , VI_ T R U E );
}
sen d S t r i n g ("* RST\ n " );/* SI M 9 0 0 default */
sen d S t r i n g (" VERB 127\ n " );/* en a b l e E avesdrop */
sen d S t r i n g (" CEOI ON \ n " );/* conve r t EOI ’ s (fo r GPIB ) */
sen d S t r i n g (" EOIX ON \ n " );
sen d S t r i n g (" TERM D, L F \ n " );/* set SIM 9 0 0 to LF term */
fo r (i=1; i < = 0 xb ; + + i) {/* set po r ts to 9600 baud */
sp r i n t f (buf , " BA U D %x ,9600\ n" , i);
sen d S t r i n g (buf );
}
sen d S t r i n g (" FLSH\ n " );/* fl u sh all port bu f f ers */
sen d S t r i n g (" SRST\ n " );/* re s et module i n t e r f a c e s */re t u r n 0;
st a t u s = viRead ( i nstr , msg , s ize -1 , & re t C o u n t );
if (retCount == 0) ms g [0] = ’\0 ’;
}
SIM900Mainframe
3 – 8Communications Examples
3.3Message-Based Example
This example demonstrates basic I/O to multiple SIM modules using
the message-based communication model. Low-level I/O is handled
by function calls to the National Instruments VISA library, and supports both RS-232 and GPIB.
3.3.1serviceMsgs() & deliverMsg()
The serviceMsgs() function handles the incoming stream of message packets from the various module ports to the host computer.
Ideally, this function would be repeatedly called within a parallel
thread to the main program. For simplicity, in this example, the
function is called repeatedly within the main thread of the program,
and no explicit parallelism is used.
Separate input port buffers (portBuf) are used to store the incoming
streams from each port; data originating with the mainframe itself is
buffered as “port 0”. Each incoming packet begins with a MSG header
(see section 2.6.1.2) containing the source port address and the byte
count for the payload data. The bulk of serviceMsgs() handles
the parsing of this header, buffering partial packets internally, and
sending any data not encapsulated in a MSG packet to the “port 0”
buffer.
Data is transferred to the portBuf array by the internal helper function deliverMsg(); this function should not be called by any userlevel code.
3.3.2readMsg() & sendMsg()
These two functions constitute the user-level interface for communications. readMsg() drains data from the portBuf array, and if necessary calls serviceMsgs() to retrieve more data. Calls to readMsg()
transfer data up to (and including) either the requested number of
bytes, or the first line-feed character.
The sendMsg() sends data to the SIM system; messages directed to
the mainframe (port=0) simply have a line-feed appended to the
end, while port-directed messages are sent as the payload of a SNDT
command (section 2.5.3).
3.3.3openMainframe()
The only change to openMainframe(), compared with the previous
example, is the addition of the line:
sen d S t r i n g (" RPER 40 94\ n " );
SIM900Mainframe
3.3Message-Based Example3 – 9
This programs the Receive Pass-Through Enable register (section 2.6.1.2) for ports 1–B, causing incoming data from the modules
to the mainframe to be immediately transmitted by the mainframe
to the host as MSG packets.
3.3.4main()
The main program is similar to the first example. Notice that the
TERM LF message is now being broadcast to all module ports using
the BRDT command. Also, the serviceMsgs() function is called
after each query command is sent, before attempting to read the
results. Ideally, the calls to serviceMsgs() would be hidden in a
parallel thread, but that refinement is omitted here.
* example_messages .c -- SIM IO ex a m p le
*
* compile l ine : cl example_messages .c /link v isa32 . lib
*/
#include <st d i o .h >
#include <st d l i b .h >
#include <st r i n g .h >
#include <ti m e . h >
#include <vi s a . h >/* external VI S A library */
/* the f ollowing mac r o defines the VIS A resource (uncomment o nly on e ) */
#define VI S A R E S O U R C E " G PIB :: 2 :: IN S T R "/* GPI B Address 2 */
/* #define VI S A R E S O U R C E " A S RL2 : : IN S T R "/* COM 2 (RS -232) */
#define VI S A T I M E O U T500/* ti meout , in ms */
/* Define the de f a u l t baud rate for th e host i n t e r f ace (for RS -232).
* Edi t to match the settin g on the rear -pane l DIP sw i tch .
*/
#define DE F A U L T B A U D960 0
/* === function prototypes === */
vo id serviceMsgs ( vo id );
vo id deliverMsg ( int port , cha r *p, int len );
vo id readMsg( i nt port , cha r *buf , int ma x L en );
vo id sendMsg( i nt port , cha r *buf );
in t openMainframe ( vo i d );
vo id closeMainframe (voi d );
vo id sendString ( ch ar *m s g );
vo id recvString ( ch ar *msg , int size );
/* ===== = = = = = = = == = = == = = == = == = = == = == = = == = = == = == = = == = == = = == = = == = == = = == = = == */
/* == = This is the ma in progra m . The ma i n f r a m e I D string is qu e ried , = = = */
/* == = and then mo d u l es in slots 5 & 7 are id e n t i f i e d .== = */
/* ===== = = = = = = = == = = == = = == = == = = == = == = = == = = == = == = = == = == = = == = = == = == = = == = = == */
in t main (void ) {
ch ar msg [81];
if (openMainframe () ) return 0;
se n d M s g (0 , "BRER 1022 " ) ;/* enable por t s 1-9 to re c e ive broadcasts */
se n d M s g (0 , "BRDT ’ TERM LF ’ " );/* set all modul e s to LF t e r m i n a t i o n s */
se n d M s g (0 , "*IDN ?");/* qu e ry mainframe ID str i n g */
se r v i c e M s g s ();
re a d M s g (0 , msg , size o f (ms g )) ;
pr i n t f (" MF IDN : % s \n " ,ms g );/* report the re s u l t */
ff l u s h (stdout );
se n d M s g (5 , "*IDN ?");
SIM900Mainframe
3.3Message-Based Example3 – 11
serv i c e M s g s ();
re a d M s g (5 , msg , size o f (ms g )) ;
pr i n t f (" S l o t 5: % s\ n" , m sg );/ * repor t the re s u lt */
ff l u s h (stdout );
se n d M s g (7 , "*IDN ?");
se r v i c e M s g s ();
re a d M s g (7 , msg , size o f (ms g )) ;
pr i n t f (" S l o t 7: % s\ n" , m sg );/ * repor t the re s u lt */
ff l u s h (stdout );
* mes sage - level I/ O function s :
*se r v i c e M s g s () -- pseu do - b a c k g r o u n d f unction to handl e i n c oming msg s
*de l i v e r Msg ()- - in t e r n a l function to co p y msg to por t - s p e c i f i c buffer
*re adMsg ()-- user - le v el function to re ad m s g from a s p e cific por t
*se ndMsg ()-- user - le v el function to wr i t e msg to a s pecific po r t
*
* For readMsg ( ) an d sendMsg () , use por t =0 to send to the Mainframe it s elf .
* All reads will termina t e on ’\ n ’ or maxLen , an d all sends wi ll hav e a
* ’ \ n ’ postpended.
*/
#define MA X P O R T 0x d
#define BU F S I Z E 10 2 4
st a t i c char p o r tBuf [ BUFS I Z E ][ MAXPOR T ];
st a t i c unsigned int portFi l l [ M AXPORT ] ;
st a t i c unsigned int portDrain[ M A X P O R T ];
st a t i c unsigned int nBytesUsed [ MA X P ORT ];
* low level I/ O funct i o n s :
*op e n M a i n f r a m e () -- open communications ch annel , and in i t i a l i ze
*mai n f r a m e & mo dules
*cl o s e M a i n f r a m e () - close co m m u n i c a t i o n s c h a n n el
*se n d S t r ing () -- --- transmit a null - te r m i n a t e d string
*re c v S t r ing () -- --- receive da ta int o a null - t e r m i n a t e d string
*/
st a t i c ViSession defaul t R M ;
st a t i c ViSession in s t r ;
st a t i c ViStatus st a t u s ;
st a t i c ViUInt32 ret C o u n t ;
st a t i c ViUInt32 write C o u n t ;
st a t u s =viOpenDefaultRM (& defaultRM );
if (status < V I _ S U C C E S S ) {
pr i n t f (" Cou l d not open a s e s s i o n \n ");
ex i t (EXIT_FAILURE );
}
st a t u s = viOpen (d e f aultRM , VI SARESOURCE , VI_N ULL , VI_NUL L , &instr );
if (status < V I _ S U C C E S S ) {
pr i n t f (" Cannot op en a session to the devi c e .\ n");
st a t u s = viClose ( in str );
st a t u s = viClose ( de f a u l t R M );
ex i t (EXIT_FAILURE );
}
/* Set timeout va l u e */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _TMO_VALUE , VI S A T I M E O U T );
/* Set interf a ce - sp e c i f i c config . (RS -2 3 2 or GPIB ...) */
st a t u s = vi G e t A t t r i b u t e (ins tr , VI _ A T T R _INTF_TYPE , &i t y pe );
if (itype == VI _ I N T F _ A S R L ) {/* int e r f a c e is RS - 2 3 2 */
/* transmit se r i al BREAK to re set SIM9 0 0 host in t e r f a c e */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _END_OUT , VI_ASRL_END_BREAK );
st a t u s = viWrite (i nst r , (ViBuf) buf , 0, &writeCount );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _END_OUT , VI_ASRL_END_NONE );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ASRL_BAUD , DE F A U L T B A U D );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _ D A T A _ B ITS , 8) ;
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S RL_PARITY , VI_ASRL_PAR_NONE );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _ S T O P _ B ITS , VI_AS R L _ S T O P _ O N E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ T E RMCHAR_EN , VI_ T R U E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R_TERMCHAR , 0xA ) ;
} els e if ( itype == VI _ I N T F _ G P I B ) {/* interface is GP I B */
st a t u s = viClear ( in str );/* clear SI M 9 0 0 hos t i n t e r f ace */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ T E RMCHAR_EN , VI _ F A L S E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ S U P P R E S S _ E N D _ E N , VI_FALSE ) ;
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ S E ND_END_EN , VI_ T R U E );
}
sen d S t r i n g ("* RST\ n " );/* SI M 9 0 0 default */
sen d S t r i n g (" VERB 127\ n " );/* en a b l e E avesdrop */
sen d S t r i n g (" CEOI ON \ n " );/* conve r t EOI ’ s (fo r GPIB ) */
sen d S t r i n g (" EOIX ON \ n " );
fo r (i=1; i < = 0 xb ; + + i) {/* set po r ts to 9600 baud */
sp r i n t f (buf , " BA U D %x ,9600\ n" , i);
sen d S t r i n g (buf );
}
sen d S t r i n g (" TERM D, L F \ n " );/* set SIM 9 0 0 to LF term */
sen d S t r i n g (" FLSH\ n " );/* fl u sh all port bu f f ers */
sen d S t r i n g (" SRST\ n " );/* re s et module i n t e r f a c e s */
sen d S t r i n g (" RPER 40 94\ n " );/* Re c e i ve Pa ss -Through En a b l e ports 1 -B */re t u r n 0;
st a t u s = viRead ( i nstr , msg , s ize -1 , & re t C o u n t );
if (retCount == 0) ms g [0] = ’\0 ’;
}
SIM900Mainframe
3 – 16Communications Examples
3.4Combination Example
This example demonstrates basic I/O to multiple SIM modules using
aspects of both the ”message”-based and ”stream”-based connection
models. Low-level I/O uses National Instrument’s VISA library, and
works with either RS-232 or GPIB.
3.4.1Details
The main program for this final example is identical to the second
example (example messages.c); again, the user-level interface is the
functions sendMsg() and readMsg(). sendMsg() is also identical,
while readMsg() has been rewritten to use the CONN command.
The openMainframe() function is now identical to the first example
program, example streaming.c; the RPER register remains in the
reset state (value of 0).
By using the CONN path to retreive data from individual ports, the
intermediate layer serviceMsgs() is eliminated; instead of buffering the module-originated data on the host computer, this data is
buffered in the mainframe until the host computer is ready to query
it directly. Since the SIM900 Mainframe has 512-byte buffers for each
port, this is usually sufficient.
* example_hybrid . c - - SIM IO exa m p l e
*
* compile l ine : cl example_hybrid . c / li nk visa 3 2 .li b
*/
#include <st d i o .h >
#include <st d l i b .h >
#include <st r i n g .h >
#include <ti m e . h >
#include <vi s a . h >/* external VI S A library */
/* the f ollowing mac r o defines the VIS A resource (uncomment o nly on e ) */
#define VI S A R E S O U R C E " G PIB :: 2 :: IN S T R "/* GPI B Address 2 */
/* #define VI S A R E S O U R C E " A S RL2 : : IN S T R "/* COM 2 (RS -232) */
#define VI S A T I M E O U T500/* ti meout , in ms */
#define ES C A P E K E Y" XY ZZY "
/* Define the de f a u l t baud rate for th e host i n t e r f ace (for RS -232).
* Edi t to match the settin g on the rear -pane l DIP sw i tch .
*/
#define DE F A U L T B A U D960 0
/* === function prototypes === */
vo id readMsg( i nt port , cha r *buf , int ma x L en );
vo id sendMsg( i nt port , cha r *buf );
in t openMainframe ( vo i d );
vo id closeMainframe (voi d );
vo id sendString ( ch ar *m s g );
vo id recvString ( ch ar *msg , int size );
/* ===== = = = = = = = == = = == = = == = == = = == = == = = == = = == = == = = == = == = = == = = == = == = = == = = == */
/* == = This is the ma in progra m . The ma i n f r a m e I D string is qu e ried , = = = */
/* == = and then mo d u l es in slots 5 & 7 are id e n t i f i e d .== = */
/* ===== = = = = = = = == = = == = = == = == = = == = == = = == = = == = == = = == = == = = == = = == = == = = == = = == */
in t main (void ) {
ch ar msg [81];
if (openMainframe () ) return 0;
se n d M s g (0 , "BRER 1022 " ) ;/* enable por t s 1-9 to re c e ive broadcasts */
se n d M s g (0 , "BRDT ’ TERM LF ’ " );/* set all modul e s to LF t e r m i n a t i o n s */
se n d M s g (0 , "*IDN ?");/* qu e ry mainframe ID str i n g */
re a d M s g (0 , msg , size o f (ms g )) ;
pr i n t f (" MF IDN : % s \n " ,ms g );/* report the re s u l t */
ff l u s h (stdout );
se n d M s g (5 , "*IDN ?");
re a d M s g (5 , msg , size o f (ms g )) ;
SIM900Mainframe
3 – 18Communications Examples
pr i n t f (" S l o t 5: % s\ n" , m sg );/ * repor t the re s u lt */
ff l u s h (stdout );
se n d M s g (7 , "*IDN ?");
re a d M s g (7 , msg , size o f (ms g )) ;
pr i n t f (" S l o t 7: % s\ n" , m sg );/ * repor t the re s u lt */
ff l u s h (stdout );
* mes sage - level I/ O function s :
*re adMsg ()-- user - le v el function to re ad m s g from a s p e cific por t
*se ndMsg ()-- user - le v el function to wr i t e msg to a s pecific po r t
*
* For readMsg ( ) an d sendMsg () , use por t =0 to send to the Mainframe it s elf .
* All reads will termina t e on ’\ n ’ or maxLen , an d all sends wi ll hav e a
* ’ \ n ’ postpended.
*/
* low level I/ O funct i o n s :
*op e n M a i n f r a m e () -- open communications ch annel , and in i t i a l i ze
*mai n f r a m e & mo dules
*cl o s e M a i n f r a m e () - close co m m u n i c a t i o n s c h a n n el
*se n d S t r ing () -- --- transmit a null - te r m i n a t e d string
*re c v S t r ing () -- --- receive da ta int o a null - t e r m i n a t e d string
*/
st a t i c ViSession defaul t R M ;
st a t i c ViSession in s t r ;
st a t i c ViStatus st a t u s ;
st a t i c ViUInt32 ret C o u n t ;
st a t i c ViUInt32 write C o u n t ;
st a t u s =viOpenDefaultRM (& defaultRM );
if (status < V I _ S U C C E S S ) {
pr i n t f (" Cou l d not open a s e s s i o n \n ");
ex i t (EXIT_FAILURE );
}
st a t u s = viOpen (d e f aultRM , VI SARESOURCE , VI_N ULL , VI_NUL L , &instr );
if (status < V I _ S U C C E S S ) {
pr i n t f (" Cannot op en a session to the devi c e .\ n");
st a t u s = viClose ( in str );
st a t u s = viClose ( de f a u l t R M );
ex i t (EXIT_FAILURE );
}
/* Set timeout va l u e */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _TMO_VALUE , VI S A T I M E O U T );
/* Set interf a ce - sp e c i f i c config . (RS -2 3 2 or GPIB ...) */
st a t u s = vi G e t A t t r i b u t e (ins tr , VI _ A T T R _INTF_TYPE , &i t y pe );
if (itype == VI _ I N T F _ A S R L ) {/* int e r f a c e is RS - 2 3 2 */
/* transmit se r i al BREAK to re set SIM9 0 0 host in t e r f a c e */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _END_OUT , VI_ASRL_END_BREAK );
st a t u s = viWrite (i nst r , (ViBuf) buf , 0, &writeCount );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _END_OUT , VI_ASRL_END_NONE );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ASRL_BAUD , DE F A U L T B A U D );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _ D A T A _ B ITS , 8) ;
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S RL_PARITY , VI_ASRL_PAR_NONE );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ A S R L _ S T O P _ B ITS , VI_AS R L _ S T O P _ O N E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ T E RMCHAR_EN , VI_ T R U E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R_TERMCHAR , 0xA ) ;
SIM900Mainframe
3 – 20Communications Examples
} els e if ( itype == VI _ I N T F _ G P I B ) {/* interface is GP I B */
st a t u s = viClear ( in str );/* clear SI M 9 0 0 hos t i n t e r f ace */
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ T E RMCHAR_EN , VI _ F A L S E );
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ S U P P R E S S _ E N D _ E N , VI_FALSE ) ;
st a t u s = vi S e t A t t r i b u t e (ins tr , VI _ A T T R _ S E ND_END_EN , VI_ T R U E );
}
sen d S t r i n g ("* RST\ n " );/* SI M 9 0 0 default */
sen d S t r i n g (" VERB 127\ n " );/* en a b l e E avesdrop */
sen d S t r i n g (" CEOI ON \ n " );/* conve r t EOI ’ s (fo r GPIB ) */
sen d S t r i n g (" EOIX ON \ n " );
fo r (i=1; i < = 0 xb ; + + i) {/* set po r ts to 9600 baud */
sp r i n t f (buf , " BA U D %x ,9600\ n" , i);
sen d S t r i n g (buf );
}
sen d S t r i n g (" TERM D, L F \ n " );/* set SIM 9 0 0 to LF term */
sen d S t r i n g (" FLSH\ n " );/* fl u sh all port bu f f ers */
sen d S t r i n g (" SRST\ n " );/* re s et module i n t e r f a c e s */re t u r n 0;
The SIM900 is assembled from 6 (optionally 7) independent printed
circuit boards. The boards are interconnected with board-to-board
header connectors, as shown in Figure 4.1. Note that in this chapter,
page references are to the 21-sheet schematics pages at the end of the
manual.
4.1.1Power Distribution
Figure 4.1: The SIM900 circuit board arrangement.
The internal distribution of power supply voltages within the SIM900
is somewhat involved. AC line power is converted to 24 VDC by the
universal input power supply, located at the left side of the mainframe (in front of the power entry module on the rear panel). Note
that this voltage (labeled +24US on the schematics) is always on
whenever AC line voltage is present.
The unswitched 24 VDC power comes across the top of the module
slots, and plugs into the power supply controller board at JP101
(schematic page 14 of 21). It routed from there up to the power
SIM900Mainframe
4.1Circuit Descriptions4 – 3
supply mezzanine board, to the microcontroller board, and to the
front panel board.
Two additional cable assemblies plug into the power supply controller board, at JP202 & JP203 (page 15); these carry all DC power
for distribution to connected SIM modules.
4.1.2Microcontroller Board
The microcontroller board (pages 1–6, labelled “µ-ctrl” in Figure 4.1)
is the central control circuit for the SIM900.The microcontroller
(U103) coordinates all functions of the SIM900 except for power.
The microcontroller operates with an external 16-bit address bus,
and an independent 8-bit data bus, with muliple address spaces
defined by independent chip select lines (−CSGPIB, −CSUARTS,
−CSRAM, −CSROM). Firmware is stored in off-chip rom (U302),
and port data is buffered in the off-chip ram (U301). Direct board-toboard header/socket interfaces connect the microcontroller board to
the front panel board (via JS103), the backplane board (via JP601), the
rear panel board (via JP602), and the power supply controller board
(via JP603).
4.1.3Backplane Board
The clock circuit (page 2) is based on a 20 MHz crystal operated in
a classic Colpitts oscillator with varactor tuning to create a VCXO.
The tuning voltage is selected by U206 between a fixed DC voltage
from R222, or the PLL output voltage generated by U207 and filtered
at U205B. When operating in PLL mode, U207 is programmed to
mix the the oscillator and reference signals at 1 MHz. U202A divides
the oscillator output to produce complementary ±10 MHz signals for
distribution throughout the system.
U201 buffers the 10 MHz clocks for distribution to the SIM modules; ±10MHZ DIST go the the back plane board for slots 1–8, while
±10MHZ RMT goes to the rear panel for port 9. −EN CLOCKS
(generated by U103) enables or disables this clock.
U204, together with U202B, further divide the clock to produce
the 200 kHz synch signal for the power supply controller board
(CLK PSSYNC), and the 5 MHz GPIB clock.
U402 is the quad UART controller for ports A–D (the true RS-232
ports).
The backplane board(pages 8–13) distributes power, data, and clocks
to 8 internal SIM ports. JP101 (page 8) is the main interconnect,
mating with JP601 (page 6) on the microcontroller board. The data
and address bus, along with some control signals, are also passed
SIM900Mainframe
4 – 4Circuitry
through to the (optional) GPIB board via JS103 (located near the top
of the backplane board).
Serial communication with ports 1–8 are managed by two quad
UARTS (U201, U202, page 9). Power is distributed along the backplane on inner planes, with separate decoupling at each slot directly
before the DB–15 connectors.
4.1.4Power Supply Controller Board
The power supply controller board (pages 14–16, labelled “P/S ctrl”
in Figure 4.1), produces the DC operating voltages (±5 V, ±15V) from
the incoming +24 V power supply. The incoming +24 V connects to
JP101 (page 14, located near the “front panel” edge of the board); note
that the negative return is not grounded, but drops below ground by
the IR drop across R101, a 0.01 Ω current sense resistor.
The DC-DC converter uses the transformer and diode bridges on the
power supply mezzanine to produce unregulated ±8 V & ±18 V DC
power, which is then linearly regulated to produce the final voltages. The center-tapped primary side of the tranformer is driven at
100 KHz by alternately pulling the two ends of the primary winding
to ground through Q101 & Q102. Voltage ordering for start-up and
fault protection is provided by D201–D206. The +24 V power to SIM
modules is not re-generated by the DC-DC converter, but is switched
with the other power rails, by the combination of U209 & Q201 (to
ensure soft-starting of the power).
The main interconnect to the microcontroller board is via JS301
(which mates with JP603).Prior to the oscillator stabilizing, the
switching controller (U104) self-clocks based on the time-constant
set by R107 & C109.
The overvoltage/overcurrent detection circuit (page 16) is powered
by the unswitched +5US power, derived linearly from +24US. The
−TRIP signal shuts down U104, and requires a new rising edge on
PWRSW 24 (the front-panel toggle switch) to clear the trip.
4.1.5Power Supply Mezzanine Board
The power supply mezzanine board (page 17, labelled “P/S mez” in
Figure 4.1) holds the large components of the power supply, namely
the input filter, transformer, diode bridges, and post-rectifier filters.
4.1.6Rear Panel Board
The rear panel board (pages 18–20) holds the Port 9 SIM connector,
and the 4 DB–9 RS-232 connectors. The external timebase reference
SIM900Mainframe
4.1Circuit Descriptions4 – 5
input (rear-panel BNC) is wired to this board (at J101), which passes
the reference to the microcontroller board for the PLL circuit.
Line drivers and receivers are populated on this board, butthe UARTs
for the RS-232 ports are located on the microcontroller board (U402,
page 4).The remote SIM port uses the internal serial controller
interface of the microcontroller for its UART function.
4.1.7Front Panel Board
The front panel board (page 21) holds the display LEDs for the
SIM900. Note that most indicators are driven statically from shift
registers U401, U402, U403. The STANDBY and TRIP leds, however,
must be directly driven by lines driven by the power supply controller board, since VCC is not powered when these indicators are
lit.
The cooling fan is controlled by the FAN CTRL signal, which is also
generated on the power supply controller board, and is proportional
to the total power consumption of the SIM900.
4.1.8GPIB Option Board
The GPIB option board (page 7) contains the GPIB controller chip
and transceivers for the IEEE-488 bus. This board (not shown in
Figure 4.1) plugs horizontally into the socket (JS103, page 8) located
at the top of the backplane board.Use care when installing this
board to ensure that the pins are correctly registered and mated (an
inspection mirror can be helpful).
SIM900Mainframe
4 – 6Circuitry
ReferenceSRS P/N Part ValueReferenceSRS P/N Part Value
C101,C102,C103,C104,C105, 5-00299 0.1UR213,R2254-01471 470