help pic 16f84a

Status
Not open for further replies.

killer_007

New Member
i want to make a circuit to make a led turn on when i push the push button

by using these code

void main()
{
TRISA=0B00011111;
TRISB=0;
loop:
if (PORTA.F0==0) { PORTB.F0=1; }
else {PORTB.F0=0; }
goto loop;
}
 
That should be like this
Code:
  void main()
  {
    TRISA=0B00011111;
     TRISB=0;
 loop:
     if (PORTA.0==0) { PORTB.0=1; }
     else {PORTB.0=0; }
     goto loop;
}
 
Last edited:
Welcome to the forums. You will need a little bit more code than that in order to make a successful program. What language are you using?

It would be worth looking at Nigel's site WinPicProg Page. He has some very good tutorials that explain how to wire up the hardware. He also uses a more up-to-date PIC that is still produced.
 
What's the problem with the circuit? Hook the switch up to the input line, and the led to the output line...
 
Killer you don't check to see if PORTA.F0 there isn't a port like that on a pic
Here this should get you started
 

Attachments

  • sw.PNG
    7.1 KB · Views: 206
be8, I did a quick google search there is PIC code out there that refers to the ports exactly as he did.. Might be the compiler.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…