Month: September 2011

C Circuits

Switches and interrupts on a PSoC 1 Microcontroller

I. Introduction / Summary The most practical way for a microcontroller to retrieve input is via interrupt.  The vast majority of modern processors have interrupt functionality.  This functionality allows a processor to work on background tasks while no input has happened. Once input is detected, the processor diverts its attention to react, then returns to where it left off after the interrupt has been serviced. II. Description and Circuit Diagrams An optical encoder is connected to VCC and ground to provide power to its internal emitters, detectors, and squaring circuitry.  The encoders outputs are connected to P1[4] and P1[5] on […]

C

Polling a switch Using a PSoC 1 Microcontroller

     One way for a microcontroller to retrieve input is known as polling.  Polling means repeatedly measuring  a sensors value.  I will describe how to poll a pushbutton switch  and react to its measurement when using a Psoc3 microcontroller.   /* * Filename: switchpolling.c * * Title: Polling a switch with a Psoc microcontroller * * Description: This source code file is used with a Psoc 3 microcontroller to poll a switch. * Upon detecting a change in the switches state, An LCD is updated to display the number of * times the switch has been closed in Hex […]