Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/15/08 07:39
Read: times


 
#160934 - Table Lookup is Used
Responding to: ???'s previous message
It is normal practice that you would use a table to decode the character code and provide the resulting LED on/off pixel data for that character.

For example if your LED array has five columns of LEDs for each character position and it takes 8 pixels of on/off data in each column to specify the LED states then each character in the table can be represented by 5 bytes.

Next decide on what coding scheme you want to use to represent each character code as received over the UART from the PC. A common scheme is to use the ASCII encoding as shown here: http://www.carousel-design.com/ASCII_Chart.html

Lets say you decide to use ASCII and want to support just the 26 characters from "A" to "Z". What you need to do is gather the 5 bytes of pixel data for each of these characters and pack the 5 byte sets together in sequence into a byte array of 26*5=130 bytes. Arrange to put these into the code space and give the table some name like FONT_TABLE.

Now whenever you receive a character A to Z from the UART port you can easily find its pixel pattern by taking the character and subtracting a constant from it so that if it was "A" you get 0, if it was "B" you get 1 and so forth. This resulting number can be thought of as a index for that character. Here is the formula to use for this example.

Index = Char - 'A'

....where 'A' is the constant that I mentioned above. Next you multiply this index by 5 to get an offset in the FONT_TABLE. The 5 is due to fact that each font table entry has five bytes of pixels associated with it. The formula for this offset could be one of these:

Offset = Index * 5

or

Offset = (Index * 4) + Index

or

Offset = (Index SHL 2) + Index

Once you have the offset you now need to make up a pointer to where the actual characters pixel data is located. The table name FONT_TABLE may be used directly as the address in code memory for the start of the table. You get the pointer by adding on the offset to the table address like:

FontPtr = FONT_TABLE + Offset

This FontPtr value may now be placed into the DPTR register and you may use the MOVC instruction to read the bytes of the decoded character into the ACC register. If you read in sequence five times each time followed by an INC DPTR you can read all 5 bytes of the pixel data for that character.

While you loop to read the five bytes of the pixel data for the character you will move it to the appropriate location in the byte array that represents the actual display image.

That should get you started at seeing how you can decode the received characters without having to write a CJNE for each character code received.

Michael Karas


List of 60 messages in thread
TopicAuthorDate
Help Req:Working of 8-bit SIPO Shift Register in LED Display            01/01/70 00:00      
   Look at some datasheets?            01/01/70 00:00      
      Sequence            01/01/70 00:00      
   Could you be more specific?            01/01/70 00:00      
      Got U!            01/01/70 00:00      
         New thread            01/01/70 00:00      
            OK...but            01/01/70 00:00      
               You just proved the point!            01/01/70 00:00      
               Here is a possible solution            01/01/70 00:00      
                  Rash assumption?            01/01/70 00:00      
                     you can use MPUs those has built-in flash            01/01/70 00:00      
                  EPROM with AT89S52            01/01/70 00:00      
               permanent?            01/01/70 00:00      
                  No....            01/01/70 00:00      
                     Non-Volatile Storage            01/01/70 00:00      
                        Still a Problem            01/01/70 00:00      
                           Obviously            01/01/70 00:00      
                              Design work before chip selection            01/01/70 00:00      
         What about LED drive current?            01/01/70 00:00      
            if you plan to multiplex ....            01/01/70 00:00      
               I know you're well versed in this context ...            01/01/70 00:00      
                  Phosphor persistence?            01/01/70 00:00      
                     That's in Erik's primary domain            01/01/70 00:00      
                        Todays LEDs turn on and off very fast            01/01/70 00:00      
                           Intermodulation            01/01/70 00:00      
                              you make some additional points, but            01/01/70 00:00      
                           But what about TV?            01/01/70 00:00      
                              persistence of the tube, I guess            01/01/70 00:00      
                                 Blind test?            01/01/70 00:00      
                                    Problematic test strategy            01/01/70 00:00      
                                       double blind ?            01/01/70 00:00      
                                          Blind tests, revisited            01/01/70 00:00      
                                             I have no such problem            01/01/70 00:00      
                                                For flimmer test too?            01/01/70 00:00      
                                                   done inside and outside            01/01/70 00:00      
                  Interlace            01/01/70 00:00      
                     Not Really            01/01/70 00:00      
               Maybe skip intensity and on-the-fly updates            01/01/70 00:00      
                  They haven not been discussed ... yet            01/01/70 00:00      
                     Forget All...........            01/01/70 00:00      
                        Don't you need a refresh memory?            01/01/70 00:00      
                        Table Lookup is Used            01/01/70 00:00      
                        Need buffering            01/01/70 00:00      
                        that is ridiculous            01/01/70 00:00      
                           character generation            01/01/70 00:00      
                              i think you got me...            01/01/70 00:00      
                                 No tricks involved            01/01/70 00:00      
                                 Here's one way ... but you'll have to code it yourself            01/01/70 00:00      
                                    thanks...i'll try it            01/01/70 00:00      
                                       how to reset HEF4094            01/01/70 00:00      
                                          difference between "strobe" and "output enable" pins?            01/01/70 00:00      
                                          Only be serially writing zeros to it...            01/01/70 00:00      
                                          How are you using the '4094?            01/01/70 00:00      
                                             Not so simple for a newbie...            01/01/70 00:00      
                                                perhaps you're right, Kai            01/01/70 00:00      
                                                   Thanks, but            01/01/70 00:00      
                                                      Did you even read the prior posts?            01/01/70 00:00      
                                                         multiple parallel outputs            01/01/70 00:00      
                                                            actually, yes!            01/01/70 00:00      
   Telephonic discussion            01/01/70 00:00      

Back to Subject List