|
|
View previous topic :: View next topic |
Author |
Message |
ozanbuyuk Guest
|
16f88 interrupt rs232 |
Posted: Mon Dec 31, 2007 9:04 am |
|
|
Please help me...
My code dosen't work...
#include <16F88.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B5,rcv=PIN_B2,bits=8)
#int_rda
void kesme()
{
disable_interrupts(int_rda);
printf("Kesme Calisiyor...");
output_high(Pin_B1);
}
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(GLOBAL); // Aktif edilen tüm kesmelere izin ver
while(1) // Sonsuz döngü
{
enable_interrupts(int_rda); // int_rda kesmesi aktif
}
} |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Dec 31, 2007 10:40 am |
|
|
In order to clear the interrupt flag you have to read the data from the UART or your code will never leave the interrupt routine. Add a call to getc() in your interrupt routine.
Also, after reception of more than 3 characters the UART will stall. Add the ERRORS keyword to your #rs232 line to automatically clear the overflow flags. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|