Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Int_return

    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

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    As you're using HSERIN/HSEROUT, shouldn't RX_INT be PBP type instead?

    Don't forget to add ReEnterPBP.bas in your INCLUDE list.
    Last edited by mister_e; - 30th April 2008 at 19:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Talking Mister-e is right.

    Hi,

    I thought I could point this out. This forum is fortunate that there are less people like me. Late and lazy.
    BTW Steve everytime I see the avatar banging head on the keyboard I feel concerned. Please stop banging your head. Its costly. I mean the keyboard that is...
    Regards

    Sougata

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    LMAO! well this avatar is really me... if you feel concern... i'm sorry

    I see some other potential problem in the above anyways.

    From one of his previous post he says that
    ^SMGL: 1,"REC UNREAD","+27829554322",,"08/04/20,17:12:09+08"
    could be the incoming string... so obviously, using his HSERIN line, it may return to the INT routine and spining around and around. my 2nd suggestion add a little timeout like this...
    Code:
    IntLoop:
        HSERIN 10, GETOUT,[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]
    GETOUT:
    @ INT_RETURN
    this way + PBP type it should solve most, see all problems.

    HTH
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5


    Did you find this post helpful? Yes | No

    Smile

    Thanks mister-e the second suggestion with the time out did the trick, still not hundred present sure why it works like that but shore are glad it works
    Thanks again

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    look post 296... if i was right, your PIC will wait 'till the next time it receive ^SMGL: when the timeout is not used.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 22:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 21:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 21:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 07:32
  5. Replies: 1
    Last Post: - 1st November 2006, 04:11

Members who have read this thread : 6

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts