In this post i will be talking about the interface used in this project that was used to connect the software with the hardware.
The USB 1208LS by Measurement Computing is a digital and analog I\O interface. Being used as an interface, means you have to keep it hooked to the computer, unlike the microcontrollers that contains memory to store the code. The price of this thing is large compared to other microcontrollers, and there was no other way I was going to use it if it were no in the schools lab!
This product is most suitable for unmobile projects like building a 3D printer, or a robot with a laptop on board.
The set-up for this device is pretty straight forward, the pin configuration which are located in the user’s guide are clear. All you will need is downloading instacal , the software that activates the device – Driver, and downloading a .Net library for C# – MiniMccBoard.dll which contains the commands to send to the I\O pins.
Pin configuration and digital channels:
that figure, taken from the user guide, shows the pinout of the device. As observed, the left side contains 2 ports; port A and B, where each one includes 8 pins: port A = pins 21->28 and Port B = pins 32->39, those 2 ports are the Digital pins, one of them is an output, and the other is the input, the user determines this. For this project we will be using only Port A as an Output.
Now let’s start our program, but first we will want to define it:
static USB_1208LS.MiniMccBoard board = new USB_1208LS.MiniMccBoard(0);
static void Main(string args)
the commands that control the interface are:
board.FlashLED(); //the LED which is on the board itsef
board.SetDigitalOutput(write channel number:0/1 , number between 0-255); *since you have 8 pins in each channel so in binary 11111111 = 255.
int input = board.GetDigitalInput(number between 0-255);
board.SetAnalogOutput(0-7since there is 8 analog input channels, float value ranges between 0-5 volts);
float input = board.GetAnalogInput(insert the analog channel number 0-7);