Page 1 of 1

ECIO_Transmit return codes

Posted: Fri Apr 24, 2015 10:24 am
by singerinst_ben
Hi there,

Do you have a reference anywhere of the return codes from the MIAC to the ECIO_Transmit function?

Regards,

Ben

Re: ECIO_Transmit return codes

Posted: Mon Apr 27, 2015 10:42 am
by Benj
Hello Ben,

Are you referring to this?

http://www.flowcode.co.uk/wiki/index.php ... _Module%29

Re: ECIO_Transmit return codes

Posted: Mon Apr 27, 2015 11:47 am
by singerinst_ben
Hi Benj,

Yes we have been referring to that page.

Specifically we were after the return codes from the functions ECIO_Open and ECIO_Transmit. They return an int based on the result of the function but we have no idea what that int means. For ECIO_Transmit we have received 0, 1, 5, and 31 at different times. From what we can determine 0 is when there is no MIAC connected, 1 is OK, but we have no idea what rturn values 5 and 31 mean.

For example in the VB examples, Example 1, Form1_Load there is the following code:

Code: Select all

		
Dim lRetVal As Integer
lRetVal = ECIO_Open(0, sID(0))
ECIO_Open is declared as:

Code: Select all

Private Declare Function ECIO_Open Lib "ECIO_api.dll" (ByVal index As Integer, ByRef pVID_PID As Byte) As Integer
But the value assigned to lRetVal is never checked, and we have no idea what the different return values can be. Sometimes when we transmit using ECIO_Transmit...

Code: Select all

Private Declare Function ECIO_Transmit Lib "ECIO_api.dll" (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) As Integer
...we receive different values as lRetVal, normally it is 1, which we take means OK, and any other value we handle as error, but it would be good to know what the different values actually mean so we can handle them accordingly rather than as a generic error.


Is there a reference for this anywhere?

Re: ECIO_Transmit return codes

Posted: Mon Apr 27, 2015 2:27 pm
by Benj
Hello,

This document has a lot of information, mostly towards the end of the document.

http://www.flowcode.co.uk/datasheets/LK8 ... ontrol.pdf

ECIO_Open attempts to establish a connection to the hardware, return of 0 represents a fail and 1 represents the hardware has been connected correctly.

ECIO_Transmit is a send and receive function, the return value I think gives you the number of bytes actually received but if not then this can also be collected via the pActualLenIn parameter.

Re: ECIO_Transmit return codes

Posted: Mon Apr 27, 2015 2:48 pm
by singerinst_ben
Hi Benj,

That document is useful thanks.

That is interesting that the return value is the length, we were using pActualLenIn for length.

Regards,

Ben

Re: ECIO_Transmit return codes

Posted: Mon Apr 27, 2015 4:19 pm
by Benj
Hi Ben,

To be sure we based our ECIOAPI.dll on the Microchip MPUSBAPI.dll example. There should be documentation for this lying around somewhere on the web.

We basically took their source code under license, did a couple of very minor changes to simplify the interface and that was that.