SILLION BUG issue on ADC and get around required 16F1947 rev 2 silicon


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: SILLION BUG issue on ADC and get around required 16F1947 rev 2 silicon

    thanks Darrel,


    I have put this code in for the AN4 sensor only , however it seems i will have to do this for other A/D services for this rev of chip ????


    your DT_INTS-14.bas is included as part of this code for timer0 , and the variable GIE was already in use ,

    timer0 setup as 8ms timer , and this A/D routine is called from it after incrementing counters of timer0 = 5sec duration to do a read of the Voltage level


    couple of questions
    1. Is the duration of the sample time of 20us seemed long for 1 A/D channel ? as the spec sheet for conversion using FRC is about 1.6us average - a max period of 6uS
    2. i thought the sleep instruction ( low power mode ) may need to be issued prior to the conversion starting , or are all commands after a sleep command not actioned till sleep mode is terminated ?
    3. as this now monitors the interrupt for sleep to finish , then the duration of this routine must be shorter than any other generated interrupts using DT_INT14 else this will not work ??



    the code as it stands now
    waiting on a Battery power duration test to complete to see if this works ok

    Cheers

    Sheldon

    Code:
    Get_volts :
       ADON      VAR ADCON0.0         ; A/D converter Enable
       GoDone    VAR ADCON0.1         ; A/D conversion in progress 
       ADIE      VAR PIE1.6           ; A/D Interrupt Enable
       ADIF      VAR PIR1.6           ; A/D Interrupt Flag
       GIEsave   VAR BIT              ; Saves state of GIE
    
        
        ADCON0 =  %00010001           ' enable ADC AN4 ,( ADCON1 setup at start of program  , Right Justify, FRC clock  )
       
       y = 0                          ' ensure 0
      While Y < 10                    ' do 10 voltage reads
                                      ' silicon bug in rev2 of 16F1947 , requires ADC to be done in lowpower mode and with FDC osc clock internal 
                                      ' also ADCIN command wont work in sleep mode , interupts exit sleep mode  
            PAUSEUS 20                ; Acquisition time
            GIEsave = GIE             ; Save state of Global Interrupts  ( GIE defined in DT_INTS-14.bas )
            GIE = 0                   ; Disable Global interrupts
            ADON = 0                  ; reset A/D module
            ADON = 1                  ; turn on A/D module
            ADIF = 0                  ; Clear Analog Interrupt Flag
            ADIE = 1                  ; Enable Analog Interrupt
            GoDone = 1                ; Start Analog conversion
            @ SLEEP                   ; go to SLEEP
            ADIE = 0                  ; Disable Analog Interrupt
            GIE = GIEsave             ; Restore Global Interrupt state  ( GIE defined in DT_INTS-14.bas )
            value.HighByte = ADRESH   ; Get A/D result
            value.LowByte  = ADRESL         
               
           ' ADCIN 4 ,Value           ' Leave out for Rev 2 of 16F1947 - Read PortA.5 value into variable , this applies the fixed voltage ref (via ADCON0,ADCON1,FVRCON)
            gosub Average             ' Go do running average of ADC reading
            y = y+1                   ' Increment loop counter
      wend

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: SILLION BUG issue on ADC and get around required 16F1947 rev 2 silicon

    1) If you are only reading 1 channel, you don't need any acquisition time.

    2) When you put a PIC to SLEEP, all program execution STOPS.
    Some peripherals may continue to operate, but the program will not run again until it wakes up.

    3) When you put a PIC to SLEEP, the main oscillator is shut-down.
    If you are running TIMER0 from the system clock, it too stops during sleep, and your 8mS periods will be extended.
    DT

Similar Threads

  1. Possible PicBasic Pro ADC bug with 18F46k22
    By JimAvanti in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd February 2012, 21:20
  2. 18F2520 ADC issue
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 24th August 2009, 17:11
  3. 32.768kHz silicon oscillator (5v)
    By bogdan in forum Schematics
    Replies: 2
    Last Post: - 6th April 2009, 01:15
  4. Battery charger - power supply issue affecting ADC
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 14th December 2008, 01:12
  5. Microchip PIC silicon Revs's
    By fbraun in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st March 2005, 16:07

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