Moved this from the junebug thread:
The use of the suffix bits just allows you to set/clear or test an individual bit of a variable.
Thats what I thought "bits" did. In the example on multiplexing in JPUG1 masking is used to change some bits without chaning others, is it done that way because they are changing several bits at once and want to avoid changing the non targeted ones?
and to make sure Im generalizing this properly from your example
Code:
TRISBbits.TRISB1=0; or TRISB&=0b11111101
if I wanted to set port A pin 0 to input, I would type:
and if I wanted to set port B pin 0 high, assuming its an output according to TRISB, i guess it would be:
Im totally guessing on the PORTB0 part, but thats the kind of thing I could find in one of these microchip PDFs isnt it?
(I'm just explaining this to see if i have it right)
TRISB&=0b11111101 will only shut off pin 1 or anywhere you insert a 0. and if you wanted to set some high without effecting the others you would OR it with a line of 0's where you wanted no change, and a 1 where you wanted it to definitely come out high.
so for setting port A pins 1 and 3 high would I type:
(corrected due to input from pommie in other thread)
[end of moved post]
In JPUG#1 Multiplexing Charlieplexed Displays masking was discussed in the context of charlieplexing. The text regarding masking is discussed in the section: setLatA(), setTrisA() on page 5.
Yeah, i remember it demonstrated a method of using those commands to turn bits on or off in a single command without effecting the ones you don't intend to change. I can use it by copying it. But i'm not sure yet what LatA refers to.