ernestsnaith wrote:
Hi
I am using 4 pins of an 8 bit wide output port. they are pins 1:4 and will control a BCD display. What is the simplist way of sending a number to the port.
If i was using pins 0:3, i would use PTAD = 5; for 5 etc but pin 0 is being used by something else.
cheers
You need to read the port's current data, AND it with the inverted mask of the bits you want to use (in this case, %11100001), shift you BCD data left once so it occupies bits 4..1, instead of 3..0, then OR with the previous number, and store the whole thing back to the port. In assembly,
LDA PORT
AND #%11100001
PSHA
LDA BCD
LSLA
ORA 1,SP
STA PORT
PULA
Message Edited by tonyp on 2007-03-2905:14 PM