clrf TRISB & 0x07F HELP..


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2008
    Posts
    22

    Default clrf TRISB & 0x07F HELP..

    Hi, does someone explain me the logical meaning of these 2 instructions?


    1) clrf TRISB & 0x07F

    does this cancel the file register and the & (logical and)?



    2) movwf ADCON1 ^ 0x080

    this moves from the accumulator
    to the register ADCON1 and ^ (logical or)?


    thx chip_s

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    On the 16F family of chips, these do the same as

    clrf TRISB

    movwf ADCON1

    IMHO, they (yours above) are just written using crispy-clean style ... on the 16F chips the operands for both of these instructions are limited to 0x00-0x7F(see data sheet). The clrf statement you listed clears the 8th bit ... but only the first seven bits are read anyway. The movwf toggles (in this case clears) the 8th bit, but again only the first seven are used by the command.

    I believe this once common crispy-clean style was used to ensure possible upwards compatibility with future chips ... the future chips like the 18F and beyond have changed how they deal with SFRs so you do not see this style very often.

    HTH
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. ASM code
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 1st March 2010, 23:55
  2. rfPIC Serin problem
    By gavo in forum mel PIC BASIC Pro
    Replies: 52
    Last Post: - 11th March 2008, 17:52
  3. Accurate clock using 12C508
    By srob in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th September 2007, 09:19
  4. Replies: 14
    Last Post: - 26th September 2007, 05:41
  5. INTCON (RB0/INT) and TRISB
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th September 2006, 20:38

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