mscbxxx
where xxx
is the version. It should be unzipped into an "mscb" directory. It contains following files:
#includeFor a MSCB program to run, it has to have direct access to the parallel port. While this is no problem under Windows 95/98/ME, it is not allowed under Windows NT/2000/XP and Linux. Under Linux, one can use the /dev/parport device which allows direct bit manipulations at the parallel port. This feature will be implemented soon in the MSCB library. Under Windows NT & Co., the directIO drive can be used to talk directly to the port. The driver is contained in following ZIP file:#include "mscb.h" main() { int fd, size, status; float value; fd = mscb_init("lpt1"); /* check if node #123 is alive */ status = mscb_ping(fd, 123); if (status != MSCB_SUCCESS) { printf("Node 123 doesn't respond.\n"); return 0; } /* output 1.25V at DAC1, assuming node is a model SCS-500 */ value = 1.25; mscb_write(fd, 123, 8, &value, sizeof(value)); /* read and display ADC1 */ size = sizeof(value); mscb_read(fd, 123, 0, &value, &size); printf("ADC1 reads %1.2lfV\n", value); mscb_exit(fd); return 1; }
Unpack it and follow the instructions to install it. Note that the directIO driver must be running before any MSCB program can be started.
C:\mscb> msc > scan Found node "SCS-400", node addr. 1 (0x0001), group addr. 1 (0x0001) > addr 1 Node 1 addressed node0x1> info Node name: SCS-500 Node status: 0x00 Node address: 1 (0x1) Group address: 1 (0x1) Protocol version: 1.1 Watchdog resets: 0 Channels: 0: ADC0 32bit 1.15204 volt 1: ADC1 32bit 0 volt 2: ADC2 32bit 0 volt 3: ADC3 32bit 0 volt 4: ADC4 32bit 0 volt 5: ADC5 32bit 0 volt 6: ADC6 32bit 0 volt 7: ADC7 32bit 0 volt 8: DAC0 32bit 0 volt 9: DAC1 32bit 0 volt 10: P1 8bit 255 (0xFF) byte Configuration Parameters: 0: ADCAvrg 8bit 8 (0x08) counts 1: Gain0 8bit 0 (0x00) byte 2: Gain1 8bit 0 (0x00) byte 3: Gain2 8bit 0 (0x00) byte 4: Gain3 8bit 0 (0x00) byte 5: Gain4 8bit 0 (0x00) byte 6: Gain5 8bit 0 (0x00) byte 7: Gain6 8bit 0 (0x00) byte 8: Gain7 8bit 0 (0x00) byte 9: GainCal 32bit 1 factor 10: BipCal 32bit 0 volt node0x1> node0x1> write 8 1.25 node0x1> read 1 32bit 0x880432 volt node0x1>The
scan
command scans the whole bus and looks for active nodes, which
then can be addressed individually.
The info
command retrieves information directly from the node,
while the write
and read
commands are uses to transfer data to/from individual
channels on the node. The command line program can also be calles from scripts to
perform more complicated operations.
Here is a screenshot of an included example application:
It writes a voltage of 0..10 V to the DAC channel 1 of node #1 and reads back the ADC from channel 3, which is connected directly to the DAC, so that the readback and the demand value are identical.
For further questions please contact the author.