VB and 18f4550

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Roy
Flowcode V4 User
Posts: 17
Joined: Thu Jul 30, 2009 9:13 am
Location: New Zealand
Been thanked: 1 time

VB and 18f4550

Post 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.
Regards
Roy

Roy
Flowcode V4 User
Posts: 17
Joined: Thu Jul 30, 2009 9:13 am
Location: New Zealand
Been thanked: 1 time

Re: VB and 18f4550

Post 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
Regards
Roy

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: VB and 18f4550

Post 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

Roy
Flowcode V4 User
Posts: 17
Joined: Thu Jul 30, 2009 9:13 am
Location: New Zealand
Been thanked: 1 time

Re: VB and 18f4550

Post 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
Regards
Roy

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: VB and 18f4550

Post 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.

Roy
Flowcode V4 User
Posts: 17
Joined: Thu Jul 30, 2009 9:13 am
Location: New Zealand
Been thanked: 1 time

Re: VB and 18f4550

Post 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
Regards
Roy

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: VB and 18f4550

Post 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.

Post Reply