Circuit reliability issues


Closed Thread
Results 1 to 6 of 6

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    can you try to use PrimoPDF to post your Schematic?
    http://www.primopdf.com/

    PrimoPDF is free and really nice, not sure 'bout the final PDF size so far

    It also seems to have something to do with the ISR, about DISABLE/ENABLE/RESUME 'round your ISR
    Last edited by mister_e; - 22nd November 2007 at 18:15.
    Steve

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

  2. #2
    Join Date
    Nov 2007
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    mister_e,

    Thanks for the suggestion, I tried convertingthe file to PDF but it still comes in at 370Kb...
    Still too much to post on here.

    Please tell me more about this interrupt handling issue, you seem to have spotted something that eludes me. Of course, If the problem was with the ISR, then it would cause the erratic behavior I've been experiencing...

    Thanks for the help!

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


    Did you find this post helpful? Yes | No

    Default

    Try to ZIP your PDF, or send it to my e-mail.
    Quote Originally Posted by MCS help file --- On Interrupt
    The most notable place to use DISABLE is right before the actual interrupt handler. Or the interrupt handler may be placed before the ON INTERRUPT statement as the interrupt flag is not checked before the first ON INTERRUPT in a program.
    Code:
    ON INTERRUPT GOTO serialin		' Declare interrupt handler routine
            '
            '
            '
            '
    ' Subroutines
    
    DISABLE					' Don't check for interrupts in this section
    
    getbuf:					' move the next character in buffer to bufchar
    
    	index_out = (index_out + 1)			' Increment index_out pointer (0 to 63)
    	IF index_out > (buffer_size-1) THEN index_out = 0	' Reset pointer if outside of buffer
    	ADDRESS = addressbuffer[index_out]			' Read buffer location
    	COMMAND = commandbuffer[index_out]
    RETURN
    
    
    error:					' Display error message if buffer has overrun
    	errflag = 0			' Reset the error flag
    	CREN = 0			' Disable continuous receive to clear overrun flag
    	CREN = 1			' Enable continuous receive
    	GOTO main		' Carry on
    	
    	
    ' Interrupt handler
            '        Where's the Disable???
    serialin:				' Buffer the character received
    IF PIR1.5=1 THEN                        'IF THIS IS A USART INTERRUPT....   
    	IF OERR THEN usart_error			' Check for USART errors
    	index_in = (index_in + 1)			' Increment index_in pointer (0 to 63)
    	IF index_in > (buffer_size-1) THEN index_in = 0	'Reset pointer if outside of buffer
    	IF index_in = index_out THEN buffer_error	' Check for buffer overrun	
    		HSERIN badparity,10,badparity,[addressbuffer[index_in],commandbuffer[index_in]]          		' Read USART and store character to next empty location
    	IF RCIF THEN serialin				' Check for another character while we're here
    ENDIF
    	
    RESUME					' Return to program
    
    badparity:
    IF index_in=0 THEN
    index_in= (buffer_size-1)
    ELSE
    	index_in = (index_in - 1) 	 ' Move pointer back to avoid corrupting the buffer.
    ENDIF
    GOTO main
    
            '        You don't even need it as you used HSER_CLROERR define.
            '        Let's say CLROERR don't work, YOU DON'T WANT TO use a GOTO inside the ISR 
            '        or you'll experiment a stack overflow/underflow one day or another.  Same rule apply in badparity sub.. which is also called somewhere in the main loop
    usart_error:
      errflag=1
      GOTO main
    
    
    buffer_error:
    	errflag.1 = 1		' Set the error flag for software
    IF index_in=0 THEN
    index_in= (buffer_size-1)
    ELSE
    	index_in = (index_in - 1) 	 ' Move pointer back to avoid corrupting the buffer.
    ENDIF	
    	
    RESUME					' Return to program
    MAYBE it's safe to place Disable BEFORE the ISR as long as there's another ENABLE somewhere after, but i don't see any

    Maybe there's something else, those are the first who jump in my face.

    HTH
    Steve

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

Similar Threads

  1. Comparator circuit thoughts....
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th October 2009, 07:04
  2. Circuit Design Question
    By bradb in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th August 2009, 09:18
  3. Short circuit portection circuit ?
    By iugmoh in forum Schematics
    Replies: 1
    Last Post: - 21st December 2008, 22:33
  4. Replies: 1
    Last Post: - 11th December 2007, 00:57
  5. Replies: 3
    Last Post: - 29th October 2006, 10:16

Members who have read this thread : 0

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

Posting Permissions

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