A/D converter fails?


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    yes, i'm reading voltage's between 0-5VDC. i found out that it doesn't mather where i place the pause command(in the interrupt routine); it instant freez the pic forever. The AD routine is placed in a interrupt routine is it not possible to place a pause periode into a interrupt handel?

    note: timer0, timer1 and serial interrupt are activated.

  2. #2
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    any one ?

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Are you using BASIC or assembler interrupts?

    Can you post the code you're having problems with?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    i do not want to post the code; but i can email it to you. i'm using the basic interrupt routine (on interrupt goto handel)

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Are you clearing "all" interrupt flags before exiting your interrupt handler?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    Yes, but can i use a pause command in the interupt?

    Code:
    Disable ' interrupt handler
    Handle:
    
    if RCIF = 1 then ' serial intterupt
    RCIF = 0 ' clearing interrupt flags
    IF OERR THEN            ' Clear over-runs if OERR set
    CREN = 0             ' Disable USART receive
    CREN = 1             ' Re-enable USART receive
    ENDIF
    'Serial commands.
    endif
    
    
    IF TMR0IF = 1 THEN 'RECEIVE all A/D value's
    TMR0IF = 0
    gosub CoversionsAD
    gosub saftycontrol  'check al received value's
    ENDIF
    
    if TMR1IF = 1 then
    TMR1IF = 0
    gosub PacketSend
    endif
    
    TimeOut:
    resume
    enable
    Last edited by egberttheone; - 13th February 2006 at 18:14.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You can use all the pause statements you want inside a BASIC interrupt, however, I don't recommend you place gosubs in your interrupt handler.

    This exits the interrupt handler, and if it lands in a sub routine where you are not disabling PBP's auto-insertion of interrupt checking stubs, then it's going to go totally nuts on you.

    Place all of your routines inside the interrupt handler, or set/clear some type of flags to indicate the interrupt source, then return, then act on the other sub routines as needed.

    Also note that RCIF can NOT be cleared with RCIF = 0. The only way to clear RCIF is to read the fifo USART buffer until it's empty. Trying to clear this flag like you are, you're leaving it set, and never clearing the USART interrupt flag bit.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Replies: 9
    Last Post: - 31st July 2008, 08:56
  2. A/D converter sample
    By allan josephus in forum mel PIC BASIC
    Replies: 5
    Last Post: - 23rd February 2008, 19:44
  3. A/D converter with pic16f84, i need a help
    By micro in forum General
    Replies: 0
    Last Post: - 13th December 2005, 21:17
  4. help with pic16f870 a/d converter
    By cammo in forum mel PIC BASIC
    Replies: 3
    Last Post: - 22nd March 2005, 05:16
  5. Re Cs5532 A/d Converter
    By massquip in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th April 2004, 16:31

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