First of all thanx for the code my interups now gets handeled fast enoug so i dont loose any serial data, one problem for some reason my program do not return from the interupt.
Any ideas
i use a 16f913
Code:INCLUDE "MODEDEFS.BAS" INCLUDE "DT_INTS-14.bas" ; Base Interrupt System DEFINE OSC 20 ' Define crystal as 20Mhz '*Serial port Setup 9600 8N1* DEFINE HSER_BAUD 9600 ; 9600 Baud DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1 DEFINE HSER_CLROERR 1 ; Clear overflow automatically '*ADC setup* DEFINE ADC_BITS 10 'SETS NUMBER OF BITS IN RESULTS 8,10,12 DEFINE ADC_CLOCK 3 'SETS CLOCK SOURCE (RC = 3) DEFINE ADC_SAMPLEUS 50 'SETS SAMPLING TIME IN MICROSECONDS 'This Part set PORTA 0-5 an analog inputs ADCON1 = %01110000 'FRC (clock derived from a dedicated internal oscillator = 500 kHz max) ANSEL = %00011111 'The ANSEL (91h) and CMCON0 (9Ch)registers must be initialized to configure an CMCON0 = %00000111 'analog channel as a digital input. Pins configured as analog inputs will read ‘0’. TRISA = %00011111 'set PORTA 0-5 as inputs ADCON0.7 = 1 'Right justify output of ADC datasheet P145 of 16F913 TRISC = %10000000 'Set PORTC for serial coms and pins as output TRISB = %00000000 'Sert PORTb as outputs and for use with the ICD2 V1 var WORD ID var byte[28] CELL1 VAR BYTE[11] I VAR BYTE PORTC = 0 ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RX_INT, _IntLoop, ASM, yes endm INT_CREATE ; Creates the interrupt processor INT_ENABLE RX_INT ; enable external (RX) interrupts ENDASM Main: PORTC.5=1 PAUSE 200 PORTC.5=0 PAUSE 200 PORTC.5=1 PAUSE 200 PORTC.5=0 goto Main IntLoop: HSERIN [WAIT("^SMGL:"),SKIP 1 ,str ID\28] HSEROUT ["CELL NO:",_ ID[17],iD[18],ID[19],ID[20],ID[21],ID[22],_ ID[23],ID[24],ID[25],ID[26],ID[27],10,13] @ INT_RETURN END




Bookmarks