Reading a push button is not working

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
ahmadalnokta
Posts: 1
Joined: 19 Dec 2023 12:36

Reading a push button is not working

#1 Post by ahmadalnokta » 19 Dec 2023 12:44

Hello, I have this simple issue. I'm using PIC16F18344 to turn on an LED when the button is pressed but it is not working.
LED --> RC5
push button --> RA5

This is the code:

void main()
{
TRISA.F5 = 1;
TRISC.F5 = 0;
PORTC.F5 = 0;

while(1){

if(PORTA.F5 == 1)
PORTC.F5 = 1;
else
PORTC.F5 = 0;

}
}

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: Reading a push button is not working

#2 Post by IvanJeremic » 21 Dec 2023 15:38

Hi,

You can find our button examples in MikroC PRO for PIC project manager.
Untitled.png
Untitled.png (15.18 KiB) Viewed 179 times
Regards,

Ivan.

aquadirector
Posts: 1
Joined: 18 Jan 2024 10:54

Re: Reading a push button is not working

#3 Post by aquadirector » 18 Jan 2024 10:55

Thank you the problem has been resolved. :)

Post Reply

Return to “mikroC PRO for PIC General”