asm Question*

Status
Not open for further replies.

km

New Member
What does this line of program mean?

Example:

tris port_b

What is mean by the instruction 'tris' :?:
 
Tris reg. is the direction of the ports. 1=input, 0=output.

Example:
BSF TRISB,1
Set port B pin1 to input(RB1)

BCF TRISD,5
Set port D pin5 to output(RD5)

Kent
 
km said:
What does this line of program mean?

Example:

tris port_b

What is mean by the instruction 'tris' :?:

'Tris' is a very old PIC instruction, on most modern PIC's they recommend not to use it, but to write to the tris register instead - however, so far they keep including it in the parts they release.

As already mentioned it sets the direction of the port pins, by writing the value in the W register to TRIS.
 
Although it is not recommended for use by Microchip, I use the "TRIS" instructions whenever I need to rapidly switch a port's direction. You don't need to switch banks to do this while "movwf trisb" only works on bank1 & bank3. It is handy when interfacing to an LCD module for example.

The instruction is available on all of the PIC16 family chips. However, there are no such instructions:

Code:
    TRIS PORTD
    TRIS PORTE
 
Thanks

Thanks everyone for replying my question :wink:

One more question about programming, what's mean by the instruction:

option
 
Re: Thanks

km said:
Thanks everyone for replying my question :wink:

One more question about programming, what's mean by the instruction:

option

There is an OPTION_REG register, which is explained in the datasheet for the particular processor - you might also look in the INCLUDE file, which actually references the name.

The OPTION instruction loads this register.

Try reading the MPASM helpfile, it explains all the questions you keep asking!. The appendix is particularly useful!.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…