dnatechnical
Joined: 26 Nov 2009 Posts: 19
|
dspic30f6010a uart problem |
Posted: Mon Jan 11, 2010 9:10 pm |
|
|
I'm using dspic30f6010a, I'm trying to use uart with interrupt.
Here is my code, I'm not getting receive interrupt. Please any one can help me? Thanks.
Code: |
#include <30F6010A.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES PR //Primary Oscillator
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES WPSB16 //Watch Dog Timer PreScalar B 1:16
#FUSES WPSA512 //Watch Dog Timer PreScalar A 1:512
#FUSES PUT64 //Power On Reset Timer value 64ms
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV47 //Brownout reset at 4.7V
#FUSES LPOL_HIGH //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
//PWM module low side output pins have active high output polar
#FUSES HPOL_HIGH //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
//PWM module high side output pins have active high output polarity
#FUSES NOPWMPIN //PWM outputs drive active state upon Reset
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOCOE //Device will reset into operational mode
#FUSES ICSP1 //ICD uses PGC1/PGD1 pins
#FUSES RESERVED //Used to set the reserved FUSE bits
#use delay(clock=12000000)
#include <stdio.h>
#use rs232(UART1,baud=9600,parity=E,bits=8,errors)
char c;
#int_RDA
void RDA_isr(void)
{
c=fgetc();
clear_interrupt(int_RDA);
}
void main()
{
setup_spi(SPI_SS_DISABLED);
setup_spi2(SPI_SS_DISABLED);
setup_wdt(WDT_Off);
enable_interrupts(INT_RDA);
// TODO: USER CODE!!
loop:
delay_ms(200);
goto loop;
}
|
|
|