PIC18F26K22 Switch and LED Control – electroSome
https://electrosome.com/topic/pic18f26k22-switch-led/feed/
Sat, 18 Mar 2023 04:53:07 +0000https://bbpress.org/?v=2.6.9en-UShttps://electrosome.com/topic/pic18f26k22-switch-led/#post-13490<![CDATA[PIC18F26K22 Switch and LED Control]]>
https://electrosome.com/topic/pic18f26k22-switch-led/#post-13490
Thu, 23 Feb 2017 13:27:36 +0000Afi Gee
Hi,
I am new to XC8 compiler and I need help. I want to compile a program to switch on 4 LED’s with different switches. I want to use PORTB for the switches and PORTC for the LED’s.
]]>
https://electrosome.com/topic/pic18f26k22-switch-led/#post-13580<![CDATA[Reply To: PIC18F26K22 Switch and LED Control]]>
https://electrosome.com/topic/pic18f26k22-switch-led/#post-13580
Sun, 02 Apr 2017 15:21:40 +0000Ligo George
It is very easy to do. Simply follow our first two MPLAB XC8 Tutorials, if you want to do it without using any interrupts. The only thing that you need to take care is the LAT register. PIC 18F microcontrollers have LAT register to solve Read Modify Write problems. So for writing data (controlling LED) you need to use LAT register instead of PORT. But for reading data you can use PORT as before.