PIC18F4520 – Interfacing Switch

PIC18F4520 Mini Development Board has 3 Switches (SW1,SW2 & SW3) connected to port pins RC3, RC2 & RB5 via jumpers J8, J9 & J15 respectively. These switches are externally pulled up to +5V. On shorting these jumpers, the switches can be used as pull_up keys and if the jumpers are left open, then the port pins can be used independently.

Schematic


Note:
To use the pull-up keys, don’t forget to short the jumpers J8, J9 & J15. Leaving them open frees RC3, RC2 & RB5 and can be used for any other desired purpose.

Sample Code

Sample code to test the switches is given below. In the code, switch press is detected by polling and upon pressing a switch, its name gets displayed on the LCD.

Topics related to PIC18F4520 Mini Development Board

  1. PIC18F4520 Mini Development Board – Overview
  2. PIC18F4520 Mini Development Board – Interfacing LED
  3. PIC18F4520 Mini Development Board – Interfacing LCD
  4. PIC18F4520 Mini Development Board – Serial communication(USART)
  5. PIC18F4520 Mini Development Board – Interfacing Switch
  6. PIC18F4520 Mini Development Board – Interfacing Buzzer
  7. PIC18F4520 Mini Development Board – Interfacing  POT(ADC)
  8. PIC18F4520 Mini Development Board – Interfacing Temperature sensor
  9. PIC18F4520 Mini Development Board – Interfacing Servo Motor
  10. PIC18F4520 Mini Development Board – Interfacing μRFID

Resources

How to buy?

SupportPlease share your ideas with us, visit our forum for discussion

 

Leave a Reply