Default pins command

rodmcm

Member
Can someone please assist with this piece of code. The code splits a byte (OutputByte) in 2 and sends to pins 7,6,5, and 4 but I don't understand how it works

pins = OutputByte & $F0|2|rs

I get the &F0 but not |2|rs
 

hippy

Ex-Staff (retired)
The | is a bit-wise or operator so ...

Code:
outbyte : abcd efgh
& $F0   : 1111 0000
=         abcd 0000

| 2     : 0000 0010
=         abcd 0010

| rs    : 0000 000x
=         abcd 001x
 

Squidteeth

New Member
Understand most of that, but...

| rs : 0000 000x
= abcd 001x

I don't understand what the "rs" represents, is it the ascii value?
 

hippy

Ex-Staff (retired)
( Moved to Active Forum )

The 'rs' is a variable, like outbyte is. Because my crystal ball has been recently polished I can make a good guess that this is part of some LCD controlling program. If so the 'rs' variable is used to hold the value for the Register Select bit to indicate whether what is being sent should go to the Data Register or Command Register of the LCD.
 

rodmcm

Member
Thanks, get it now. The circuit is indeed for an LCD driver direct from an 18X. Published in 'The SHED' magazine here in NZ
 
Top