Hi guys,
Recently I picked up an old project again which uses among others a
graphical LCD. I think I did put the board aside because I could not get
it to work properly. It turns out the that the (8) datalines to the GLCD
are in the wrong sequence. Since the GLCD library uses the full 8 bits
of a port I do not see a better way to solve this problem (apart from
changing the hardware) than to insert code to reverse the bits in the
data byte. Now I'm looking for a good algorithm. I found several pretty
efficient procedures for ASM and also a few for C/C++. For now I'm using:
function reverse_bits(byte in data) return byte is
const byte lookup_table[16] = {
0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15 }
var byte temp
temp = 16 * lookup_table[data & 0x0F]
temp = temp + lookup_table[data >> 4]
return temp
end function
This looks elegant and seems to work OK, but it may not be very efficient.
Suggestions???
I may not be the only one with the mentioned mistake with the datalines,
but it would also make the GLCD library more flexible when there are
more choices for the datalines. Reversing the bits could be one option,
the use of 2 half ports or 8 individual pins could be other options
(like with the character-LCD libraries).
Regards, Rob.
--
*Rob H*amerling - http://www.robh.nl
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/d/optout.