Seek supplementary code and lookup table advice

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Seek supplementary code and lookup table advice

Post by oookey »

Dear All,

I read the post by jgu1, title: 8x8 LED dot matrix scrolling display.
I’m now figuring out how to use lookup table to display a scrolling message with the 7x15 dot matrix.
The message reads: “HELLO WELCOME”.
I’m using 15 columns by 7 rows matrix, port A controls columns, and port B for rows.
The values to be fed to port B are shown in the attached file. As scanning from column 1 to 15, one column at a time, the port B values are fed according to the columns, when column 1 ON, the value of b1111111 (0x7F) is fed to port B, presently I use “IF” to locate the row to turn ON, but this way the program seems large, though using the supplementary code and lookup table may shorten the program.

Please advice. Thanks

Regards
oookey
Attachments
DotDispaly.png
(28.62 KiB) Downloaded 6411 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Here are some links you may find useful:
http://www.matrixmultimedia.com/mmforum ... 26&t=10066

http://www.matrixmultimedia.com/mmforum ... =36&t=4869

http://www.matrixmultimedia.com/mmforum ... =26&t=3543

We are here to help.
So if you get stuck if creating a flowchart we can help you.

Perhaps use string for message.
Convert string to index number for LUT?

will look at this further tonight when I get home from work

Martin
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Thanks for the pointing Martin.

Having gone through the link pages, i still do not know how to implement. :(

You suggested that converting string to indexing number, would you please elaborate more in depth, I have generated the "HELLO WELCOME" into BYTE number as attached, it consists total of 335 values.

For the supplementary code,
The “definitions and function declarations” section, I’ll be putting:
rom char* LUT = { all the 335 values in the excel files in here…};
#include "??.h" – what is the header should include?

The "Function implementations" section:
I need to provide program in C to display the message?
Thanks

Regards
oookey
Attachments
hellowelcomeLUT.xls
(61 KiB) Downloaded 306 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Hi oookey,
If you can post a flowchart set up with your target device, and configuration set as best you can (correct type of oscillator selected), Correct clock running speed etc and I see what I can do.
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Hi Martin,

The FC attached is for 7x5 column, and scrolled letters “H” and “E”, from right to left.

When the FC successfully shorten, I’ll proceed extend to 7x15 columns, with addition of 74HC138. :wink:

Thanks

Regards
oookey
Attachments
HelloWelcome.fcf
(33.3 KiB) Downloaded 336 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

What version 4 of Flowcode have you got?
Free version had a limited amount of supplementary code you can use.
I have kind of worked out how to do this.

My idea is put the test to scroll in a string, convert each char into a number so correct LUT data can be retieved.
A=1, B=2 (to make thing easier will not use 0)
Can even use numbers 27=1 28=2 etc.
for supplementary code will use:

Code: Select all

rom char* StoredText ={
126,9,9,9,126, //A
127,73,73,73,54, //B
62,65,65,65,34,  //C
127,65,65,34,28, //D
127,73,73,73,99, //E  or  127,73,73,65,65, which one you prefer the look of? 
127,9,9,9,1, //F 
62,65,65,73,122, //G
127,8,8,8,127, //H
0,65,127,65,0, //I
32,64,65,63,1, //J
127,8,20,34,65, //K
127,64,64,64,96, //L
127,2,4,2,127, //M
127,4,8,16,127, //N
62,65,65,65,62, //O
127,9,9,9,6, //P
62,65,81,33,94, //Q
127,9,25,41,70, //R
70,73,73,73,49, //S
1,1,127,1,1, //T
63,64,64,64,63, //U
31,32,64,32,31, //V
63,64,48,64,63, //W
99,20,8,20,99, //X
7,8,112,8,7, //Y
97,81,73,69,67 //Z
};
When correct code is retrieved (data is for each column )Using an interrupt, to light each column (one at a time 1st to 5th) every say 9ms
Your then get a persistence of vision and your just see a whole letter and not just a column.
Then the message can be made to look like its scrolling.
I have not got a dot matrix so I won't be able to test my theory but I'm fairly confidant it will work.
For entering message take a look at this thread:
http://www.matrixmultimedia.com/mmforum ... 92&#p41247

I'm going to alter your flowchart so you should see the correct letters change.
If you have got the free version, then you may have to change the supplementary code so it only takes up 4 lines.

Martin
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Flowchart attached is my very first attempt at created a dot maxtix LED board.
I have not got a dot matrix board myself, so unable to test prior to posting.
So It may not even work?

This is the first stage using 8x5 dot matrix.
It does not scroll yet.
One letter at a time form a text string should be displayed every second.

Note: Rows on port B won't simulate since data is retrieved from a look-up-table within Supplementary code which uses C code.
As you may or may not be aware Flowcode does not simulate C code.

Martin
Attachments
HelloWelcome1.fcf
(16.5 KiB) Downloaded 291 times
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

I’m using FC3 student version, I do not know how large the program can this version handle.
I look at the codes that you listed, got a feeling of same as what I’m doing, is that you mean convert string to index number?
After having these numbers put in the supplementary code, I do need to provide program written in C to read accordingly to display? How would the program like? Please advice.

Thanks
oookey

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

oookey wrote:I’m using FC3 student version,
Ooops,
Since Flowchart loaded with V4, I wrongly assumed your using V4.

I will have to install My V3 version and create you a V3 Flowchart.

Sorry about that.
oookey wrote: is that you mean convert string to index number?
After having these numbers put in the supplementary code, I do need to provide program written in C to read accordingly to display? How would the program like? Please advice.
oookey
I have done all that all for you. Once I converted to Flowcode V3, All you need to do is run flowchart, compile to chip if you have got a Matrix programmer (E/g EB006), or compile to hex, then use a programmer to program microcontroller with the compiled hex file.

All my wording was just my thoughts before I created the Flowchart.
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Here is a version to try that has been converted to Flowcode V3
Hopefully this should run OK?

All the supplementary code have I have added, so you don't need to.
Just compile flowchart and load the hex into your target device.

Martin
Attachments
HelloWelcome 1 FC3.fcf
(11 KiB) Downloaded 328 times
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Thanks you very much Martin :D , let me understand how is your program works, then come back again.

Best regards

oookey

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Hi Martin,

The program indeed short compared to my version. But your program is run within a single chip, I need to modify the column readings to suit to use with the 74HC138, then I could compile.

I do not understand the meaning or function of the following two statements, please if you could briefly explain?
1. TempString = Mid$(Text, count, 1)
2. Temp = Char$(TempString, 0)

Is the following statement (No.3) converting the “Char$(TempString, 0)” into Byte?
3. Temp = ( Temp - 64 ) * 5 – 5

What is this C code doing? FCV_ROW=StoredText[FCV_INDEX+FCV_COLUMN-1]; is it to feed the PortB ?
:?: Thanks
oookey

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

oookey wrote: The program indeed short compared to my version. But your program is run within a single chip, I need to modify the column readings to suit to use with the 74HC138, then I could compile.
If you produce a table showing the logic required on the A port for each new generated row then I can implement that for you.
The flowchart was designed just to test one 8 * 5 dot matrix to determine if Flowchart does work or not.

At this stage I did not know your using 74HC138 devices.
oookey wrote: I do not understand the meaning or function of the following two statements, please if you could briefly explain?
1. TempString = Mid$(Text, count, 1)
TempString will load with just a single letter from Text string that is to be used for the display usin the MID$ function. since only one character is used at a time.
So if Text = HELLO.
When count is 0 then TempString = H
When count is 1 then TempString = E
When count is 2 then TempString = L
Ect
oookey wrote: 2. Temp = Char$(TempString, 0)
This is what converts each ASCII character into a decimal number. If you look at the ASCII letter for H
See:
http://www.asciitable.com/
You will see the the decimal for H is 72
So
Temp = Char$("H", 0) =72
oookey wrote: Then once a number is retrieved
Is the following statement (No.3) converting the “Char$(TempString, 0)” into Byte?
3. Temp = ( Temp - 64 ) * 5 – 5
Statement 2 . converts character into a byte, statement 3 alters the byte so it can be used for the look=up table.
1st set of numbers of the LUT is first part of A. to retrieve that INDEX has to be 0.
Next part of A INDEX =1
For the whole of letter A INDEX has to be:
0
1
2
3
4
For whole of letter B INDEX has to be:
5
6
7
8
9
........
........
For H
INDEX has to be:
35
36
37
38

If you look at DEC for ASCII H from the above link, you will see that H = 72
So if applied to the formula:
Temp = ( Temp - 64 ) * 5 – 5
= ( 72 - 64 ) * 5 – 5
= 8 * 5 - 5 // 8 = 8th letter = H
= 35
With the 1st number of LUT starting at 0, the 35th number (36th if counting from 1) of LUT is retrieved.
oookey wrote: What is this C code doing? FCV_ROW=StoredText[FCV_INDEX+FCV_COLUMN-1]; is it to feed the PortB ?
:?:
Yes this part of C code is what assigns the Row variable with the value from the LUT.
so for the 1st part of H (35th number starting from 0 )
Row = 127
the statement is:
FlowCodeVariable ROW is Assigned with look-up-table called StoredText [letter number - 1]
for H as stated above letter number = 8


With the hardware side, you need to ensure that with both ports high the correct LED's will turn on.
if the anode of LED must be driven high and the cathode driven low for LED to be on,
that's what the interface has to do.

best to post all the logic for say the H to be displayed, then I can alter flowchart to suit.

Martin
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Hi Martin,
Thanks. :D

i modified some of the column values to suit scrolling, but fail to compile, errors as followed:

error: unknown identifier 'FCV_INDEX'
error: invalid operand 'FCV_INDEX'
error: failed to generate expression
error: invalid operand '+'
error: failed to generate expression
error: invalid index
error: failed to generate expression
error: invalid operand 'StoredText[FCV_INDEX+FCV_COLUMN-1]'
error: failed to generate expression

the FC and part of the connection attached.
Please advice.

oookey
Attachments
HelloWelcome-scrolling.fcf
(10 KiB) Downloaded 222 times
truthTable.png
(57.67 KiB) Downloaded 6311 times
connection.png
(63.18 KiB) Downloaded 6311 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Hi oookey,
It’s not compiling because a byte variable called Index has been deleted from the flowchart I posted.
Just add it, and should compile OK.
I may not get a chance to alter flowchart as per your circuit until later tonight.

Martin
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Hi Martin,

this is the output image of the FC, it just blinking with this unknown pattern, none of the programmed message appeared. :cry:

any idea where the problem is :?:
Attachments
HelloWelcomeOPimage.png
(71.2 KiB) Downloaded 6302 times
HelloWelcome-scrolling.fcf
(10 KiB) Downloaded 246 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

oookey wrote: this is the output image of the FC, it just blinking with this unknown pattern, none of the programmed message appeared. :cry:

any idea where the problem is :?:
Yes, it is not set up for the logic of your circuit.
Flowchart was desinged for the standard sinking cathode (via NPN transistor)
so for your application the logic output from microcontroller will be wrong as I have not seen your full circut diagram prior to developing Flowchart.
Can you post a truth table of what you want port A to be, for just Each section of H
we know what port B shoud be.
What I did was to make each bit of port A high in turn when the releven column is enabed.
I will have a look tonight as stated in my previous post, if no one else has posted a soultion for you
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Hi oookey,
Can you give this a try please and let me know how it goes.

I can't promise Flowchart will work 1st attempt, adjusted for 74HC138.

Never used that IC before, so its a bit of a learning curve for me.

If it does work for the one dot matix display, it should be easy to alter so it would work on 3 displays to scroll.

If it does not work, I can help you with fault finding.

Martin
Attachments
HelloWelcome 2 FC3.fcf
(9.5 KiB) Downloaded 174 times
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Thank you very much Martin, :)

Following are some of the output images of the program "HelloWelcome 2 FC3.fcf":
medelec35 wrote:
Yes, it is not set up for the logic of your circuit.
.....
Can you post a truth table of what you want port A to be, for just Each section of H
we know what port B shoud be.
I base on the "BOOK2.XLS" to figure out how i used "IF" to display.
Attachments
Book2.xls
(105.5 KiB) Downloaded 211 times
2013-02-13-893.png
(206.53 KiB) Downloaded 6283 times
2013-02-13-889.png
(203.13 KiB) Downloaded 6283 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Hi oookey,
So I can check what's happening, Can you alter the Flowchart I posted so that the String only has a capital L
When I can see an image of L displayed, I can then hopefully work out what the problem is.

Martin
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Hi oookey,

I have altered attached Flowchart to display L and corrected LUT retrieval from

Code: Select all

FCV_ROW =StoredText[FCV_INDEX+FCV_COLUMN-1];
to

Code: Select all

FCV_ROW =StoredText[FCV_INDEX+FCV_COLUMN-8];
& I have also added allowance for a space.
(Both I forgot about sorry). Before the correction wrong address of LUT was being retrieved.
This should alter from no 74HC138 connected to Matrix dot display with one connected.
Once a L is correctly displayed, we can work on the scrolling part.
would you mind posting an image of what the display now looks like with attached Flowchart.

I have also attached LUT data from spread sheet.

Note: You may already know this but retrieval is based on ASCII characters and so far I have only allowed for A to Z (upper case only) + Space to be displayed.


Thanks

Martin
Attachments
HelloWelcome L V1 FC3.fcf
(10 KiB) Downloaded 309 times
LUT Data.xls
(21.5 KiB) Downloaded 244 times
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Thanks Martin, :)

the display of "L" is almost correct. :D


until now i'm still trying to understand how your program works. :?:
Attachments
2013-02-13-894.png
(178.76 KiB) Downloaded 6270 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Seek supplementary code and lookup table advice

Post by medelec35 »

Hi oookey,
Thats great :)
It's spot on!
If going by the lut data.
That type of L was intended.
If you want to change it to to a straight L then then LUT for L (see attached excel sheet)
has to be changed from:
126,9,9,9,126, // A
127,73,73,73,54, // B
62,65,65,65,34, // C
127,65,65,34,28, // D
127,73,73,73,99, // E
127,9,9,9,1, // F
62,65,65,73,122, // G
127,8,8,8,127, // H
0,65,127,65,0, // I
32,64,65,63,1, // J
127,8,20,34,65, // K
127,64,64,64,96, // L
127,2,4,2,127, // M
127,4,8,16,127, // N
62,65,65,65,62, // O
127,9,9,9,6, // P
62,65,81,33,94, // Q
127,9,25,41,70, // R
70,73,73,73,49, // S
1,1,127,1,1, // T
63,64,64,64,63, // U
31,32,64,32,31, // V
63,64,48,64,63, // W
99,20,8,20,99, // X
7,8,112,8,7, // Y
97,81,73,69,67, // Z
0,0,0,0,0, // Space

To
126,9,9,9,126, // A
127,73,73,73,54, // B
62,65,65,65,34, // C
127,65,65,34,28, // D
127,73,73,73,99, // E
127,9,9,9,1, // F
62,65,65,73,122, // G
127,8,8,8,127, // H
0,65,127,65,0, // I
32,64,65,63,1, // J
127,8,20,34,65, // K
127,64,64,64,64, // L
127,2,4,2,127, // M
127,4,8,16,127, // N
62,65,65,65,62, // O
127,9,9,9,6, // P
62,65,81,33,94, // Q
127,9,25,41,70, // R
70,73,73,73,49, // S
1,1,127,1,1, // T
63,64,64,64,63, // U
31,32,64,32,31, // V
63,64,48,64,63, // W
99,20,8,20,99, // X
7,8,112,8,7, // Y
97,81,73,69,67, // Z
0,0,0,0,0, // Space

You will find most chars have that type of font, since hex for LUT for that type of font was posted on the net.
I can change chars to the type of font you posted, I will do that soon.

Since one matrix is working, do you want me to sort out the scrolling of one matrix or sort out using more than one matrix?

Need to do a step at a time.
Attachments
LUT Data Revised L.xls
(31.5 KiB) Downloaded 199 times
Martin

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Great Martin :!: :D

you have got it. :D

please show how more matrixes could scroll from right to left. :P Many Thanks
Attachments
2013-02-13-895.png
(189.61 KiB) Downloaded 6262 times

oookey
Posts: 42
Joined: Thu Mar 08, 2012 3:00 pm
Has thanked: 17 times
Contact:

Re: Seek supplementary code and lookup table advice

Post by oookey »

Hi Martin, :D

i have added in LEDs; 74138 and other necessary component, to enable display 7x15 dot matrix.

With your previously written program it displayed the letter "L" on the left side 5 columns, how do i modify on that program in order to display "HELLO WELCOME" :?: Please advice.

the attached excel file showing the connection of the 3 pcs 74138 to the picmicro.

Thanks

oookey.
Attachments
ConnectionOf74138.xls
(58 KiB) Downloaded 207 times
Display-L-7x15Matrix.png
(220.92 KiB) Downloaded 6201 times

Post Reply