Page 1 of 1

VB and 18f4550

Posted: Wed Aug 12, 2009 4:49 am
by Roy
Is there a white paper available for the VB example that can help me in understanding the Syntax required to successfully read the inputs and write to the outputs.
All I need to do now is how to read the variables into VB From the pic and write to the variables in the pic.

Re: VB and 18f4550

Posted: Wed Aug 12, 2009 7:31 am
by Roy
Can someone tell me if I am correct in analizing the following instruction
lRetVal = ECIO_Transmit(bDataOut(0), 3, nTxDataCnt, bDataIn(0), 32, nRxDataCnt, 500)
bDataOut(0) this is the number of the board
, 3, this is the macro 3 that will run ie the 3 condition in the service macro
The rest does not make sense to me

Re: VB and 18f4550

Posted: Wed Aug 12, 2009 8:44 am
by Benj
Hello Roy

Ok here goes

lRetVal = ECIO_Transmit(bDataOut(0), 3, nTxDataCnt, bDataIn(0), 32, nRxDataCnt, 500)
  • lRetVal - Was the command succesful?
  • bDataOut(0) - First byte in output data buffer
  • 3 - Number of bytes to try and send
  • nTxDataCnt - Actual number of bytes sent
  • bDataIn(0) - First byte in input data buffer
  • 32 - Number of bytes to try and read
  • nRxDataCnt - Actual number of bytes received
  • 500 - Maximum time to wait in milliseconds for the incoming data

Re: VB and 18f4550

Posted: Wed Aug 12, 2009 8:59 am
by Roy
Thks i will study it carefully
However once this data has been sent how in the flowcode macro do i analize this
if i could have an example of how to put on an output and read in an input say a analohue in

Re: VB and 18f4550

Posted: Wed Aug 12, 2009 11:41 am
by Benj
Hello

In the flowcode macro you get the data as a string or as bytes. If you are reading as bytes then you will read the array sent fro the PC a byte at a time. If you are reading as a string then you will get the complete array.

Similarily with the send bytes or strings. These are the values used in the return values.

There are working examples for each of the USB components complete with VB source code so you should be able to see from these how the data is coming in and out of the system.

Re: VB and 18f4550

Posted: Wed Aug 12, 2009 12:12 pm
by Roy
I have studied the examples and just cannot get it right, am I correct in saying the first 3 bytes sent are stored in the macro.a,macro.b and macro,c variables.
Macro.a determines the subroutine to be performed
Therefore if I send 0,0,50
We will output the first routine, setting outputs according the the macro.b value

Re: VB and 18f4550

Posted: Thu Aug 20, 2009 11:58 am
by Benj
Hello Roy

Yes in the 3 byte example the first three bytes are passed as the parameters A, B and C. This is defined in the properties of the USB component to match the properties of the slave service macro. You do not have to use these parameters and can instead use the Component Macro read functions if you wish. Examples demonstrating different functions of the slave service routine are also available from the examples folder.