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.

rpm not compile

Status
Not open for further replies.

ana_cont

Junior Member level 2
Junior Member level 2
Joined
Jun 15, 2020
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
11
Activity points
128
Code:
const wh_length=11;
const pulse=36;
const meter_pulse=(100/wh_length)*pulse;
int   meter=0;
char  speedshow[30];
char  RPMshow[30];
char  distanceshow[30];
int   count_puls=0;
int   speed ;
int   rpm=0;
void Interrupcion() iv 0x0004 ics ICS_AUTO
{

  if (INTF_bit==1)
   {
    rpm = (1000/count_puls) * 60;
    speed = meter/count_puls;

   }

  INTF_bit=0;

  if (TMR0IF_bit){
    TMR0IF_bit         = 0;
    TMR0  = 6;
    count_puls++;
  }

}
  void InitTimer0(){
  OPTION_REG         = 0x81;
  TMR0               = 6;
  INTCON             = 0xA0;
}
void main()
{
UART1_Init(115200);
trisb.b0=1;
trisd=0;
InitTimer0();
   t1con=0;
   T1CKPS1_bit=0;
   T1CKPS0_bit=0;

  INTEDG_bit=1;
  INTF_bit=0;
  INTE_bit=1;
   GIE_bit=1;

  while (1)
  {
    if (count_puls>=meter_pulse){
    meter++;
    count_puls=0;
    }
    sprinti(speedshow,"n0.val=%d",speed);
    UART1_Write_Text(speedshow);
    UART1_Write(0XFF);
    UART1_Write(0XFF);
    UART1_Write(0XFF);

    sprinti(RPMshow,"n1.val=%d",RPM);
    UART1_Write_Text(RPMshow);
    UART1_Write(0XFF);
    UART1_Write(0XFF);
    UART1_Write(0XFF);


    sprinti(distanceshow,"n2.val=%d",meter);
    UART1_Write_Text(distanceshow);
    UART1_Write(0XFF);
    UART1_Write(0XFF);
    UART1_Write(0XFF);

  }


}
 
Last edited by a moderator:

If "not compile" is true, where's the error message?
 

Although the appropriate action is to encourage you to exercise a better elaboration on the question, I could not refrain myself to decipher the pieces of the question and guess that there could be an error in the syntax of the snippet below, where the uppercase variable RPM was not declared :

Code:
sprinti(RPMshow,"n1.val=%d",RPM);
 

uppercase variable RPM was not declared
Good guess.

Presumed, this is the only syntax error in the code, there are unfortunately much more semantic errors that prevent the code from giving the expected output.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top