I'm using HI-TECH C PIC10/12/16 MCUs version 9.81 in MPLAB IDE.
I'm using PIC16F84A.
In my coding has interrupt service routine like this.
Code: Select all
void interrupt ISR(){
if(T0IF==1){
tmrofc++;
}
if(INTF==1){
float s=0;//distance in m
float ticks=0;
float time=0;
ticks=(float)((tmrofc*256)+TMR0);
time=ticks*1.6;
s=time*0.00346;
Display(s);
}
}
Code: Select all
Display(s);
Code: Select all
void Display(s){
unsigned char d0=0;
unsigned char d1=0;
d0=s%10;
d1=(s*10)%10;
RA0=1;
RA1=1;
getDigit(d0);
getDigit(d1);
}
Build C:\Users\Nandika\Desktop\PIC_Project\HC-SR04_Distance\101216HTC\range for device 16F84A
Using driver C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe
Make: The target "C:\Users\Nandika\Desktop\PIC_Project\HC-SR04_Distance\101216HTC\delay.p1" is up to date.
Make: The target "C:\Users\Nandika\Desktop\PIC_Project\HC-SR04_Distance\101216HTC\main.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" --pass1 C:\Users\Nandika\Desktop\PIC_Project\HC-SR04_Distance\101216HTC\main.c -q --chip=16F84A -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" -orange.cof -mrange.map --summary=default --output=default delay.p1 main.p1 --chip=16F84A -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C Compiler for PIC10/12/16 MCUs (PRO Mode) V9.81
Copyright (C) 2010 Microchip Technology Inc.
Serial number: HCPICP-654321 (PRO)
Error [712] C:\Users\Nandika\Desktop\PIC_Project\HC-SR04_Distance\101216HTC\main.c; 62. can't generate code for this expression
********** Build failed! **********
What is this error?
What is reason for this error?
I searched in some forums like Microchip,HI-TECH C forum...Some said it's a RAM problem(Not enough memory).I change PIC.
Some said HI-TECH C Lite mode not alowe for that.I change to Pro mode.
Finaly,Some said cant use Delay routine in ISR..
After commenting Display();,build successful.
Cant use another function in ISR?
I don't know really ISR.But,I have imagine [It's a another problem]
Please give me solutions for my questions.
Thank in advanced