After reading this chapter, you should be able to create a project and write a program that uses inputs from switches and turns on outputs. We are going to start off by writing a program that will make the PIC wait until a switch connected to bit 0 of PORTA goes high. It will then light an LED on bit 0 of PORTB. The PIC will then wait until a second switch, connected this time to bit 1 of PORTA, goes high. When this happens, the LED on bit 0 of PORTB will be turned off. Note that both switches will be single momentary switches, that is, they will stay high only when they ...
2. Our First Program
Get C Programming for the PIC Microcontroller: Demystify Coding with Embedded Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.