Measurement Computing Digital I/O Device

From REALab Wiki
Jump to navigation Jump to search

To use this on a new computer, install the software using the Measurement Computing CD. Then run Instacal, your device should automatically be recognized, click OK to add.


Matlab code for turning on and off a simple light connected to pin 21 (port A0) and pin 29 (ground):

dio = digitalio('mcc', boardnum) %measurement computing device, ID=0
addline(dio, 0:7, 0, 'Out') %hwline=0:7, port=0,i.e. "A", direction=out
putvalue(dio.line(1),1) %switch on
putvalue(dio.line(1),0) %switch off

For a second light, you can either use pin 21(port A1) and pin 31(ground),

putvalue(dio.line(2),1) %switch light 2 on
putvalue(dio.line(2),0) %switch light 2 off

or you can use pins 32 and 40 and add the second port as follows:

addline(dio, 0:7, 1, 'Out') %hwline=0:7, port=1,i.e. "B", direction=out
putvalue(dio.line(9),1) %switch light 2 on
putvalue(dio.line(9),0) %switch light 2 off

Plato Goggles

The 2 pin setup of yellow=pin21, red=pin22, green=pin29 and black=pin31 can be used to control the Plato Goggles. (line 1 = left lens, line 2 = right lens)