Menu

Additional A/D Speed Settings / ADFormat Q.

Help
2007-05-24
2013-05-30
  • Nobody/Anonymous

    I added some code to the a-d.h file to allow for additional a/d speed settings.

    #IFDEF Bit(ADCS2)
    SET ADCS2 OFF
    #IFDEF HalfSpeed
      SET ADCS2 ON
    #ENDIF
    #ENDIF

    This is placed after the conversion clock block in ADRead and ADRead10.

    Basically HalfSpeed is a setting for some PICs to divide Fosc in half again in addition to the current speed setting.

    Also I had a question about ADFormat and ADFM.

    In a-d.h ADFM is not explicitly specified to be off (left justified) in the ADRead function, yet by experimentation it is specified to be OFF. Is it specified by default somewhere, or should this be set to off explicitly (for 10bit adc that take ADResH).

    Thanks

     
    • Hugh Considine

      Hugh Considine - 2007-05-24

      Thanks for the extra code, I'll alter a-d.h so that it deals with ADCS2 as well as 1 and 0. None of the datasheets I've looked at before in detail have had more than 2 ADCS bits.

      ADFM is set off by the InitSys routine in system.h, plus it is supposed to cleared whenever the PIC is reset. ReadAD10 sets ADFM on, does the requested conversion, and then clears it again.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.