MIAC in Visual Studio

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
singerinst_ben
Posts: 22
Joined: Fri Jun 20, 2014 4:41 pm
Location: England, UK
Has thanked: 10 times
Been thanked: 7 times
Contact:

MIAC in Visual Studio

Post by singerinst_ben »

Hi guys,

Sorry if this has been asked a 1000 times before, I've searched but can't find anything. Basically I want to communicate with the MIAC with either C#, C++ or VB.net, but preferably C#.

Which DLL do I need to reference?

Thanks in advance,

Ben

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC in Visual Studio

Post by Benj »

Hello,

This link may help as it has some VB examples in the VBINT directory.

http://www.matrixtsl.com/resources/getr ... php?id=173

I can probably dig out some more examples if needed.

singerinst_ben
Posts: 22
Joined: Fri Jun 20, 2014 4:41 pm
Location: England, UK
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: MIAC in Visual Studio

Post by singerinst_ben »

Thanks for the examples.

I've opened Example1 and UserProg, both use ECIO_api.dll, is this the DLL I need to reference? If so, do you have a full list of all the functions in the DLL?

Thanks again,

Ben

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC in Visual Studio

Post by Benj »

Hello,

Yes that is the DLL you need to use. These are the available functions.

int ECIO_GetDLLVersion ()

int ECIO_Open (ByVal index As Integer, ByRef pVID_PID As Byte)

int ECIO_Close ()

int ECIO_Transmit (ByRef pDataOut As Byte, ByVal dwLenOut As Integer, ByRef pActualLenOut As Integer, ByRef pDataIn As Byte, ByVal dwExpectedLenIn As Integer, ByRef pActualLenIn As Integer, ByVal dwTimeout As Integer)

int ECIO_GetDeviceCount (ByRef pVID_PID As Byte)

Here are some more examples for you to play with.
Examples.zip
(1.85 MiB) Downloaded 398 times

singerinst_ben
Posts: 22
Joined: Fri Jun 20, 2014 4:41 pm
Location: England, UK
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: MIAC in Visual Studio

Post by singerinst_ben »

That's brilliant, thanks a lot.

I've used the info found here to flash the MIAC USB slave firmware.

http://www.matrixtsl.com/mmforums/viewt ... ave#p52871

All seemed good untill I tried to send over the "EX6. Basic Slave" flowcode program to the MIAC - I got a "USB not open" error pop up with the following info:

Board Type: MIAC
IsOpen : no
ID from Board: 4640
Chip CmdLine: 18F4455
USB Hardware: USB\VID_12BF&PID_0120&REV_0103
USB Description: Matrix MIAC PLC
ADCval: 0.000000
Location: USBPICDriver.cpp @ 662 (USBPICDriver::WriteFLASH)

Any ideas? I using Windows 7 64 bit, at first I thought it was to do with still having the MIACprog.exe tool open, but that is now shut and I get the same.

Regards,

Ben

singerinst_ben
Posts: 22
Joined: Fri Jun 20, 2014 4:41 pm
Location: England, UK
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: MIAC in Visual Studio

Post by singerinst_ben »

When I the MIAC in it comes up as "USB device not recognized " is in Device Manager as "Unknown Device"... does the slave firmware need new drivers?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC in Visual Studio

Post by Benj »

Hello,

When creating your program for the MIAC do you have the MIAC selected as the Target or do you have the 18F4455 device selected? The MIAC is in the Misc section of the target list and should override the programmer setting so the MIACprog tool is used instead of the usual mLoader software which is what appears to be running for you at the moment.

singerinst_ben
Posts: 22
Joined: Fri Jun 20, 2014 4:41 pm
Location: England, UK
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: MIAC in Visual Studio

Post by singerinst_ben »

Thanks a lot, that was exactly what was the problem.

I'm a little confused. In the example there is a LCD screen, a couple of pots, a key pad and a USB slave. I'm guessing this is an example of using the ECIO setup as a slave. Is this example compatible with the MIAC? I'm now starting a new Flowcode and adding a MIAC USB Slave component, even without adding anything else if I try and compile to hex I get an error:

Slave testing stuff.c(541): error: error in expression

Which when I look at the underlying C code is the line:

Code: Select all

MX_MACRO1(DLL_USB_Rx_String[0], temp_str);
Is this the correct component to use? Basically all I want to do is setup a simple C#/VB.net program that allows me to all macros etc on the MIAC and get a result from these macros.

Thanks again for all your help.

Ben

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC in Visual Studio

Post by Benj »

Hello,

With the MIAC USB slave you essentially load the existing .hex firmware onto the MIAC and then you can use the MIAC USB Slave component to allow the Flowcode sim to control the MIAC.

The MIAC USB Slave component uses the ECIO dll which is what you can use in your C# program if you want to develop an app outside of Flowcode.

There is a good example available from here: http://www.matrixtsl.com/wiki/index.php ... _Module%29

singerinst_ben
Posts: 22
Joined: Fri Jun 20, 2014 4:41 pm
Location: England, UK
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: MIAC in Visual Studio

Post by singerinst_ben »

Hi Benj,

That's great, thanks a lot. The command table is really useful.

There's still something amiss... When I run the example 1 found in the archive it all appears fine (with the slave firmware loaded onto the MIAC) but none of the commands work, and the return value I get from the lines..

Code: Select all

Dim lRetVal As Integer
lRetVal = ECIO_Open(0, sID(0))
..is always 0 regardless of whether the MIAC is connected or not... I think this has something to do with the line "The MIAC USB Slave USB driver will need to be installed before Windows will correctly recognise the device and allow Flowcode to communicate correctly." because when I try and set the instance in Flowcode for the MIAC USB Slave the tooltip mentions that it is possible the driver is not installed.

Just to clarify - I am using WIndows 7 64 bit, which driver should I have installed for the MIAC USB slave?

Thanks again,

Ben

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC in Visual Studio

Post by Benj »

Hello,

The current driver for the slave is available from here. http://www.matrixtsl.com/wiki/images/6/ ... rmware.zip

Extract the "MIAC USB Slave Driver" folder to your desktop.

Next go to Windows device manager and select update driver for the device which is missing the driver. Manually select where the files are and point this to the extracted files.

I can wrap the driver files around an installer if this would make things simpler?

singerinst_ben
Posts: 22
Joined: Fri Jun 20, 2014 4:41 pm
Location: England, UK
Has thanked: 10 times
Been thanked: 7 times
Contact:

Re: MIAC in Visual Studio

Post by singerinst_ben »

Thank's so much! That has done the trick, all running as it should now!

Many, many thanks indeed!

Cheers,

Ben

Post Reply