Connect with us

PIC programming question

Discussion in 'Electronic Design' started by RHRRC, May 10, 2007.

Scroll to continue with content
  1. RHRRC

    RHRRC Guest

    Concerning the ID locations of the PIC12F629.

    The programming specification for the 12F629 (document DS4119) states
    that there are 4 ID locations at addresses 2000 thro 2003 and
    (strangely) only the 7 ls bits of each address should be used.
    (Why only should not must)

    However MPLAB IDE (v7.6) concerning the ID for the 629 states that "
    for the PIC12 and PIC16 devices __idlocs sets the four ID
    locations.....For example if (expression) evaluates to 1AF then the
    first lowest address ID location is zero, the second is one, the third
    is ten and the fourth is fifteen."
    Does this mean that only the lowest nibble is used at each address.

    Why, for exaample does this not mean that the lowest address is 00,
    the second 00, the third 01 and the fourth AF or something similar.
    How do you write anything to the upper nibble?

    Moreover with the default radix as hex, the code

    __idlocs 1005

    when run thro MPASM etc gives rise to the ID as programmed 01000005

    Why is this not 00 00 10 05 ?

    It is more than likely obvious but I can't see what is going on at
    this moment.

    Any help appreciated
     
  2. ID locations reside in the program memory. The program memory is 14 bits
    wide, so each address points to a 14 bits word. In the default type of
    hexfiles each word is represented by two bytes, each with its own address.
    Moreover, the least significant byte is on the lower address, so when
    printed, the bytes looks like to be exchanged.

    Try the code:

    #include <p12f629.inc>
    __idlocs 1005
    end

    Hexfile:

    :020000040000FA
    :084000000100000000000500B2
    :00000001FF

    In which:

    0100000000000500
    or:
    0100 0000 0000 0500

    are the ID-nibbles, two bytes each.
    You can find them also in the .LST file

    petrus bitbyter
     
  3. RHRRC

    RHRRC Guest


    Yes I am aware of what it does -it is just how to reconcile it with
    what Microchip says it does.
    If there are four locations of 7 bits as the programming spec says how
    is it that 1005h is saved in 4 bytes rather than 2?
    inserted as leading zero hence 1AF becomes 01AF.
    AF must be two nibbles as they say only the 7lsb's 'should be used'
    and AF is obviously 8 bits but if it was 17F would this logic mean
    that is is held in 2 bytes as 01 and 7F?

    I am used to interpreting 'Microchip Speak' commonly used for new
    releases but this is a mature device by now but I still can't fathom
    what they are trying to say.


    PS a nibble is 4 bits
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-