'Read TRISx register?'
Here's an easy one.
I thought I heard or read somewhere that the TRIS registers were write
only. I can't seem to find this information in the data sheets
So, can I read the TRIS registeres?
> Here's an easy one.
> I thought I heard or read somewhere that the TRIS registers were write
> only. I can't seem to find this information in the data sheets
Hmmm. It's there. On the 16C5x and the derivative 12C5xx series,
TRIS is indeed write-only. On the "later" devices, such as the 16F84
and 16C7x(x), the TRISx register appears banked "behind" the
corresponding PORTx register - i.e., the address is the same, but you
must set the RP0 bit in Status to access it *instead* of the port.
It may also be accessed through the INDirect register at an address
If you only want to write TRISx, then despite the peculiar warnings in
the documentation and assembler, the original TRIS (and similarly,
OPTION for the option register) instructions as used with the 16C5x
devices remain the most efficient (and therefore, preferred!) method of
Further, *some* people are suspicious that the TRISx registers, like
the PORT register, may be susceptible to glitches (from spikes etc.) due
to its close proximity to the output devices, and that therefore read-
modify-write instructions using TRISx as a register may be a Bad Idea,
so that writing with set patterns (either as a register, or using the
special TRIS instruction without bank switching) is safest.
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- New search...