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.

problem with 7 seg and pic16f877a

Status
Not open for further replies.

toto_na16

Member level 1
Joined
Feb 21, 2010
Messages
34
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
Egypt
Activity points
1,478
i want to make a incrementing output off number from 0-9 on 7-seg but i got unexpected output

the code :
Code:
void main(){
char x[10] = {192,294,164,176,153,146,30,248,128,152};
char i=0;
TRISD = 0x00;
while (1){
      PORTD = x [i];
      i= i +1;
      if (i>=20)
         i =0 ;

      delay_ms(1000);

}
}

and i have attached proteus simulation file


so i would be thankful if you helped me :|
 

i have edited ur code and tested it.
Code:
#include <pic.h>
#include <delay.c>
	void main(){
char x[10] = {192,294,164,176,153,146,30,248,128,152};
char i=0;
TRISB = 0x00;
while (1){
      PORTB = x [i];
      i= i +1;
      if (i>=10)
         i =0 ;

      DelayMs(1000);

}
}

hope this helps. i used picc lite to compile the code and picide simulator to test it.
 

toto_na16 said:
if (i>=20)
i =0 ;

|

just change 20 to 10 the code will work, i have not tested the code if not showing as you planed check for the segment code in your array
 

rajudp said:
toto_na16 said:
if (i>=20)
i =0 ;

|

just change 20 to 10 the code will work, i have not tested the code if not showing as you planed check for the segment code in your array

sorry i have changed it but in vain :cry:
 

hi

you must be using common anode 7 segment
please confirm that first

regards

ml
 

Hi toto,

See the attached files. You made some mistake in the array- instead of value '294' you need '249' and also instead of '30' you need '130'.

Also use 'digital' type LEDs for simulation. Remeber what I replied on your 'comparator' query.
 

matbob said:
Hi toto,

See the attached files. You made some mistake in the array- instead of value '294' you need '249' and also instead of '30' you need '130'.

Also use 'digital' type LEDs for simulation. Remeber what I replied on your 'comparator' query.

thanks for your help but i couldn't open the design file because of the newer version of Proteus you use

could you please send me the link of a newer version of Proteus and i am using windows 7

and very thanks to you :D
 

Hi toto,

Don't worry about the design. There isn't any significant modification. Try your old design with the hex file in the attachment. If it doesn't work, we will check it out.
 

    toto_na16

    Points: 2
    Helpful Answer Positive Rating
matbob said:
Hi toto,

Don't worry about the design. There isn't any significant modification. Try your old design with the hex file in the attachment. If it doesn't work, we will check it out.

thanks it works but in the newer version only ?

thanks alot
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top