0

When i define my code and run in proteus simulation, the leds which are connected to portA of PIC16F877 is not working. When i close the code like that "//use fast_io(A)" but i still use tris commands of port A, my leds are working which is connected to portA. So i can not lit the leds which is connected to portA when i use "#use fast_io(A)" command.I dont know why such thing occurs. First the leds are connected to portA.enter image description here

#use fast_io(A)
#use fast_io(B)
#use fast_io(C)

set_tris_a(0b00010000);
output_a(0x00);

set_tris_b(0b10111111);
output_b(0x00);

set_tris_c(0b00010000);
output_c(0x00);
Clifford
  • 88,407
  • 13
  • 85
  • 165
  • By default PORTA is analog. Switch it to digital with the `ADCON1` register. – Mike Feb 17 '22 at 10:39
  • When i write those above the main:#byte ADCON1 =0x9F #bit PCFG3 =ADCON1.3 #bit PCFG2 =ADCON1.2 #bit PCFG1 =ADCON1.1 #bit PCFG0 =ADCON1.0 and those inside the main: PCFG3=0; PCFG2=1; PCFG1=1; PCFG0=0; i still can not the leds – tensaiSakuragi Feb 17 '22 at 12:09
  • Please show your code and post a minimal reproducible example – Mike Feb 18 '22 at 06:45
  • Your diagram does not indicate what GPIO the LEDs are connected to. Please state. – Clifford Feb 18 '22 at 19:04

0 Answers0