PDA

View Full Version : clrf TRISB & 0x07F HELP..



chip_select
- 9th April 2008, 11:53
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

paul borgmeier
- 9th April 2008, 17:23
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