Encoder rotary for the simulation

A forum where Flowcode v7 user created components can be shared, discussed and reviewed.

Moderator: Benj

Post Reply
jojo31
Posts: 12
Joined: Sun Jan 08, 2017 1:23 pm
Been thanked: 4 times
Contact:

Encoder rotary for the simulation

Post 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

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: Encoder rotary for the simulation

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

jojo31
Posts: 12
Joined: Sun Jan 08, 2017 1:23 pm
Been thanked: 4 times
Contact:

Re: Encoder rotary for the simulation

Post 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

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: Encoder rotary for the simulation

Post 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 250 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 253 times
Let us know how you get on.

jojo31
Posts: 12
Joined: Sun Jan 08, 2017 1:23 pm
Been thanked: 4 times
Contact:

Re: Encoder rotary for the simulation

Post by jojo31 »

Hi

I included one "SimQuadEnc" in "MCP23017_Encoder" component witch has INTA & INTB pins.
MCP23017_Encoder.fcfx
(18.04 KiB) Downloaded 241 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 5831 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

Post Reply