Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

why the code working with PIC16f84a and not in PIC16f877a ? MIKROC & isis proteus

Status
Not open for further replies.

mot1639

Member level 1
Joined
Jul 10, 2011
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,513
hi all

i am trying to switch LED in PIC16f877a when i press push button..
it work with PIC16f84a and not in PIC16f877a ...
where is the problem
i build the circuit in isis proteus .... it work for PIC16f84a and not with PIC16f877a ...
333.jpg
Code:
void main() {
  ADCON1=1;
TRISA=0xff;
TRISB=0;
PORTB=0;

while(1){
if (RA2_bit==0){
PORTB=0xFF;
delay_ms(1000);
}
}
}

where is the Problem

regards for all and thanks in advance...
 

Re: why the code working with PIC16f84a and not in PIC16f877a ? MIKROC & isis proteus

as far as I can remember 16F877A has analog comparator on this pin and you need to disable it first
 
Re: why the code working with PIC16f84a and not in PIC16f877a ? MIKROC & isis proteus

16F877A has an analogue comparator and an ADC. You need to disable them.

Change your code to:
Code:
void main() {
ADCON1=7; //This disables ADC
CMCON = 7; //This disables analogue comparator
TRISA=0xff;
TRISB=0;
PORTB=0;

while(1){
if (RA2_bit==0){
PORTB=0xFF;
delay_ms(1000);
}
}
}

Hope this helps.
Tahmid.
 
Re: why the code working with PIC16f84a and not in PIC16f877a ? MIKROC & isis proteus

thanks for your support , it works now

regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top