binzer
Member
For some reason even though I turned off interrupts I seem to be getting one (Stack Underflow) and I am not sure why. Trying to learn to use timers. I am using MPLAB SIM, here is the code, there is a bunch of extra stuff in there for the rest of my project but I do not think that is the problem. I will take it out and retry also.
Code:
// JuneBug Info
// Buttons RB0, RB2, RB5.
// Analog AN1, AN3
// IR RB0
// LED's RA0, RA6, RA7
//
// configuration
#pragma*config OSC = INTIO2, WDT = OFF, LVP = OFF, PWRT = OFF, BOR = OFF, FSCM = OFF
#include <stdlib.h>
#include <p18f1320.h>
#include <usart.h>
#include <adc.h>
#include <delays.h>
#include <portb.h>
#include <timers.h>
// unsigned char config;
// unsigned int spbrg;
char str[8]="At Zero";
unsigned int tres;
int reslta0;
int reslts0;
char A1[5];
int reslta3;
int reslts3;
char B1[5];
void main(void)
{
OSCCON = 0x72;
// OSCCONbits.IRCF0=1;
// OSCCONbits.IRCF1=1;
// OSCCONbits.IRCF2=1; //set for 8Mhz
OpenTimer0( TIMER_INT_OFF &
T0_16BIT &
T0_SOURCE_INT &
T0_PS_1_256 );
while(1);
{
}
// while(ReadTimer0 !=0) ;
// {
// }
//
// putsUSART(str); //print string
}
Last edited: