PDA

View Full Version : How to display more than 65536 with MAX7219



isaac
- 23rd October 2008, 14:09
Hi All
would someone be kind enough to explain to me how i can display more than
65536 which is the limit of a word variable on a 7 seg display using the Max7219 and 6 digits.
i want to be able to display say 123456 but this a more than a word
what can i do
Any pointers would be well appreciated

Regards
Isaac:D

skimask
- 23rd October 2008, 14:25
An upgrade to PBP 2.50B will give you LONG variables. From there, you can split up your 'huge' number into smaller numbers and display the chunks individually.

isaac
- 23rd October 2008, 15:45
An upgrade to PBP 2.50B will give you LONG variables. From there, you can split up your 'huge' number into smaller numbers and display the chunks individually.


Thanks Skimask
i didn't even know that there was 2.50b out just done the upgrade
looking for examples of this pn the forum any links?

Isaac:D

isaac
- 23rd October 2008, 15:51
found it in the manual but any ideas how to use this .
my present variable is a word so do i just need to change this to a long
then i should be able to send say 123456 in one go




Isaac

skimask
- 23rd October 2008, 15:55
Cant find examples of this in the online user manual?

Isaac

www.melabs.com
And you won't find examples in the online user manual. That manual is old...very old...

isaac
- 24th October 2008, 00:17
my complier flags it up as error

isaac
- 24th October 2008, 00:20
Is there another way i can use to display the number without having to use
Long?

Isaac:confused:

mackrackit
- 24th October 2008, 00:41
my complier flags it up as error
Do you have the use PBPL compiler option checked?

isaac
- 24th October 2008, 09:27
Do you have the use PBPL compiler option checked?

where can i find this to tick it
Isaac

mackrackit
- 24th October 2008, 10:00
I will assume you are using MCS?
View on the tool bar
Compile and program options
then on the Compiler tab there is a check box on the right.

isaac
- 24th October 2008, 12:06
There is not one on mine
i am using pbp2.50b with Microcode studio

mackrackit
- 24th October 2008, 12:18
Thats odd. Maybe the new PBP is installed else where. Did you do an upgrade or is this your first time .

Goto the PBP directory and open the read me file. The version is listed there.

isaac
- 24th October 2008, 13:23
its installed ok
the upgrade was from crowhill
here is the readme file

Isaac

mackrackit
- 24th October 2008, 13:45
Are you using an old version of MCS?
Do not know if that would make a difference or not. When I upgraded PBP I also upgraded MCS and MPLAB.

skimask
- 24th October 2008, 14:17
I thought MCS 3.0.0.5 was the first version to recognize PBPL?

RussMartin
- 25th October 2008, 00:34
An upgrade to PBP 2.50B will give you LONG variables. From there, you can split up your 'huge' number into smaller numbers and display the chunks individually.


Is there another way i can use to display the number without having to use
Long?

isaac, depending on what you need, you may also be able to manipulate your data in software and massage it into individual digits for serial output. What is the nature of the information you want to read? And from what is that information derived?

isaac
- 25th October 2008, 12:36
Hi Russ

i am trying to implement a 6 digit display
the problem is my variable Max_Disp which holds the data that is displayed
can only hold up to 5 digits so 12345 displays ok but when its 123456
this is grater than a word variable can hold so i need so help in how to do this i am following all the advice given but still lost

Regards
ISAAC

isaac, depending on what you need, you may also be able to manipulate your data in software and massage it into individual digits for serial output. What is the nature of the information you want to read? And from what is that information derived?




Again:
Max_Disp=12345
Gosub Display ' Display the Value of Counter
Pause 150 ' Delay, so we can see whats happening
goto again


Display:
Digit=0 ' Start at Digit 0 of Max_Disp Variable
For Position=6 to 1 step -1 ' Start at Farthest Right of Display
Register=Position ' Place Position into Register
R_Val=Max_Disp Dig Digit ' Extract the individual numbers from Max_Disp
If Max_Disp<10 and Position=3 then R_Val=15 ' Zero Suppression for the second digit
If Max_Disp<100 and Position=2 then R_Val=15 ' Zero Suppression for the Third digit
If Max_Disp<1000 and Position=1 then R_Val=15 ' Zero Suppression for the Forth digit
If Max_Disp<10000 and Position=0 then R_Val=15 ' Zero Suppression for the Fifth digit
If Digit=Max_Dp then R_Val.7=1 ' Place the decimal point, held in Max_DP
Gosub Transfer ' Transfer the 16-bit Word to the MAX7219
If Digit>=5 then Digit=0 ' We only need the first 6 digits
Digit=Digit+1 ' Point to next Digit within Max_Disp
Next Position ' Close the Loop
Return ' Exit from subroutine

' Send a 16-bit word to the MAX7219
Transfer:
Shiftout Dta,Clk,msbfirst,[Register,R_Val] ' Shift Out the Register first, then the data
High Load ' The data is now acted upon
@ Nop
@ Nop ' A small delay to ensure correct clocking times
Low Load ' Disable the MAX7219
Return ' Exit from Subroutine

skimask
- 25th October 2008, 14:01
can only hold up to 5 digits so 12345 displays ok but when its 123456
this is grater than a word variable can hold so i need so help in how to do this i am following all the advice given but still lost
Regards
ISAAC

As I said in the other post on the basically the same subject, think fingers and hands. A WORD (hand) can only 'hold' 5 digits (fingers), you can count up to 10,000 but you can't count up to 100,000...
So, two words (hands) to hold your data, one word (hand) holds 0-9999 the other word (hand) holds the places above 9999.


max_displow = 0 : max_disphigh = 0
Again: max_displow=maxdisplow+1
if max_displow>999 then maxdisplow=maxdisplow-1000 : maxdisphigh=maxdisphigh+1
Gosub Display : Pause 150 : goto again
Display: For Position=1 to 6 step -1 : Register=Position
R_Val=Max_Disphigh Dig Digit : if position>3 then r_val=max_displow dig digit
Gosub Transfer : Digit=Digit+1 : Next Position : Return
Transfer: Shiftout Dta,Clk,msbfirst,[Register,R_Val] : load=1 : load=1
load=0 : return

But again, get PBPL and LONGs working and it'll be a bit easier...

RussMartin
- 26th October 2008, 03:50
I've looked at the MAX7219 data sheet:

http://datasheets.maxim-ic.com/en/ds/MAX7219-MAX7221.pdf

. . . but only briefly.

It looks to me (on page 6) as if you send each digit separately, along with the address of the digit's position (Table 2 on page 7). It also appears that the MAX7219 would be happy with a 4-bit BCD input for each digit. This means you can break your large number down into individual digits, each of which is only 4 bits and can be accomodated by a byte variable. Then you send each digit, and its position address, in a 16-bit word to the display.

But there's no way to tell you how to break down the number without knowing where you are getting the number from in the first place. Are you counting something? Or measuring something? What is your input? Why do you need 6 digits of output? What is the display telling--this many somethings or this much something?

isaac
- 27th October 2008, 18:23
I've looked at the MAX7219 data sheet:

http://datasheets.maxim-ic.com/en/ds/MAX7219-MAX7221.pdf


But there's no way to tell you how to break down the number without knowing where you are getting the number from in the first place. Are you counting something? Or measuring something? What is your input? Why do you need 6 digits of output? What is the display telling--this many somethings or this much something?

The 6 digits numbers are a set of values like 123456 of which 123 represents 12.3ft and 4.56 metres.
there would be 10 sets of number like that which would be stores in the
pics eeprom so those 10 sets of number would take up 40 bytes of the eeprom.
My thinking was that instead of using 2 Max7219 both connected for 3 digits each and display 12.3 on one and 4.56 on the 2nd .
i could save on hardware cost if i just display say the first 4 locations containing 123 & 456 with the Max7219 configured for 6 digits.
i can happily display them individaully but as i said its a waste on hardware.
i am sorry if i didn't explain myself better from the start.

Reagrds
Isaac

isaac
- 27th October 2008, 21:52
Hi Guys
i have just sorted out the problem i had with Microcode Studio and
PBPL and LONGs .
the problem was that there were CodeStudioPlus.exe and also CodeStudio.exe so i delated the later and i now have PBPL option.
who is going to be the first to show me how Long works with my problem

Regards
Isaac

mister_e
- 27th October 2008, 21:55
SKIMASK :D

MyVar VAR LONG

skimask
- 27th October 2008, 22:16
SKIMASK :D
MyVar VAR LONG
I know that, but he didn't have PBPL working...
(you said LONG)

mister_e
- 27th October 2008, 22:24
I know that, but he didn't have PBPL working...
(you said LONG)

ROFL... open your eyes...
post #21

skimask
- 27th October 2008, 22:49
Well, I would but only after I knew if the O/P had read/learned about LONGs first and tried himself...

RussMartin
- 28th October 2008, 07:08
The 6 digits numbers are a set of values like 123456 of which 123 represents 12.3ft and 4.56 metres.
there would be 10 sets of number like that which would be stores in the
pics eeprom so those 10 sets of number would take up 40 bytes of the eeprom.
My thinking was that instead of using 2 Max7219 both connected for 3 digits each and display 12.3 on one and 4.56 on the 2nd .

Then it looks to me like you don't need to use LONGs at all! In fact, I can't see how LONGs will help you.

In fact, it looks as if you are "multiplexing" two different numbers onto one display.

Since you are using only three digits per item, the largest of one of them (feet), even if multiplied by 10 for easy handling, is going to be 999, which is a lot less than 65,535, and the largest of the other (meters), even if multiplied by 100 for easy handling, is going to be 9999, which also is a lot less than 65,535. Each can be a WORD.

In fact, if you allow only three decimal positions for meters, it, too, can never be larger than 999.

Extract base 10 digits from each word as a binary-coded decimal (BCD) byte, then send each of them out along with a position address in a WORD for the display. Even the order you send them in doesn't matter much, since the word tells the display where that digit needs to appear.

What is the relationship between the two values being displayed? From where does the data come?

CuriousOne
- 2nd January 2020, 12:42
It might be a decade delayed answer, but here is what op needs:

To display any digit at any position on MAX7219, which can drive up to 8 digit 7 segment displays. Without sending actual number to that IC.

The problem is, that all existing "code samples" for PBP are meant to decode value of some variable into corresponding reading of MAX7219 display. And without "LONG", we are limited to 65535.

Due to that, I've almost completed a code, which will like this: There are two variables, MPOS, MVAL. First one stands for position on 8 digit display (0-7), and 2nd one is actual number you want to display there. So to display say 00876540, the code will look like this



MPOS=7
MVAL=0
GOSUB DSP
MPOS=6
MVAL=0
GOSUB DSP
MPOS=5
MVAL=8
GOSUB DSP


and so on.