Rotary switch

For general Flowcode discussion that does not belong in the other sections.
Post Reply
siliconchip
Posts: 34
http://meble-kuchenne.info.pl
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 16 times
Been thanked: 1 time

Rotary switch

Post by siliconchip »

Hi all
Im looking for examples on how to use the rotary switch but cant find any im after a 5 pin ive tried using the rotary switch 0-15 but cant work out how to use it as when configured as a 5 pin there are only 3 connections pin 1 pin 2 and pin 4 ?? thanks inadvance

Bob

chipfryer27
Valued Contributor
Posts: 2034
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 444 times
Been thanked: 674 times

Re: Rotary switch

Post by chipfryer27 »

Hi

I haven't used that component and I see that there isn't an example yet.

However by clicking the number of positions in Properties it appears that it is giving a binary output dependent on the number of positions. So if you had only one position it uses VDD and one pin.

Two pins gives a value of up to three (01/10 / 11) positions etc
Four up to 15 positions

I'm sure you get the idea.

Regards

siliconchip
Posts: 34
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 16 times
Been thanked: 1 time

Re: Rotary switch

Post by siliconchip »

Hi chipfryer
I agree with that but im unsure where to put the binary code in relation to the switch

Bob

chipfryer27
Valued Contributor
Posts: 2034
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 444 times
Been thanked: 674 times

Re: Rotary switch

Post by chipfryer27 »

Hi

I see what you mean. A bit confusing.

I'll have a closer look later and get back to you.

Regards

Bijumon
Posts: 49
Joined: Fri Dec 30, 2022 11:44 am
Has thanked: 19 times
Been thanked: 33 times

Re: Rotary switch

Post by Bijumon »

Hi,

It looks like this component is made for a BCD (Binary-Coded Decimal) thumbwheel switch (as shown in the attached picture), rather than a standard rotary switch with a common pin and individual position connections.
Unlike a standard selector switch, this unit outputs a 4-bit binary code (pins 1, 2, 4, and 8) corresponding to the selected digit (0–15).
Attachments
thumb wheel switch.jpg
thumb wheel switch.jpg (16.7 KiB) Viewed 80 times

Steve-Matrix
Matrix Staff
Posts: 1985
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 296 times
Been thanked: 459 times

Re: Rotary switch

Post by Steve-Matrix »

Can someone post a specific part number or datasheet for what you are wanting (especially if it is commonly used and/or standard), and we'll have a look at creating one.

chipfryer27
Valued Contributor
Posts: 2034
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 444 times
Been thanked: 674 times

Re: Rotary switch

Post by chipfryer27 »

Hi

As far as the component goes, attached is an example that hopefully explains it's operation. You mentioned five positions so that is what is being used,

In the chart I have a 3 x LED array connected to A0 - A2 and this will provide the binary output. The switch is connected to B0 - B2 (with VDD being a common).

There are two component macros, set position and get position.

Set position sets the value to whatever you want and in the example it sets it to "3".

In the loop it simply reads the current value of the switch (binary value) and displays on the LED array.

If you step through and in Simulation Debugger look at the variable Switch, you will see it reflecting the position.

Hope this helps.
Attachments
Rotary_Sw example.fcfx
(12.38 KiB) Downloaded 25 times

Post Reply