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.
in visual basic i use the followin formula to extact the single bits out of a Byte, how do i do this in flowcode
Dim x As Long
x = bDataIn(1)
Me.x0 = (x And 1)
Me.x1 = (x And 2) / 2
Me.x2 = (x And 4) / 4
Me.x3 = (x And / 8
Me.x4 = (x And 16) / 16
Me.x5 = (x And 32) / 32
Me.x6 = (x And 64) / 64
Me.x7 = (x And 128) / 128
Hello Roy.
To do this you could use an array. To use an eight index array just drag a calculation box onto main of flowchart,
double click on it, then Click 'variables.' then Add New Variable...'
In the small window enter byte variable called: Number_Bit[8]
Or a variable name of your choice.
Also add another byte variable called Number then give it a value in a calculation box.
Then in a calculation box, enter the following :
Number_Bit[0] = (Number AND 1)
Number_Bit[1] = (Number AND 2)/2
Number_Bit[2] = (Number AND 4)/4
etc.
Or
Number_Bit[0] = (Number AND 1)
Number_Bit[1] = (Number AND 2)>>1
Number_Bit[2] = (Number AND 4)>>2
Or of course with your variables: Me[8] plus x of course
Me[0] = (x AND 1)
Me[1]= (x AND 2)/2
etc
not much different from VB at all!
Hope this helps