[SOLVED] Connecting Two PIC 16F877

Status
Not open for further replies.
if(porta.f4==1){portb.f0=1;}
else{portb.f0=0;}
 

Hi,
I don't see the problem. I wrote this:
Code:
void main(void){
     TRISA.F4 = 1; //Input
     PORTB = 0; //Clear initial state
     TRISB = 0; //Output
     do{
        if (PORTA.F4 == 1){
           PORTB.F0 = 1;
        }else{
           PORTB.F0 = 0;
        }
     }while(1);
}

And it's fine.

Hope this helps.
Tahmid.
 
what is your proteus version?
 

i have same version

---------- Post added at 17:33 ---------- Previous post was at 17:30 ----------

I am simulating another circuit and it is working properly but i have some error do you know what these mean?
thanks

 

I'm not sure what they mean. Do one thing. Close the simulation window. Redraw the schematic and reload the program into the PIC program field. Try it again. Make sure you've used the right microcontroller in the simulation and in mikroC.

Hope this helps.
Tahmid.
 
yes, both mikroC and proteus are pic16f877, 8MHz
i have this problem with every simulation i do.
 

unsigned short mask(unsigned short num) {
switch (num) {
case 0 : return 0x3F;
case 1 : return 0x06;
case 2 : return 0x5B;
case 3 : return 0x4F;
case 4 : return 0x66;
case 5 : return 0x6D;
case 6 : return 0x7D;
case 7 : return 0x07;
case 8 : return 0x7F;
case 9 : return 0x6F;
}
}


unsigned short mask(unsigned short num);
unsigned short digit_no, digit10, digit1, digit, i;

void interrupt() {
if (digit_no==0) {
PORTA = 0; // Turn off both displays
PORTD = digit1; // Set mask for displaying ones on PORTD
PORTA = 1; // Turn on display for ones (LSD)
digit_no = 1;
} else {
PORTA = 0; // Turn off both displays
PORTD = digit10; // Set mask for displaying tens on PORTD
PORTA = 2; // Turn on display for tens (MSD)
digit_no = 0;
}
TMR0 = 0; // Reset counter TMRO
INTCON = 0x20; // Bit T0IF=0, T0IE=1
}

void main() {
OPTION_REG = 0x84; // Set timer TMR0
TMR0 = 0;
INTCON = 0xA0; // Disable interrupt PEIE,INTE,RBIE,T0IE
PORTA = 0; // Turn off both displays
TRISA = 0; // All port A pins are configured as outputs
PORTD = 0; // Turn off all display segments
TRISD = 0; // All port D pins are configured as outputs

do {
for (i = 0; i<=99; i++) { // Count from 0 to 99
digit = i % 10u;
digit1 = mask(digit); // Prepare mask for displaying ones
digit = (char)(i / 10u) % 10u;
digit10 = mask(digit); // Prepare mask for displaying tens
Delay_ms(1000);
}
} while (1); // Endless loop
}
 

with Proteus???

is your Proteus original?
mine is cracked version
 

Here check this:
Make sure all your connections and everything in hardware is fine. I think it's more of a hardware problem.

Hope this helps.
Tahmid.
 
i putted two resistor for seven segment as you did and mclr to 5v, no change
thanks for reply
 

Hi,
It shows a config 2. 16F877 has only 1 configuration byte. Can you upload your Proteus DSN file?
 
request download ticket | ifile.it

That's the complete file. Use the project "Junction2Way". I think there were a few problems, among which:
1) You can't have a project name starting with a number.
2) There can't be spaces in the name.

I think it's fine now.
Try it.

Hope this helps.
Tahmid.
 
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000 thanks
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…