Examples Folder

P0-31    These are the files used in the examples given on the second page of the introduction


Rotary

The files show how to use a rotary encoder, they also have some tips on switch debounce in general. rotary.fth and rotarty2.fth are stand alone files that operated the switch on a polled basis. Two different approaches are taken to determine the rotation direction. Don't underestimate how difficult a job this is.

As another alternative the switch can be handled within a schedule (see Interrupts), the rotaty-shed.flb installs the switch into a scheduled time slot, it is then simply a matter of looking at a variable to see how fare the switch has been rotated. The switch is in fact continually poled in the background.

The switch represents two switches that are alternately switched on and off. The picture shows the actual switch used (now obsolete), this actually was very useful as it also incorporated a push switch.

When the switched were open, they were +ve held there by the resistors and closed they were connected to ground.