Page 1 of 1

Encoder rotary for the simulation

Posted: Tue Jan 23, 2018 1:57 pm
by jojo31
Hello,

The Encoder rotary component exist but not for the simulation like switch, slider, ...

Is it possible to have this new component because I am creating an other component (expander + 4 encoders)

Thank you very much

Best regards

Re: Encoder rotary for the simulation

Posted: Tue Jan 23, 2018 5:49 pm
by Benj
Hello,

The Encoder Rotary component under inputs should have simulation and also simulate the pin states. What parts of the simulation are you currently missing?

Re: Encoder rotary for the simulation

Posted: Tue Jan 23, 2018 6:03 pm
by jojo31
Hello

I need this component without pins connection because it is integrated in my new component that I want to simulate.

The new component is an MCP23017 connected to several rotary encoder.

Best regards

Re: Encoder rotary for the simulation

Posted: Tue Jan 23, 2018 6:20 pm
by Benj
Have a go with this and see if it does what you require.

Simply add to your v7 installation by copying the file below into your "Flowcode 7/components" folder.
SimQuadEncoder.fcpx
(3.1 KiB) Downloaded 265 times
The two pin states can be collated from the ReadCounter macro.

Pin1 = Counter & 0x01
Pin2 = (Counter & 0x02) >> 1

Also here is the source project if you want to have a play with it.
SimQuadEnc.fcfx
(21.16 KiB) Downloaded 266 times
Let us know how you get on.

Re: Encoder rotary for the simulation

Posted: Sat Jan 27, 2018 11:47 pm
by jojo31
Hi

I included one "SimQuadEnc" in "MCP23017_Encoder" component witch has INTA & INTB pins.
MCP23017_Encoder.fcfx
(18.04 KiB) Downloaded 259 times
In the macro "CheckChangeSim" I read the counter of the "SimQuadEnc" and I check any change to set INTA.
MPC.JPG
MPC.JPG (61.02 KiB) Viewed 6442 times
But it's not a good solution, it's better if I can generate an interruption from the state of pin1 & pin2.

Click -> INT (SimQuadEnc) -> INTA (MPC23017_Encoder)

How to generate an interruption in the sub component "SimQuadEnc" that I can treat in the MCP23017_Encoder component ?

Is it possible to read a global variable set in "SimQuadEnc" linked with one property added in the "component properties" ?

Thank you for your help.

Best regards