upgrade to PBP 2.46 and using 12F683


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default upgrade to PBP 2.46 and using 12F683

    Hello Everybody. I have several templates to build code on. Here is my 12F675 template:
    ANSEL = 0 'all inputs digital
    CMCON = 7 'comparators off
    DEFINE OSCCAL_1K 1 ' Set OSCCAL for 1K device to accurize osc
    X VAR BYTE ' use for 256 step ADC result
    'uncomment & use the following lines for 1024 step conversion
    'X VAR WORD
    'DEFINE ADC_BITS 10 ' Set number of bits in result
    'DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS
    'ADCON0.7=1 ' Right justification for 10-bit A/D
    ************************************************** *****
    Now, I've upgraded to version 2.46 and want to use 12F683 pics. YES! I studied the datasheet! and found some minor differences. Seems they renamed CMCON to CMCON0 and OSCCAL to OSCCON. So I created a template like the above. Here it is:
    CMCON0 = 7 'comparators off
    ANSEL = 0 'all inputs digital
    DEFINE OSCCON_1K 1 ' Set OSCCAL for 1K device to accurize osc
    X VAR BYTE ' use for 256 step ADC result
    'uncomment & use the following lines for 1024 step conversion
    'X VAR WORD
    'DEFINE ADC_BITS 10 ' Set number of bits in result
    'DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS
    'ADCON0.7=1 ' Right justification for 10-bit A/D
    ************************************************** *****
    Am I correct in assuming this template is equivalent to a 12F683 as the above template for the 12F675? Am I missing something here that may haunt me later. I am awaiting the arrival of the new pics and would like to get an early start on the code. Thank you. - Peter

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


    Did you find this post helpful? Yes | No

    Default

    DEFINE OSCCON_1K 1 ' Set OSCCAL for 1K device to accurize osc
    DEFINE OSCCAL_1K 1 or DEFINE OSCCAL_1K 2 is only used for a device that has the factory oscillator calibration value stashed in the last program memory location.

    What this does is tell PBP to insert a short piece of assembler code that jumps to the last program memory location, fetches and loads this factory cal value into the OSCCAL register.
    Code:
     ifdef OSCCAL_1K
      LIST
            call    03ffh           ; Get oscillator calibration for 1K
            MOVE?AB OSCCAL          ; Set oscillator calibration
      NOLIST
        else
          ifdef OSCCAL_2K
      LIST
            call    07ffh           ; Get oscillator calibration for 2K
            MOVE?AB OSCCAL          ; Set oscillator calibration
      NOLIST
          endif
        endif
    For the 12F683 you don't need this. Just write directly to OSCCON to set the internal osc frequency. The default power-on frequency for internal osc is 4MHz. The datasheet shows the different values to write to OSCCON for different frequencies.
    Regards,

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

  3. #3
    Join Date
    Dec 2004
    Location
    USA
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Peter, What's PBP 2.46? Latest rev I saw on the picbasic site was PBP 2.30. Did I miss something?

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Talking

    Hi, Khoog

    MANY Things ... Have a trip to melabs' site !!!

    Alain

Members who have read this thread : 1

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