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.

16F877A with 7segment sourse code

Status
Not open for further replies.

sonic05

Member level 1
Joined
Mar 14, 2010
Messages
32
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Manila
Activity points
1,580
16F877A with 7segment

hi^^

i have a project that using 16F877A with 7segment but i dont how to use PORTA to make a program that number tirigger to nxt 7segment plz help me to make a program that the 7segment counting up by using this microcontroller and PORTA and PORT B

0-59 seconds


plzzz i need ur attention plzzz^^ thank you,,
 

Re: 16F877A with 7segment

Im sorry I dotn understand what you are asking. Are you saying that you know how to use PORT B and D but not A?
 

16F877A with 7segment

yah,,im sorry for that,, ihave a project that 7segment will count in seconds but i dont know how to use port A,,
 

Re: 16F877A with 7segment

Could you be a little more specific. What are you able to do so far? Why are you concerned with PORTA are you able to get it working on PORTB?
 

Re: 16F877A with 7segment

yah,,,,and this is the circuit that i want to use but i don't know how i program it,,
 

Re: 16F877A with 7segment

SHow me our code so far, are you writing in Asm or C?
 

Re: 16F877A with 7segment

sonic05 said:
hi^^

i have a project that using 16F877A with 7segment but i dont how to use PORTA to make a program that number tirigger to nxt 7segment plz help me to make a program that the 7segment counting up by using this microcontroller and PORTA and PORT B

0-59 seconds


plzzz i need ur attention plzzz^^ thank you,,

Hi,

What kind of 7 segment display do you have ?
Your schematic is a bit "strange" to me ...
You have to make sure that PORTA is configured as a digital output port :

CMCON = 0x07 ; // turn off comparators
ADCON1 = 0x07 ; // turn off analog inputs

Take a look at this example (asm) :
https://www.mikroe.com/en/books/picbook/7_08chapter.htm
 

16F877A with 7segment

@aj9999 the program that i use is C,,

#include <16F877A.h>
#byte port_a=5
#byte port_d=8
#use delay(clock=4M)
byte CONST ZERO[1]={0x3F};
byte CONST ONE[1]={0x06};

void main(void)
{
while(1)
{
output_d(ZERO);
output_low(PIN_A2);
delay_ms(2000);
output_high(PIN_A2);
output_d(ONE);
output_low(PIN_A1);
delay_ms(2000);
output_high(PIN_A1);
}}

tnx 4 ur help^^

Added after 2 minutes:

@hugo the 7segment that i use is only single and common cathode but i don't know how to make a program that the port will become output or input in the 7segment


tnx 4 ur reply^^
 

Re: 16F877A with 7segment

As far i understand is that you are confused how to select the appropiate 7-segment for displaying value.Try this may be this will work

Code:
#include <16F877A.h> 
#use delay(clock=4M) 

int zero=3,one=4;

void main(void) 
{ 
while(1) 
{ 
output_high(PIN_A2);
output_d(zero); 
output_low(PIN_A2); 
output_high(PIN_A1); 
output_d(one); 
output_low(PIN_A1); 
delay_ms(2000); 
}
}

Also you have to connect a resistor between base of the transistor and microcontroller pin.
 

Re: 16F877A with 7segment

help me to correct this program plz
 
  • Like
Reactions: sabree

    sabree

    Points: 2
    Helpful Answer Positive Rating
16F877A with 7segment

When you run any of these programs what does the display do? Does anything turn on? can you turn on and off the segments just by detaching them from the microcontroller and applying power to them?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top