PIC opcode decoder question

Thread Starter

Hrvach

Joined Oct 14, 2014
2
Hi everybody, I'm new here.

I'm trying to figure out something regarding opcodes in PIC 10F200 (datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/41239D.pdf).

Page 46, list of opcodes - TRIS is 0000 0000 0fff where fff is the operand (000 - 111). OPTION is 0000 0000 0010. How can the instruction decoder differentiate between tris where operand is 010 and OPTION instruction?

Any clarification on this would be greatly appreciated. Thanks!
 

Papabravo

Joined Feb 24, 2006
21,226
Hi everybody, I'm new here.

I'm trying to figure out something regarding opcodes in PIC 10F200 (datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/41239D.pdf).

Page 46, list of opcodes - TRIS is 0000 0000 0fff where fff is the operand (000 - 111). OPTION is 0000 0000 0010. How can the instruction decoder differentiate between tris where operand is 010 and OPTION instruction?

Any clarification on this would be greatly appreciated. Thanks!
The operand of the TRIS instruction is decoded as the address of a file register that controls the status of output port bits. The operand b'010' does not refer to an actual TRIS register or corresponding output port and so this value can be used for another purpose. If you look at the description of the instruction f=b'110' is the only valid value. I know the description mentions f=b'111' but I think that is a cut and paste typo.
 

Thread Starter

Hrvach

Joined Oct 14, 2014
2
Thanks, now it makes much more sense. I thought they were all allowed and I was missing some clever feature instruction decoder uses to decide which instruction to execute.
 

Papabravo

Joined Feb 24, 2006
21,226
Even on the mid-range PIC processors the TRIS registers are normally assigned to addresses ending 5,6, and 7. In many cases for mid-range PIC processors the TRIS instruction is deprecated, but is maintained in the instruction set for compatibility. It originally referred to a register that did not have a defined address in the register file. See PIC16C54 for this implementation. See PIC 15F628A for the more modern implementation.

Good catch, by the way.
 
Top