Searching \ for 'Table over 255 and the art of compact...' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/mems.htm?key=table
Search entire site for: 'Table over 255 and the art of compact...'.

Truncated match.
PICList Thread
'Table over 255 and the art of compact...'
2000\01\22@090054 by Andreas Magnusson

picon face
part 0 16 bytes
</x-html>

2000\01\22@094954 by Ken Webster

flavicon
face
Andreas Magnusson wrote:
(--snip--)
>smaller so my messages fits. I think the smallest way to program
>in the "caractercode" in the pic is to just write all the code
>after each other in a retlw table. To get a character multiply
>the ascii value by 5 (5 "codes" needed per character) and increase
>the PC. And for each loockup increase the PC by 1 untill the five
>"charactercode" needed are achived.
>
>Do u think this is the most compact way??

Perhaps not THE most (wastes 1 bit per byte) but it is certainly a good
compromise between code complexity and space useage.  The extra code needed
to use those wasted bits may even end up taking more space than the bits
themselves (depending on how big the table is and how well the code is
written).  So I would say that it is a pretty good way to do it.


>Ok so if i want to use 50 characters It will take up the first
>250 bytes. The problem is that I now cant use the tablefunction
>(or can I ???) for the message loockup because the PC will
>owerflow or something like that...
>
>Is it possible to use the "table lockup function" over the 255
>first bytes???

Certainly.  Try this:

         MOVF      index_H,W
         ADDLW     HIGH table
         MOVWF     PCLATH
         MOVF      index_L,W
         ADDLW     LOW table
         BTFSC     STATUS,C
         INCF      PCLATH,F
         MOVWF     PCL

table     RETLW     0x3c
         RETLW     0x2b
         ...

This will look up a value in the table using the 16-bit index stored in
index_H:index_L (_H is the high byte, _L is the least significant or low
byte).

Cheers,

Ken

2000\01\23@032812 by paulb

flavicon
face
Andreas Magnusson wrote:

> I programmed a program to control a 5x7 LED dot matrix display for a
> while.

 I *must* do this.  How did you set up the drive?  I'd go for direct
drive of rows by PORTB, with a 74HC138 (or even better, 74HC137) driving
appropriate transistors to strobe the columns and maybe, other LEDs.

> It worked great. I am now going to put in some more functions like a
> countdown function. (I will have it in our "sleeping room" in the army
> indicating how many days left on my military service...)

 Now, do I presume this is to function as a one-character Times Square
display so that the digits progressively roll across the single
character matrix?  That sounds rather cool.  You'll need two pointers to
the "old" and "new" characters, plus an index to tell how many columns
shift needs to be employed.

> I think the smallest way ... To get a character multiply the ascii
> value by 5 (5 "codes" needed per character) and increase the PC.

 Well, it won't quite be ASCII if you use only 50 codes as you suggest.
It'll be a variant where all ten digits come first followed by all
capitals, thus 36 codes so far with the property that the first 16 map
to hexadecimal directly (or indeed, to any base representation up to 36)
and you can add another 15 characters up to your table limit of 51.
Excellent so far.

> And for each loockup increase the PC by 1 untill the five
> "charactercode" needed are achieved.
> Do u think this is the most compact way??

 Sure is, can't do better. 7 x 5 = 35 bits, 5 bytes = 40 bits, you're
only wasting 5.  Keep in mind innovative ways of using them so that for
example, the MSB is set in the last character and terminates the shift
routine without using a counter.

 Not only that, but this is the optimum method of multiplexing one only
7 x 5 display, strobing through only 5 columns rather than 7 rows.

> Is it possible to use the "table lookup function" over the 255 first
> bytes???

 OK, Ken Webster(!) has given you the answer for looking up entries
from a table of more than 256 entries, using a 16-bit index consisting
of index_H and index_L.  Is that what you wanted to know, or just
whether you could have a table outside the first 255 words of program
memory (they are not bytes), or whether you can have a table overlap a
page boundary?

 For a table of less than 257 entries but overlapping page boundaries,
you just use Ken's code without the first instruction i.e., index_H
becomes zero, and MOVLW as the second.  Another approach is to dedicate
a page to it, generally the last page, page 3 for a 16F84.  Ken's code
now simplifies to:

       MOVLW     HIGH table
       MOVWF     PCLATH
       MOVF      index,W
       MOVWF     PCL

       ORG 0x300
table   RETLW     0x3c
       RETLW     0x2b
       ...

--
 Cheers,
       Paul B.

2000\01\23@084104 by Andreas Magnusson

picon face
----- Original Message -----
From: Paul B. Webster VK2BZC <spam_OUTpaulbTakeThisOuTspammidcoast.com.au>
To: <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU>
Sent: den 23 januari 2000 10:26
Subject: Re: Table over 255 and the art of compact...


> Andreas Magnusson wrote:
>
> > I programmed a program to control a 5x7 LED dot matrix display for a
> > while.
>
>   I *must* do this.  How did you set up the drive?  I'd go for direct
> drive of rows by PORTB, with a 74HC138 (or even better, 74HC137) driving
> appropriate transistors to strobe the columns and maybe, other LEDs.


Well the setup I use now is just temporary but it works. I have built the
circuit on a "project deck". I sink each row with portb via 7 transistors
and I source the columns from porta directly. The driver setup doesen't
allow maximum LED intensity but I will probably change it when I make the
circuitboard.

Becaouse of that I use the porta to source current I "can't" use the porta,5
as is (open drain). So I use instead the portb,0 to to the 5:th column. This
means that to each "caractercode" using the 5:th column I will set the first
bit to 1.

Ehhh.... I have put up the schematic and a picture of the board so u can see
it. One picture says more than one thousands words in bad english.

If you are interested go to

http://m1.363.telia.com/~u36300007/images/

alfanum1.jpg and alfasch.jpg

The board is connected to David Taits programmer/development board.

> > It worked great. I am now going to put in some more functions like a
> > countdown function. (I will have it in our "sleeping room" in the army
> > indicating how many days left on my military service...)
>
>   Now, do I presume this is to function as a one-character Times Square
> display so that the digits progressively roll across the single
> character matrix?  That sounds rather cool.  You'll need two pointers to
> the "old" and "new" characters, plus an index to tell how many columns
> shift needs to be employed.

Yes If I understund u right this is what it is going to look like. I have it
right now scrolling text like "Now is it just 175 days left in the army!
The EOD team roulz!" but in swedish... The problem right now is that the
number of days is not changing. I need more space to do this, thats why I
have to make the program smalller. I will also display the bible word of the
day or something like that...

To scroll the text I am, as you wrote saving the "old" character in five
registeres and then just shifting the new character in.


> > I think the smallest way ... To get a character multiply the ascii
> > value by 5 (5 "codes" needed per character) and increase the PC.
>
>   Well, it won't quite be ASCII if you use only 50 codes as you suggest.
> It'll be a variant where all ten digits come first followed by all
> capitals, thus 36 codes so far with the property that the first 16 map
> to hexadecimal directly (or indeed, to any base representation up to 36)
> and you can add another 15 characters up to your table limit of 51.
> Excellent so far.

While I not use the first 30 or so ascii characters I substract this walue
from the value achived in the lockup table. This allow me to write the
characters insted of a number in the message lookup table.


{Quote hidden}

I think I have found a compact way then.. because the first bit are used to
"adress" the last column as I said before. The leftowe I/O on porta will be
used to set the clock (number of days left).


{Quote hidden}

I wanted to knew how to make a long table taking up so much space so it
won't fit in the first 255 words. Ken answered the question and you
complemented it.

Thank You very much for the help Ken and Paul!

/Andreas Magnusson

2000\01\23@164648 by paulb

flavicon
face
Andreas Magnusson wrote:

>  I sink each row with portb via 7 transistors and I source the columns
> from porta directly.  The driver setup doesen't allow maximum LED
> intensity but I will probably change it when I make the circuitboard.

 How about changing it now?  Port B is rated about 20mA per pin to sink
current, and you may have a total ground pin current of 150mA, so that
fits, just drive the LEDs directly from port B (*with* the 150 ohm
resistors).  I'm not sure at present what you are doing, but it sounds
as if you are driving one *row* at a time using one of the drive
transistors, while using port A to drive whichever LEDs are to be lit in
that row.

 That would mean that you would have to do a seven-step multiplex,
which is less efficient that a five-step multiplex driving one column at
a time, and find each row bit separately from the lookup which is really
complicating things.

 In addition, if you put PNP drivers on the columns, you can use RA4
after all because the drivers are pulled down rather than up, and it is
then easy to add the 74HC138 and free two port pins, or 74HC137, free
one port pin and share three others.

> Because of that I use the porta to source current I "can't" use the
> porta,5 as is (open drain).  So I use instead the portb,0 to to the
> 5:th column. This means that to each "caractercode" using the 5:th
> column I will set the first bit to 1.

 Sure, but that bit in the charactercode lookup can be used for another
function.  You just mask it off as required before you write it to the
port.  I get the impression you *are* already sending this one *column*
at a time, but have just got the transistors in the wrong places.  I'd
get that fixed first (because you need to invert the logic) before going
further.  If you later decide you *do* need more row current, you can
add PNP transistors to the rows as well, as emitter followers and need
no extra resistors nor change in logic.

> Ehhh.... I have put up the schematic and a picture of the board so u
> can see it.  One picture says more than one thousands words in bad
> english.

 In any English.

> To scroll the text I am, as you wrote saving the "old" character in
> five registeres and then just shifting the new character in.

 Yes, it's pretty simple.

> While I not use the first 30 or so ascii characters I substract this
> walue from the value achived in the lockup table.  This allow me to
> write the characters insted of a number in the message lookup table.

 $30 = 30 hex.  OK, that requires 48(decimal) entries - works fine.

 OK, it seems you have put the driver transistors on the rows where
they are not necessary, and not on the columns where they are.

 To achieve a major improvement in performance, remove the NPN
transistors and the 5k6 ohm resistors from the rows, driving these
directly via the 150 ohm resistors, and invert the byte written to port
B.  So far, no improvement in brightness.

 Just put the salvaged NPN transistors between port A (& B0) pins and
columns (anodes) as emitter followers (no resistors) and you *will* get
more brightness.  *Later*, if you change to PNP transistors and invert
the drive to port A, you can use A4 as well or put in a 74HC137/
74HC138.
--
 Cheers,
       Paul B.

2000\01\24@000917 by Wagner Lipnharski

flavicon
face
Before you blame me, let me tell you that I like home made things, like
baked potatoes, pizza, jelly, bread, banana flambe, cooking SMT boards
(soldering) at the kitchen oven, and so on.  My mother use to say I was
born holding a 6BQ5 tube and two transistors BC107 in one hand and a
soldering iron at the other hand (joking of course, because the tube was
a 6V6, and it was not the transistor are yet... :).

Now, after you find out everything about character generation tables,
multiplexing, driving circuits, brightness control, and so on, using
discrete components, and felt a nice joy with, then you can take a look
at the following Toshiba URL's:

Inteligent LED Matrix Module Drivers, including 3 wires communication
(only 3 port pins at your PIC), low cost and available:
http://marktechopto.com/tb62713f.htm
http://marktechopto.com/tb62713n.htm

5x7 LED Matrix Modules:
http://marktechopto.com/dotmatrix.htm

Example of a 2 inches tall, 5x7 module, options for LED color:
http://marktechopto.com/DotMatrixPDF/357.pdf

Wagner Lipnharski
Orlando, Florida
http://www.ustr.net

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...