Hereoncapecod
Joined: 08 Dec 2003 Posts: 4
|
INT_RDA no interrupt woes |
Posted: Fri Oct 08, 2004 9:47 am |
|
|
Hi,
I am using a PIC16F648A with version 3.160.
I am relying on the external keyboard INT_RDA interrupt for normal program operation. I never seem to get the interrupt. I think I also tried using ERRORS to the USE RS232 with no success.
Is there any chance there is a compiler error?
There is minimal chance that the RS-232 lines are noisy as I have been using the same cable setup for sveral other PIC projects with no problems.
Please find below the simplified program which still does not interrupt on INT_RDA.
Thank you
Bruce A
// CCS version 3.160
#include <16F648A.h>
//#device ICD=true
#include <stdlib.h>
#fuses hs, NOWDT, NOLVP, PUT,NOBrownOut
#define LED 48
#define EECS 40
#define EESCK 41
#define EESDO 42
#use delay(clock = 8000000 )
#USE RS232(BAUD=9600,XMIT=PIN_B2,RCV=PIN_B1,PARITY=N,BITS=8) // 9600.N,8,1
void CalcADFParam (void );
long GetDataVal(void);
void InitCond( void );
void SPI( IntValue, FracValue ); // send SPI data to ADF4153
void updateParam( void );
struct {
short int Uart; // indicates uart has received data
short int CW; // Continuous frequency output
short int Sweep; // indicates sweep from lower to upper limits
short int Valid; // indicates all valid parameters present
short int ADCalc; // true after calculating ADF1453 parameters
short int Error; // true if parameters are in error
short int x3; // true when interrupt has occured
short int x4;
}flag;
// wakes PIC from sleep mode and prompts for new INT divider
static int intr;
int i;
long j;
long k;
long l;
long Contint;
int32 dum;
long FracLower; // counter limit for lower frequency
long FracCtLower; // FRAC counter lower, must be less than Mod
long FracCont;
long FracUpper; // counter limit for upper frequency
long FracCtCont;
long FracCtUpper; // FRAC counter upper, must be less than Mod
long FreqCont; // CW frequency in mHz
long FreqLower; // Lower frequency in mHz
long FreqUpper; // Upper Frequency in mHz
long LowerInt; // calculated lower integer
long ModAD; // calculated Mod from the start frequency
int32 NoSteps; // Number of steps from low to high frequency
long stepsize; // step size in kHz
long period; // Period in Ms per scan
long UpperInt; // Calculated Int from end frequency
byte retval;
long CReg; // control register
long SReg; // spur register
int32 RReg; // R register and fractional register
int32 NReg; // Integer and Mod register
long Control;
Long Spur;
#int_rda
void serial_isr()
{
intr = true;
printf ("int");
}
// -----
void CalcADFParam (void )
{
printf("\n\rContInt:%5ld FracCont:%5ld ModAD:%5ld dum:%5ld",ContInt,FracCont,ModAD,dum);
}
// input up to 5 digit character string, terminates after 2nd,3rd, or 4th character if CR detected
long GetDataVal(void)
{
}// =====
void InitCond( void )
{
}// =====
void SPI( IntValue, FracValue ) // send SPI data to ADF4153
{
}
// ------
void updateParam( void )
{
char x;
}
// -----
void main()
{
char x; // dummy character
output_high( PIN_B0 );
printf("\r\n"); // turn LED ON
printf("\n\rSynthesizer vs 1.01a\r\n");
output_low( PIN_B0 ); // turn LED OFF
InitCond();
enable_interrupts(INT_RDA);
enable_interrupts(Global);
intr = false;
printf("\n\rPress any key\n\r");
delay_ms(1000);
while (intr == false)
{
output_high( PIN_B0 ); // turn LED OFF
delay_ms(300);
output_low( PIN_B0 ); // turn LED OFF
delay_ms(300);
}
sleepLoop:
printf("\n\rInt");
updateParam();
CalcADFParam();
intr = false;
enable_interrupts(Global);
while (intr == false )
{
if( Flag.CW ) // sleep in fixed frequency modes
{
SPI( ContInt, FracCont);
}
}
goto SleepLoop;
} |
|