Jump to content
  • 0

MCC USB-SSR24 - C# Code Examples (Connect to device and read/set IO)


Nick8

Question

Hi,

 

I am working with the MMC IO Device USB-SSR24.  I am looking to control 5 different 24V air cylinders and read back 24V read switches based on each cylinder's position.  My application is using C# in visual studio 2019.  Is there any example code that I could look at to help me with this?

 

I have used the USB-1024HS from MCC before and have been able to connect and configure each port.  If I used this same code it is able to find the device but says the device is already in use.  I am not sure what to try next.

 

Code:


private MccDaq.MccBoard DaqBoard = null;

MccDaq.DaqDeviceDescriptor[] inventory = MccDaq.DaqDeviceManager.GetDaqDeviceInventory(MccDaq.DaqDeviceInterface.Any);

if (inventory.Length > 0)
{
DaqBoard = MccDaq.DaqDeviceManager.CreateDaqDevice(0, inventory[0]);
}

Questions:

  • Is there a different way to discover and connect to the device? Do I need to do something with the device for this to work?
  • What is the correct way to read/set the IO in C#?
  • Could you provide an example of how to wire for an input and example for an output?  

An example program to look at would be very helpful.  Appreciate any help.

 

Thanks,

Nick

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello @Nick8.

The Universal Library (UL) Help is a good resource for developers to utilize when programming. 

https://www.mccdaq.com/pdfs/manuals/Mcculw_WebHelp/ULStart.htm

Did you have another application communicating with the USB-SSR24, when you were prompted with "the device is already in use"?

Regarding device discovery, take a look at the Device Discovery section in the UL Help and the 'DaqDevDiscovery01' example.

image.png

 

The UL Help also lists several digital I/O examples for users to reference.

image.png

 

The USB-SSR24 User's Guide (https://www.mccdaq.com/pdfs/manuals/USB-SSR24.pdf

Which solid state relays are you using on the USB-SSR24?

Regards,

Fausto

Link to comment
Share on other sites

  • 0

Hi,

 

Thanks for the reply.  Honestly did not realize it did not come with relays.  This makes a lot more sense.  These are now on order (70-ODC5 and 70-IDC5).

I was able to connect to the device.  My issue was with Instacal holding the resource.  Once I removed the board from Instacal I was able to connect the same way I used before.  

I also tested the outputs without relays by setting them and reading them back to ensure they turned on and this seemed to work.

Read Input
            short DataValue = 0;
            MccDaq.ErrorInfo ULStat = DaqBoard.DIn(DigitalPortType.FirstPortA, out DataValue);

Set Output
            short dioOutVal = 0;
            DaqBoard.DOut(DigitalPortType.FirstPortA, dioOutVal);

Looking at the input relay, the input impedance looks like 1.8k ohms so if I am using 24V DC I should not need anything else to stay under the rated input current correct?

image.png.55dacf33ff6982b1a57ec48fb12abc97.png

Thanks,

Nick

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...