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.

help needed to fix errors in rpm meter code

Status
Not open for further replies.

kilimont

Newbie level 2
Joined
Jun 23, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,305
i an getting errors for my program


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include <avr/io.h>
#include <avr/interrupt.h>
 
#include <util/delay.h>
 
 
#include "lcd.h"
 
volatile uint16_t count=0;    //Main revolution counter
 
volatile uint16_t rpm=0;   //Revolution per minute
 
volatile uint16_t rps=0;   //Revolution per second
 
 
void Wait()
{
   uint8_t i;
   for(i=0;i<2;i++)
   {
      _delay_loop_2(0);
   }
}
 
 
int main()
{
   
  LCDInit(LS_NONE);
 
   LCDWriteString("RPM Meter");
   LCDWriteStringXY(0,1,"- by kilimont");
 
   Wait();
   Wait();
   Wait();
   Wait();
 
   //Init INT0
   MCUCR|=(1<<ISC01);   //Falling edge on INT0 triggers interrupt.
 
   GICR|=(1<<INT0);  //Enable INT0 interrupt
 
   //Timer1 is used as 1 sec time base
   //Timer Clock = 1/1024 of sys clock
   //Mode = CTC (Clear Timer On Compare)
   TCCR1B|=((1<<WGM12)|(1<<CS12)|(1<<CS10));
 
   //Compare value=976
 
   OCR1A=976;
 
   TIMSK|=(1<<OCIE1A);  //Output compare 1A interrupt enable
 
   //Enable interrupts globaly
   sei();
 
   //LED Port as output
   DDRB|=(1<<PB1);
 
 
   LCDClear();
 
   LCDWriteStringXY(0,0,"RPM =");
   LCDWriteStringXY(0,1,"RPS =");
 
   while(1)
   {
      LCDWriteIntXY(6,0,rpm,5);
      LCDWriteIntXY(6,1,rps,5);
 
      if(PIND & (1<<PD2))
      {
         PORTB|=(1<<PB1);
      }
      else
 
      {
         PORTB&=(~(1<<PB1));
      }
 
      Wait();
   }
 
}
 
ISR(INT0_vect)
{
   //CPU Jumps here automatically when INT0 pin detect a falling edge
   count++;
}
 
ISR(TIMER1_COMPA_vect)
{
   //CPU Jumps here every 1 sec exactly!
   rps=count;
   rpm=rps*60;
   count=0;
}



Warning 1 implicit declaration of function 'LCDInit'
Error 2 'LS_NONE' undeclared (first use in this function)

Warning 3 each undeclared identifier is reported only once for each function it appears in

Warning 4 implicit declaration of function 'LCDWriteString'

Warning 5 implicit declaration of function 'LCDWriteStringXY'
Warning 6 implicit declaration of function 'LCDClear'
Warning 7 implicit declaration of function 'LCDWriteIntXY'
 
Last edited by a moderator:

LCDInit(LS_NONE);
What i think in this function LCDInit(Spelling incorrect) and try LCDInit();like this or Make your own Lcd initialkize fuction you must be working on 16x2 JHD LCD...!!

- - - Updated - - -

and if it is 16x2 try your own function from book Mazidi..
 

Check both the lcd.h header file and accompanying source code file are located in the project directory. Also verify the routines used in your code are indeed prototyped in lcd.h.

BigDog
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top