Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

missing TRIS register

Status
Not open for further replies.

eng1

New Member
I am using the PIC12F508.. I want to define I/O pins, but I can't find the TRISIO register. Any suggestion?

Thanks
 
It's an older PIC, you need to use the TRIS instruction to set the TRIS register, unlike the newer PICs which give direct access to the TRIS register the same as other SFRs.

Read the data sheet for the 12F508, it clearly states how to set it under the I/O Port section.

Pete
 
Actually it's a relatively recent PIC but uses the old 12-bit instruction core.

Pete is correct in that you must use the TRIS instruction.

Mike
 
William.. i think it should be
Code:
MOVF PIN_DIRS,0
TRIS GPIO

OPTION is another one...
Code:
MOVLW b'10101010'
OPTION
10Fs serie work the same way
 
Last edited:
Thanks for all replies. The program is ok now:

MOVLW 0 ;0 is loaded into the W register
TRIS GPIO ;all outputs
 
To make all pins outputs, the two instructions should be:

movlw 0h ; 0 is loaded into W
movwf trisio ; W is loaded into tris

You may need to use capital letters for some assemblers:

MOVLW 0h
MOVWF TRISIO


Colin Mitchell

<mod edit: self promotion deleted>
 
Last edited by a moderator:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top