kylemaes
Banned
Hey, I have this interrupt that literally never ends I've debugged it all and it seems to be fine... I have never had it exit before and would like to fix it because I want the Main function to do stuff aswell no just a looping interrupt...
Here is my code: (Interrupt is at the bottom so you dont have to seach everywhere)
Here is my code: (Interrupt is at the bottom so you dont have to seach everywhere)
Code:
#include <p18f2550.h>
#include <delays.h>
#include <adc.h>
#pragma config PLLDIV = 12, CPUDIV = OSC1_PLL2, USBDIV = 2, FOSC = HS, FCMEN = OFF, IESO = OFF
#pragma config PWRT = ON, BOR = OFF, VREGEN = ON, WDT = OFF, PBADEN = OFF, LPT1OSC = OFF, MCLRE = OFF
#pragma config STVREN = OFF, LVP = OFF, DEBUG = OFF
#define E RA5
#define RS RA4
#define RW RA3
int interruptnum = 0;
int huns;
int remain;
int tens;
int ones;
int fare;
int huns2;
int tens2;
int ones2;
//__EEPROM_DATA(1,2,3,4,5,6,7,8); how to write to eeprom without using programmemory
const char ScreenData[39] = {
0x41, //A 0
0x42, //B 1
0x43, //C 2
0x44, //D 3
0x45, //E 4
0x46, //F 5
0x47, //G 6
0x48, //H 7
0x49, //I 8
0x4A, //J 9
0x4B, //K 10
0x4C, //L 11 //CHARACTER DEFINITIONS!
0x4D, //M 12
0x4E, //N 13
0x4F, //O 14
0x50, //P 15
0x51, //Q 16
0x52, //R 17
0x53, //S 18
0x54, //T 19
0x55, //U 20
0x56, //V 21
0x57, //W 22
0x58, //X 23
0x59, //Y 24
0x5A, //Z 25
0x20, //SPACE 26
0x3A, //: 27
0x30, //0 28
0x31, //1 29
0x32, //2 30
0x33, //3 31
0x34, //4 32
0x35, //5 33
0x36, //6 34
0x37, //7 35
0x38, //8 36
0x39, //9 37
0x25 //% 38
};
void Strobe_LCD()
{
E=1;
_delay(4000);
E=0;
}
/**********************************************************/
void Busy_Flag()
{
RW = 1; //read mode
while(RB7); //Loop until finished
RW=0; //default to write mode...
}
void Write_LCD(unsigned char d,unsigned char x) //USE "Write_LCD(tabledata,1=cap0=lowercase);" (IF number Cap selection must equal 0!)
{
char z = 0x00;
if(!x)
{
z=0x20;
}
TRISB=0x00;
PORTB=d+z;
Strobe_LCD();
Busy_Flag();
TRISB=0xFF;
}
void AddressDisplay(unsigned char c)
{
Busy_Flag(); //check LCD ready
RW = 0; //write mode
RS=0; //command mode
PORTB=c; //place data on data port
TRISB = 0; //PORTB output
Strobe_LCD();
RS=1;
TRISB = 0xFF; //PORTB input
}
void lcd_init()
{
Write_LCD(0x38,1);
Write_LCD(0x0C,1);
Write_LCD(0x01,1);
}
const char programnametext[16] = {
2,14,12,15,14,18,19,4,17,26,26,21,4,17,27,30
/*Co m p o s t e r V e r : 2*/
};
programname()
{
char a = 0;
char b;
char c;
Write_LCD(0x01,1);
RS = 1;
while(a != 16)
{
if((a==14) | (a==0) | (a==9) | (a==10) | (a==15) | (a==11)){c=1;}
Write_LCD(ScreenData[programnametext[a]],c);
c=0;
a++;
}
RS = 0;
}
void main()
{
TRISA=0;
TRISB=0;
TRISC=0;
ADCON0=0;
IPEN = 1; /* Set Priorities */
GIEL = 0; /* disable low priority interrupts */
GIEH = 1; /* enable high priority interrupts */
T1CKPS1 = 0;
T1CKPS0 = 1; //INTERRUPT SETUP TIMER0
TMR1CS = 0; /* Increment every instructrion cycle */
TMR1IP = 1; /* Make high priority interrupt */
TMR1ON = 1; /* Enable the timer */
TMR1IE = 1; /* Enable timer1 interrupt */
lcd_init();
programname();
while(1)
{
RS=1;
AddressDisplay(0xC0); //FANSPEED
Write_LCD(ScreenData[5],1);
Write_LCD(ScreenData[0],0);
Write_LCD(ScreenData[13],0);
Write_LCD(ScreenData[27],1);
Write_LCD(ScreenData[28+huns],1);
Write_LCD(ScreenData[28+tens],1);
Write_LCD(ScreenData[28+ones],1);
Write_LCD(ScreenData[38],1);
RS=0;
}
}
void interrupt isr(void)
{
TMR0IF=0;
}