B&B Electronics manual B232OPSDAReadDigital, Syntax C

Page 21

segment and offset addresses of the integer array where the results of the A/D conversion will be stored.

Returns: FALSE (zero) if the function fails, otherwise it returns TRUE (non-zero).

B232OPSDA_ReadDigital

Purpose: This function reads the states of all the digital I/O lines.

Syntax: C:

Pascal:

BASIC:

BOOL B232OPSDA_ReadDigital (WORD hComDev, BYTE modAddr, WORD* data);

function B232OPSDA_ReadDigital (hComDev : word; modAddr : byte; data : Pword);

FUNCTION B232OPSDAReadDigital (BYVAL hComDev AS INTEGER, BYVAL modAddr AS INTEGER, BYVAL wdataseg AS INTEGER, BYVAL wdataoff AS INTEGER)

Remarks: hComDev is the handle to a serial port where the module is connected. This is the value returned by initComPort. modAddr is the module address. This is always 30H (48 decimal) for the 232OSPSDA module. data is the address of the 16-bit value where the digital I/O values will be stored. If bit 0 (01H; 1 decimal) of data is set, then digital input 0 is on, otherwise it is off. If bit 4 (10H; 16 decimal) of data is set, then digital output 1 is on, otherwise it is off.

For QuickBASIC users: wdataseg and wdataoff are the segment and offset addresses of the integer the digital I/O values will be stored.

Returns: FALSE (zero) if the function fails, otherwise it returns TRUE (non-zero).

20Documentation Number 232OPSDA1397 Manual

B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350

PH (815) 433-5100 -- FAX (815) 433-5105

Image 21
Contents Electronics Mfg. Co. Inc Designed and Manufactured Ottawa, IllinoisInternet Table of Contents Page Introduction 232OPSDA FeaturesPacking List General Block DiagramSoftware Installation 232OPSDA SpecificationsAnalog to Digital Converter Digital Input Power SupplyDigital Output CommunicationsTerminal Function Description Block Connections232OPSDA Serial Port Connections Digital I/O Connections232OPSDA Power Supply Connections Commands Syntax Reading A/D Channels Command Set Digital Output Command Reading Digital I/O Command0RD StatesConverter Range Sampling RateNon-buffered 0 to 5VDC A/D Inputs Buffered 0 to 5V A/D Inputs20mA Current Loop A/D Input To 10VDC A/D InputGain = Application Program Interface Syntax C B232OPSDAReadDigitalReturns B232OPSDASetDigitalOutputDeinitComPort Purpose See AlsoPort Address Low-Level CommunicationsReturns See Also DeinitComPortCommand$ = !0RA + CHR$channel Read A/D CommandPrint #1, Command$ MSB$ = INPUT$1, #1 LSB$ = INPUT$1, #1Read Digital I/O Command Reply$ = INPUT$ 1, #1 Command$ = !0RDStates = ASCReply$ Status = states and maskSet Digital Output State Command$ = !0SO + CHR$states‘ Set Output High states = states or mask States = states and NOTmaskDecimal to HEX to Ascii Conversion Table Appendix a Decimal to Hex to Ascii Conversion