SELECTING


Page 19
INDEX

Some microcontroller applications require a choice of features to be available to the user, such as a range of effects on a display, different games, a selection of products, sizes etc. 
To cater for these, a set of buttons can be provided, or a rotary switch. 
But an easier design is to provide a pot with the choices marked around the circumference. By turning the pot, each selection can be made. 
The program to do this is very similar to the sss to D experiment. In Expt , the output is displayed on the 7-segment display as numbers 0 - 9. 
Instead of displaying the numbers, the position of the pot is referenced to a table and this selects the appropriate program. 
In this discussion we present a complete program with 7 effects on the 8 LED display plus a program that can be used for your own routines.

A typical example for the selector is:

The pot selects one of  7 programs on the scale above. The arrow on the shaft points to the program selected. 
Any position of the shaft between the blue lines is picked up as the Toggle program, for example, and this makes it very easy to make a selection. 

more
  




1
MOVLoop1
RETURN
;8 loue on 7-segment display etc
;Increment FSR to make INDF go to next file 

NEXT