We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi I am controlling the tilt/pan operations of a camera using a c167 microcontroller and i would like to use a microswitch as an end stop to stop the camera turning to far. Please could you give me some advice on to get the microcontroller to recognise when the switch has been pressed. Thanks John
Hi, you need to use a free processor portpin - best one which is capable of external interrupt. For example P2.8 on a C167. Connect the switch between this Portpin and GND and connect a pullup resistor - for example 10 kiloohms between Portpin and +5V processor supply. You also should connect a small capacitor (100nF) from portpin to GND to avoid signal distortion. Configure the portpin as input and interrupt on falling edge. As the switch is pressed, the voltage on the pin drops from +5V to zero and the isr is called.