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.

programming:display 3 digit..help me 'fix' the codes

Status
Not open for further replies.

ieda

Newbie level 3
Joined
Aug 18, 2008
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
hi! can someone help me... i want to display the heart beat on 7 segment display using PIC 16F877..the counter will reset every 60 seconds. and if the counts exceed for example 80, the alam will on... each 7segment display from 0 to 9

my question are:
1)I hv problem on how to display 3 digits..unit -->tens-->hundreds ( my display part)

2) as u can see, i can't organize my coding very well... i dun really understand the c -code format. i dun know how to call my display into my main program..i try but..
in other word, i dun know how to write to make my programmes flow correctly.

3) to detect my sensor :
if (PORTA.F4 ==1) // connect port A to sensor
{
counter =0;
while (1) {
// then i dun know how to 'connect' this part with my display part and my main part


3) i set the timer to reset the counter every 60 seconds, but my lec ask me to just count for 15 seconds and then multiply it by 4..how can i change my programmes


**i already defined all the 7segment interface**

}
Code:
void main(void){

TRISA=0xFF;  // PORT A as input
TRISB=0;      // PORT B  and PORT D as output
TRISD=0;
TMR1H= 0xFB;
TMR1L= 0x1D;
TICON =0b00101001   //enable Timer 1
PIR1.TMR1IF=0;         // Clear timer 1 interrupt flag
PIE1.TMR1IE=1;         // Enable timer 1 interrupt
INTCON.GIE=1;         //Enable peripheril interrupt




//for display part

void display() {
  if (counter<10); 
                 {
                    case0 ; 
                    display_port = 0b00000011;
                    break;
   
                    case1;
                    display_port = 0b10011111;
                    break:
                     . 
                     .
                     .
                     .// till case9
                 } 
          }


void interrupt() {
      if(PIR1.TMR1IF)
         {
              counter++; 
                TMR1H= 0xFB;
                TMR1L= 0x1D;
                PIR1.TMR1IF=0;

             }
         }        


void alarm() {
 if (counter >80);
  PORTD.F2 = 1;
  delay_ms(1000);
  PORTD.F2 = 0;
}

maybe someone can post any site that can help me with this..example..anything..i look at quite many examples, but still dun fully understand...so, i start by doing it part by part.. i'm sorry if this probs only a 'small' prob with u guys...but i already make some effort to do it myself, but still can;t do it correctly... sorry for my eng...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top