Best way to write a Byte using PASM
Jim Fouch
Posts: 395
I'm working on a parallel LCD interface driver. I want to write a byte to 8 contiguous pins.
I also want the driver to have the first pin be definable.
I'm just not sure what is the most efficient way to update all 8 lines at the same time.
I've tried the following code, but did not see any outputs change on my Logic Analyzer.
Here I define my vars...
Here is where I pass the first pin at the start up of the driver...
Then here is where I try to write a byte to the port...
Not sure what I'm doing wrong. Or maybe there is some better way to do this.
Thanks,
Jim Fouch
I also want the driver to have the first pin be definable.
I'm just not sure what is the most efficient way to update all 8 lines at the same time.
I've tried the following code, but did not see any outputs change on my Logic Analyzer.
Here I define my vars...
DB0 Res 1 DBMask Res 1 ' Used for Masking the out port Byte2Write Res 1
Here is where I pass the first pin at the start up of the driver...
Mov Par_,Par ' Grab Par pointer RDLong DB0, Par_ MOV DBMask, #$FF ' Create an 8 Bit Mask SHL DBMask, DB0 ' Shift Left this many pins OR DIRA, DBMask ' Define as an output
Then here is where I try to write a byte to the port...
WriteByte ' This sub will write out 8 bits that are in Byte2Write MOV Temp4, Byte2Write ' Place Byte to Write in SHL Temp4, DB0 ' Shift Left to Align with DB0 ANDN OUTA, #DBMask ' Set OUTA using DBMask (make all pins Low) OR OUTA, #TEMP4 ' Copy Byte2Write into Temp2 WriteByte_ret RET
Not sure what I'm doing wrong. Or maybe there is some better way to do this.
Thanks,
Jim Fouch
Comments
I always seem to mess up on the #. Either forget it when I need it or put it there when I don't....lol
I'm stuck in airports or on an airplane for the next 10 hours, so I'll have to try soon as I get back to my lab.