Shop OBEX P1 Docs P2 Docs Learn Events
max 7219 display driver - Page 2 — Parallax Forums

max 7219 display driver

2

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-21 00:22
    Jon,
    ·
    ·· What I am saying is that if you store your seconds, minutes and hours in byte variables, then you can simply increment or decrement your variables and test for rollover to increment or decrement the next set.·
    ·
    ·· For example…If one were to count upward, one could keep incrementing the seconds variable until it reaches 59, then increment the minutes variable by one.· The same test can be done for the hours…This can be done in one compact loop.· The timing would be harder to do since there is no counter or RTC on the BASIC Stamp, although you could use an external clock pulse.
    ·
    ·· Is your timer supposed to count up, down or what does it do?· When it reaches its target count does it do some function?· How do you set it or clear it?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jonwjonw Posts: 67
    edited 2006-10-21 02:59
    Chris,·Hi Thanks for·helping out here. I know it must be trying.

    The clock project is·just a rough (non accurate) display, With no Target or·real use.·Count up is good, I hope I will learn enough to modify it to count down later.

    I was thinking I would·learn later how to set it.· ( that is shift/load isn't it)

    I had not thought about clear, (can we just·load 0's)

    So as you stated.· ·1. I know now·what I need.

    ························· ·2. How to.· I'm not too sure on this

    ···························3.·Breaking it into smaller blocks of code I will work on now.············· Thanks for your help········ jonw
  • metron9metron9 Posts: 1,100
    edited 2006-10-21 05:13
    I am reading this thread with intrest, here is an answer to the question you asked,

    "I do not know what you mean to use 1 byte per 2 digits"

    A Byte has 8 bits
    You need to understand Binary , Hexadecimal, as well as Decimal number systems

    Use your Windows Calculator and set it for View->Scientific

    Now it defaults to DEC. You can put a regular integer decimal number in it and then select Bin radio button
    It will switch to show you the the bits that make the number in Binary Foemat.

    255 = 11111111

    Counting from right to left a decimal number 123 we would multiply each number by 1 then 10 then 100 then 1000 as each place to the left represents a multipul of ten because there are only ten numbers that fit in each column. so you would have 3 + (2*10) + (1*100) = one hunderd twenty three.

    Now Binary you only have space for two digits, a 0 and a 1. So instead of each place to the left multiplying by 10 we only multiply by 2

    So counting from the lowest bit 0 it can hold 0 or 1 and represents the number 0 or 1
    the next place over represents 2 or 0 but we cant put a 2 there we can only put the number 1 just like in the tens place in decimal you cant put two digits in one spot you just write a 1, It is multiplied by 10 so you know it means TEN.

    Going all the way to the 7th bit on the left it represents 127. Do the number 128 has a 1 in the 7th column and a 1 in the 1's column adding 127 plus 1 = 128.

    Now you throw out most of that logic when you use another number system called BCD = "Binary Coded Decimal"

    Remember we have 4 bits in a nibble and 2 nibbles in a byte. Still using the binary code system you use only the low nibble made up of 4 bits to represent the numbers 0 to 9. A 9 would be 1001 = (8+1) the leftmost "1" represents eight and the rightmost represents one. The numbers 10 thru 15 are not used in BCD number system. So the high nibble would be multiplyed by 10, and the highest number you can show in a byte would be the number ninty nine.

    Of course the numbers 11 thru 15 can be represented by letters, thats where Hexidecimal comes in where F = 15 and A=10 and FF=255

    Search google for "BCD number system"
    First hit [noparse]:http:[/noparse]//www.danbbs.dk/~erikoest/bcd.htm

    Probably explains it better than I did.

    Hope that helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • jonwjonw Posts: 67
    edited 2006-10-21 18:01
    Hi,·· Yes thats exactly what I found myself reviewing last night.·· AND· I got the clock working (I am breaking it down now).

    It counts to 59 seconds for now· Many thanks. A few questions

    ··········· 1. How do I blank the leading displays (I have the clamping resisters on the max but am showing data and decimal points) I took out the code for blanking leading zeros and dec pnt cause I did not under stand it.

    ·············· Q1·· In scott edwards book his max demo program talks (pg138) about nonZ· and· flag.··Is non Z just a name of a variable? what does flag mean?

    ··············· Q2·· Chris has a attachment called simple timer in this thread. it says secs.LOWNIB=work DIG 0·····Is this how it works? ·DIG retrieves the lower nibble and converts it to a decimal value and stores it secs.LOWNIB. It then also stores it in d7219· because later he says (in subroutine) d7219=secs.LOWNIB··· Isn't this what =· means?

    ···· The next project (I am getting ahead of myself again) is to drive a higher·load·than a small display. (I will make a array of leds) Will it be easier to use the max 394 (rather than· groups of hexfets to drive the segments?)

    Post Edited (jonw) : 10/21/2006 9:41:48 PM GMT
  • jonwjonw Posts: 67
    edited 2006-10-21 21:53
    Here is what I have so far for my·(59 sec) clock.· How does it look?· It works,· but today I can't seem to read my own code.
    ·I think I am missing a ELSE command··· because· I only have IF...THEN...ELSEIF·..(···· )... ENDIF··· Do I need·(ELSE)·in there too?····· I think I may find I need it, to go to the minutes byte.

    (' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    '   Purpose... MAX7219 driven clock
    '   Author.... john wilson'
    '   Started... 10-10-2006 '
    ' -----[noparse][[/noparse] I/O Definitions ]--------------------------------------
    DataIO          PIN     2              ' MAX7219.1
    Clock           PIN     1              ' MAX7219.13
    MAX7219         PIN     0              ' MAX7219.12
    ' -----[noparse][[/noparse] Constants ]-----------------------------------------------
    Decode          CON     $09             ' BCD Decode Register
    Brite           CON     $0A             ' Intensity Register
    Scan            CON     $0B             ' Scan Limit Register
    ShutDn          CON     $0C             ' Shutdown Register (1 = On)
    Test            CON     $0F             ' Display Test Mode
    Blank           CON     %1111           ' Blank A Digit
    No              CON     0
    ' -----[noparse][[/noparse] Variables ]-------------------------------------------------------
    index           VAR     Byte            ' Loop Counter
    work            VAR     Word            ' Work Data
    seconds            VAR     Byte            ' Seconds
    mins            VAR     Byte            ' Minutes
    hrs             VAR     Byte            ' Hours
    digit           VAR     Nib             ' Display Digit
    d7219           VAR     Byte            ' Data For MAX7219
    idxOdd          VAR     index.BIT0      ' Is Index Odd? (1 = Yes)
    ' -----[noparse][[/noparse] Initialization ]--------------------------------------------------
    Init:
    FOR index = 0 TO 7
      LOOKUP index, [noparse][[/noparse]Scan, 5, Brite, 14, Decode, $FF, ShutDn, 1], d7219
      SHIFTOUT DataIO, Clock, MSBFIRST, [noparse][[/noparse]d7219]
      IF (idxOdd = No) THEN No_Load
      PULSOUT MAX7219, 5
    No_Load:
     'PAUSE 1
    NEXT
     ' -----[noparse][[/noparse] Program Code ]---------------------------
    Start:
      FOR work = 0 TO 59
        Seconds.LOWNIB = work DIG 0
        Seconds.HIGHNIB = work DIG 1
        GOSUB Show_Time
       PAUSE 1000
      NEXT
      IF Seconds.LOWNIB=9 THEN
       Seconds.HIGHNIB=Seconds.HIGHNIB+1
      ELSEIF Seconds.HIGHNIB=5 THEN
      ENDIF
      STOP
    ' -----[noparse][[/noparse] Subroutines ]-----------------------------------------------------
    Show_Time:
      index = 1
      d7219 = seconds.LOWNIB
      GOSUB Show_Max_Time
      index = 2
      d7219 = seconds.HIGHNIB
      GOSUB Show_Max_Time
    
      RETURN
    Show_Max_Time:
      SHIFTOUT DataIO, Clock, MSBFIRST, [noparse][[/noparse]index, d7219]
      PULSOUT MAX7219, 5
      RETURN
    

    ······················ thanks·· jonw
    ··
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-21 22:05
    John,
    ·
    ·· You asked how to blank the leading displays…In the original project (Binary Clock) I referred you to that was being done.· Essentially I assign the d7219 variable the constant blank.· Then I check to see if it is non-zero and if so assign the new value to it.· That way if it’s a zero it’s blank.· This is only done on the hours (tens) place.· For you to blank all digits to the left that are non-zero you will need to check for each digit going left if the current count time is over the point where that display will become active.
    ·
    ·· I actually covered Q2 above earlier in this thread, so check back to that point.· You are essentially assigning whatever decimal value was in the first (right-most) position of work to the lower nibble of secs.· The secs variable is actually a BCD value storing two decimal digits, one in each nibble.
    ·
    ·· Before getting into a bigger display I would work out all your software issues.· If you tackle too many new things at once you may find yourself in a position where you lack the needed information on a bunch of things at once.· Also, please attach your code when possible.· Pasting it makes it more difficult to test or see problems because it then has to be copied and pasted into the BASIC Stamp Editor.· As an attachment it can be downloaded and opened directly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jonwjonw Posts: 67
    edited 2006-10-22 02:06
    Chris·· Sorry·· I still don't get it.· I need help with this grabbing low· high nibbles· and 2 digits per Byte.········ Please· view the code I have so far· I am trying to add the minute loop.

    · thanks·· jonw··········attached file day3 59 sec clock

    · EDIT· Am I limited to 16 bits because I am using·the command· DIG ?

    Post Edited (jonw) : 10/22/2006 4:47:05 PM GMT
  • metron9metron9 Posts: 1,100
    edited 2006-10-22 06:54
    You have a for next code problem, but before I get into that. I modified the Show subroutine to use the debug terminal instead of the max7219 as I do not have one connected. This is the way you should use the debug terminal for testing code segments. Use the comment ' to comment out code you dont need when debugging.

    You can see your output in the attached file, I have used the debug terminal to show both the variable name and the value of the variable so that looking at it you can see your seconds counter is not incrementing and your minutes counter is counting what should be seconds.

    debug code used for output


    Show_Time:
    
      index = 1
      d7219 = seconds.LOWNIB
      GOSUB Show_Max_Time
    
      index = 2
      d7219 = seconds.HIGHNIB
      GOSUB Show_Max_Time
    
      index = 3
      d7219 = minutes.LOWNIB
      GOSUB Show_Max_Time
    
      index = 4
      d7219 =minutes.HIGHNIB
      GOSUB Show_Max_Time
      DEBUG "------------------------",CR
    
      RETURN
    
    Show_Max_Time:
      DEBUG "index: ", DEC INDEX," d7219: ",DEC d7219, CR
      'SHIFTOUT DataIO, Clock, MSBFIRST, [noparse][[/noparse]index, d7219]
      'PULSOUT MAX7219, 5
      RETURN
    
    




    Your for next loop has the inside loop counting minutes and the outside loop counting seconds, that should be reversed. Also indent the loops like this to be able to see the loop structure.

    I used a comment for the variable that is in the for next control structure after the NEXT command as pbasic does not allow the explicit variable name to be used in the NEXT command. This just makes it easier to read and helps you realize when you write the control structure exactly what your code means. When you just write NEXT you look at it later and say next what? especially if there is a lot of code inbetween the FOR and NEXT commands.

    
    
    more code....
    '                  space here
    For minutes=1 to 59
      more code...
    
      for seconds=1 to 59
        more code
      next  'seconds
    
    next 'minutes
    '                 space here
    more code....
    
    




    So you can see the minutes loop is nested inside the seconds loop.

    Get your code running first using debug to see your output stream and then implement the max7219.

    The second attachment shows minutes.lownib in binary format through the debug, you can see that your DIG conversion is correct.
    I used the following debug statement to show the output.


    DEBUG "index: ", DEC INDEX," d7219: ",DEC d7219, " minutes.lownib ",BIN minutes.LOWNIB,CR 
    
    



    EDIT->>> Not sure if you can format the BINary output to show all bits, as you can see that do not line up on the output. When dealing with lots of output you want to try and format your output in debugging to something easy to read or it just gets to be too complex. If you are having problems, simplify everything to tiny code segments. In assembler debugging, each machine code instruction is performed one instruction at a time while you watch the internal registers of the processor on tiny segments of code but you have to know when looking at hundreds perhaps thousands of lines of code where to look.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!

    Post Edited (metron9) : 10/22/2006 7:00:42 AM GMT
    592 x 667 - 20K
    593 x 663 - 34K
  • jonwjonw Posts: 67
    edited 2006-10-22 16:30
    I am going to look at that info now. Thanks What I was having trouble with, is I can't show the sixth digit in the display. Am i still limited to 16 bits because I use DIG command. I need a way around this. I want two digits for seconds. Two for minutes. And Two for hours. many thanks jonw ie 23:59:59
    EDIT->>>·· It counts to 95959 then rollsover to 0. so I do not think its a hardware problem.·· Any Help······ jonw·

    Post Edited (jonw) : 10/24/2006 3:19:25 AM GMT
  • jonwjonw Posts: 67
    edited 2006-10-24 05:06
    Chris.·· Here is the code for my clock display. with hours.· I think I answered my own question about if the·DIG· command is what is stopping·the sixth digit from displaying. We are· at 95959 so its not that.··But ·Pin· 10· on the Max is stuck high. 5V· Thats not allowing that digit to go on.· I may have damaged the Max when I applied·a over·voltage to it by·mistake.··
    ··················································· · thanks jonw
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-24 14:22
    Jon,
    ·
    ·· Damage to that pin could certainly keep the digit from coming on.· Fortunately for you if you haven’t damaged the upper two digits you can easily recover from this mistake.· Just move digits 4 and 5 to 6 and 7 and change your code as follows…
    ·
    ·· In the Initialization section change the Scan Register from 5 to 7 (EDIT: Looks like you’ve done this already for some reason&#8230[noparse];)[/noparse].· In the Show_Time routine change the index values for 5 and 6 to 7 and 8.· That should be it.
    ·
    ·· Now your hours will be on the highest digits, but the max won’t care.· The only thing that changes is the scan/refresh time, but since you have already set it to scan all displays you won’t see a difference.· In the future though you should have it scanning more displays than you have connected.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jonwjonw Posts: 67
    edited 2006-10-26 03:09
    Hi chris.· My clock is still faulty.· Another pin is damaged. I have a new max 7219 on order· And the max 394.· I can get digit 4 and 6 to go on, but the count gets to 75959 on then rolls over to zero.·····
    ··························· I have three questions if you have time.
    ················ 1.· If Max needs· MSB· first how can it get it when the first data to be shifted out is the LOW Nibble ? I can't figure that one out.
    ················ 2.· Chris, with all the trouble I had understanding the DIG· command Can you explain how I got around not·being able to count· over 65535.· Was it because I made three for next loops?· Or was it because I called them all either dig 0· or dig1 (I am not sure how I came up with this idea but it was working (I need to have this explained if possible) I think I kind of fluked it.

    ················ 3. the index 1 to·6 in the subroutine (tell me if I am wrong) is only the command registry address ( is it reserving some memory in this location in Max or stamp?)· ie. its only counting along,and to change it from 5 and 6 to 7 and 8·does not change anything, correct?
    ······························· Thank· you jonw
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-26 03:35
    Jon,
    ·
    ·· I would break your problems down so you don’t have to tackle so many at once.· Now, you have a problem with the counter routine and digits aren’t displaying.· One seems like software and the other like hardware, but the only way to know is to DEBUG your code.
    ·
    ·· Remove the hardware from the equation and DEBUG the values to the PC and see if they’re correct.· That way you know if you have a defective MAX7219 chip or if it is a coding issue.· This is what I do when I have a problem…Remove the unknowns and what is left is usually the problem.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • JessJess Posts: 1
    edited 2006-10-26 13:24
    how do you program the basic stamp to make the driver diplay a number / letter of your choice????
  • Tom WalkerTom Walker Posts: 509
    edited 2006-10-26 13:39
    jonw,
    FWIW, 65535 is one of those "magic" numbers. Usually when you see a problem relating to this number, it is connected to the size of a variable...in this case, this is the largest number that can be represented by a WORD-sized variable.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-26 15:15
    Tom,
    ·
    ·· And that would seem to make sense if he was using a Word variable, but his code uses byte variables for seconds, minutes and hours.· He really needs to focus on getting one part working at a time instead of trying to tackle hardware and software issues at the same time.· DEBUG (Like Google) is your friend.· ··I use it all the time for tracking problems or just for testing code before sending it to hardware.· For example I will often test output from sensors on the DEBUG screen before sending them to an LCD or RF link.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • metron9metron9 Posts: 1,100
    edited 2006-10-30 07:40
    1. If Max needs MSB first how can it get it when the first data to be shifted out is the LOW Nibble ? I can't figure that one out.

    Most Significant Bit first is what that means.
    You are sending two bytes of data
    The first byte is the variable INDEX, if the value of INDEX is 1 for example

    Binary representation of a Byte that is equal to 1 is 00000001
    So when it sends the Byte it sends 8 bits of information starting with BIT 7, why 7? Because we count the bits starting at zero and going up to 7. That makes 8 bits in a byte. Bit 7 is the MSB of the BYTE you are sending.

    2. Chris, with all the trouble I had understanding the DIG command Can you explain how I got around not being able to count over 65535. Was it because I made three for next loops? Or was it because I called them all either dig 0 or dig1 (I am not sure how I came up with this idea but it was working (I need to have this explained if possible) I think I kind of fluked it.

    Three for next loops using a byte variable can count to 16,777,215 Hex $FFFFFF thats 24 bits, or three bytes of 8 bits


    3. the index 1 to 6 in the subroutine (tell me if I am wrong) is only the command registry address ( is it reserving some memory in this location in Max or stamp?) ie. its only counting along,and to change it from 5 and 6 to 7 and 8 does not change anything, correct?

    The INDEX tells the max what display digit wou want to erite too. It can display 8 digits, I read the datasheet quickly and its late but without looking it up again I think its 8. Anyway you specify say digit 0 (index=0) then you send a byte of data, your data is converted to BCD, so only bits 0 thru 3 are valid data. You set the max to code B decode mode so you actually send 8 bits the first 4 are always 0 and the next for are your BCD encoded number representation for the numbers 0 thru 9.

    So to show the numbers 01234567 on your display you would do this

    d7219=0
    for index = 0 to 7
    SHIFTOUT DataIO, Clock, MSBFIRST, [noparse][[/noparse]index,d7219]
    PULSOUT MAX7219, 5
    d7219=d7219+1
    next

    If that's not right (it is 2:30AM and I have never used a max chip so I am winging it here)

    Perhaps if it is not correct above, Chris could write you a tiny for next loop to TEST your hardware before you TEST the combination of your software and hardware combination.

    I would do the above for next loop to display simple things first. "Hello World" or Blink one led is what most professionals do when they get new software or hardware they do something very simple to see if the connections , input, output etc... one at a time only then can you debug anything because you have to know if your connections are valid to start with. You say you think you fried a pin, did you or didnt you, don't guess, test it and compare it to the other pins.








    Thank you jonw

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-30 16:55
    Metron,
    ·
    ·· I apologize…I cannot tell what parts of your message are from jonw and which are from you, but a few things need to be adjusted…The rest looks good.
    ·
    ·· Most hardware starts at relative to 0 for addressing.· I have found with the MAX7219 when it comes to specifying the digit this is not the case.· The digits are 1 through 8 rather than 0 through 7.· So the example code to display 01234567 would need to have the line:
    ·
    FOR index = 0 TO 7 changed to:
    ·
    FOR index = 1 TO 8
    ·
    ·· As for test code, I thought I had posted some but as I recall jonw didn’t get it to work.· Please correct me if I am wrong.· I also tend to use the Display Test function built into the MAX7219 to verify all display digits work properly before writing too much code.
    ·
    ·· On a side-note I just completed 2 of 3 prototype Digital Alarm Clocks that employ the MAX7219 as well as a DS1302, DS1804 and LM386.· The clock is BS2-controlled, of course!· Woke me up on time for work this morning (WHEW!).· I just need to finish the schematic and I will get that posted.· Everything is fully customizable and there are many paths you could take on implementing certain features.· I guess my point in bringing this up is that the COLONS, AM/PM indicators and ALM indicators are all controlled by the decimal point outputs on the MAX7219.· This way you can control the intensity of the LEDs along with the displays.· Of course, matching LEDs to your 7-segment displays can be trying as well…

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • metron9metron9 Posts: 1,100
    edited 2006-10-30 20:28
    Ahh i see that now, No-Op is $00 those are the assumptions that make debugging fun, thanks for the correction.

    I should say too to Johw keep going, this may look simple but the devil is in the details, I think I have adult ADD so when it comes to large amounts of connections (pluming is my worst enemy) I sometimes freeze up as I get confused with too many things at once. My first led display I lit one segment, sat back and said wow, had a cup of coffee and then attempted to light all 7 sequentially. Had another cup of joe and sat back and marvled that it worked. I like to stop and smell the flowers as it is said I have too to get it to sink in. I still come back so code I write over just the past few days and wonder how the heck it works (because of no comments) I had a statement LD r16,X and i could not figure out how it worked because I never defined a variable X. I assumed again it was the LDI command and not the LD command , once I realized it was the LD command I looked it up again and said ah ha load byte from index not load immediate byte.

    So all in all Jonw don't get frustrated it's a lot to keep in the front of your mind especially if you have horrible long and short term memory like I do. Sometimes it's two hours of rethinking things before I start making any progress with a project If I don';t have 4 hours to spend at one time I don't usually get anything done. That's why the sun comes up sometimes before I go to bed because when I get going I can't stop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-30 23:02
    Metron,
    ·
    ·· Such is the way with all tinkerers I think…If I stop in the middle of a project I have trouble getting started again, or I may forget key information about it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jonwjonw Posts: 67
    edited 2006-11-01 04:44
    Thanks for your help· I am looking at that now. ·I am also using debug a little better as guided by both· metron9 and chris.
    ··· Three things.
    ···················· ·1·· without any pauses in the code, it counts· at about 1/2 second pace just to run·the code?···If it takes 15 millisec to·do one instruction,·why does it count at this speed?
    ····················· 2···I start·watching debug and the problem·( it starts at zero once 70000 is reached) takes a long time to get to.· Is there a way to save the debug data to a file to view later?
    ······················3·· How can I set· or load a number in ( so i can start at a higher number and not wait so long).
    ·················· ··· jonw
  • metron9metron9 Posts: 1,100
    edited 2006-11-01 05:55
    1. The BS2 runs 2000 instructions per second. There are 1000 milliseconds in one second so one instruction takes only 1/2 of a millisecond not 15 milliseconds.

    2. To test just use different numbers in your seconds loop like (i dont have your code handy but) FOR seconds = 59 to 60 instead of 1 to 60
    that way it takes only 2 steps to drop through and increment the minutes. Set minutes to for minutes=59 to 60 as well to see hours move up every 4 iterations (2 seconds, 2 minutes)

    3. answered above

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-01 20:12
    jonw said...(trimmed)
    ···················· ·1·· without any pauses in the code, it counts· at about 1/2 second pace just to run·the code?···If it takes 15 millisec to·do one instruction,·why does it count at this speed?
    Bear in mind too that certain instructions will take longer to execute...For example a PAUSE or COUNT or FREQOUT instruction all have a duration and execution time will be based on that.· Also, you have the DEBUG statement, so it will take a finite amount of time to transmit the characters it needs to.· More characters takes longer to send.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • metron9metron9 Posts: 1,100
    edited 2006-11-01 21:13
    Oh I forgot, just place your debug output code within the minute loop or hour loop. Or use some if then logic to only output the debug data.

    Also clear the screen just before every debug output and the display will not scroll, it will just look like the LCD output.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-02 00:10
    One thing some people don’t realize is that using CLS can cause the screen to flicker especially when it happens often…If you need to update the screen more often use HOME and print over the old data.· You can pad the trailing end to prevent remnants.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jonwjonw Posts: 67
    edited 2006-11-10 19:17
    To :· Chris and all who helped.· I finally have the clock working, thank you . I could not have done it without everyones help.
    ····· I will post the code if you are interested.· I also have it modified to be a count down timer.· One thing that is not right is it only goes to 23:59:59· Is it much work to make it go to exactly 24:00:00 ? I better post it so you can see the code.
    ················· Now· two things I want to Do but am having trouble understanding are

    ···················· 1.·· How can I set· or load a number into the clock?
    ···················· 2.·· I want to drive· a 1.5" display of 6 digits ( or 210 leds,((5 leds/seg)).·· I have the max 394 chip· but that is only good for 40 ma per pin.·· Can someone put this max per segment drive capability into easier to understand words.·· Thank· you·· jon w
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-11-10 19:44
    It's a philosophical question. When does a day end, and the next one begin?

    A comp-sci answer might be at second 00:00:00. If the day begins there, then 23:59:59 is the 'last' second of the previous day, and 00:00:00 is the 'start' of the 'first' second of the next day.

    A 'human' answer might be at second 24:00:00 -- that's actuall the END of the LAST second of the previous day. But the next count is 00:00:01. It's a little non-intuitive that a clock should go from 24:00:00 to 00:00:01 -- there's no 'zero' in between.

    Also, we have to ask, when DO we increment the day counter? Technically, 24:00:00 doesn't really 'belong' to the previous day, that IS 'the zeroth second' of the next day.

    However, you are the programmer. You have your hands on the naked beating heart of the data. Sure, the CHIP you're reading only goes to 23:59:59 -- but there's no reason YOU can't add one second to it and display 24:00:00 if you want to, if it makes you happy, if it's meaningful for you.
  • jonwjonw Posts: 67
    edited 2006-11-11 01:42
    Upon doing some research, it appears the Max 6971 driver will drive a load as large as 36v.· Would this be the easier way than using the
    ·max 394 and 7219 ?··· Any ideas on how to set the clock?···· jonw
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-11 05:48
    Jonw,
    ·
    ·· The MAX7219 can drive higher voltage/higher current displays.· There is an App Note on the MAXIM website that shows how to do this.· For example, I have some 5” displays that I will need to do this with.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jonwjonw Posts: 67
    edited 2006-11-12 05:09
    Chris:· Yes, the Max website App note is what I was looking at.

    (To no help I might add, sorry I just don't get it. What does the word Vcascode mean in app note 1196 fig 2). Can you post your schematic when you have it built please Chris.

    ················· Two things I don't get.

    1. The max data sheet for the 7219 shows a 2.3" display being driven by a max 394 analog switch and two mosfet 540s.(page 12).·What does the analog switch do? ie· Can we not run the mosfets directly from stamp. If not I guess I need one analog switch for each two digits.

    2. In the app note 1196 Under segment drivers it states 7219 max seg current is 40 ma. Yet the max 7219 data sheet says abs max current SEGA-G is 100 ma.··· How do I know what the segment current·of a display will be· ( the data sheet I guess)··If· I·make a display with ·5 leds· per seg it is still 20 ma correct( in series)·No··is this not the way to built it?···· you can see my confusion now,··· If seg current is 20 ma· Then· do· I add all 7 segment currents· so I will· then know my· max seg· current?·· Thanks chris

    ·
Sign In or Register to comment.