Free Project - 245 LED Display


Closed Thread
Results 1 to 40 of 222

Hybrid View

  1. #1
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    The purpose of that LED is to give a visual indication that the PIC is indeed receiving data from the PC. It should toggle on/off with every byte received.
    Initially, when the program button is pressed - the LED should be lit, assuming that the TX line from the PC to the PIC is idle (or not connected at all).

    After the PIC receives its first byte - the LED should change states. Upon receiving the second, once again changing states. It should continue to do so until the PC has finished programming it. The LED is of little importance and the message that you program should begin to scroll automatically after successful download.
    Last edited by T.Jackson; - 1st June 2007 at 03:01.

  2. #2
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Smile A new lease on life for my prototype ...

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1693&stc=1&d=118075962 7">
    <hr/>
    The fact of the matter is, after all of this - I honestly have no use for a scrolling marque display. Primarily, the project was only ever attempted in efforts to add to my collection of published projects in the Silicon Chip magazine. As I've stated before, it won't ever being seeing the light of day inside any magazine. So the question for myself was, what do I do with this bloody thing? I put so much time into it, shame to just give it the "heave-ho" in the trash can. After several moments of considerable thought it dawned on me to yes, you guessed it - turn it into a clock! Why not?, its plenty big enough, at least for a 12hr one that is. Unfortunately, however though, its a couple of columns shy for a 24hr clock, at least for me it is, since I concluded that (5x7) digits are mandatory. Much in between just doesn't quite look right. So here it is, source code and all for those of you who have built this thing and would like to turn it into a clock. I also wrote a simple VB app that is used to set the time. (See screen shot) The VB source and everything else is in the download.
    Code:
       Include "modedefs.bas"    ' Include serial modes
       Define OSC 4              ' 4MHz crystal   
       CMCON      = 7            ' All digital
       OPTION_REG = %10000111    ' TMRO prescale = 256
       TRISA      = %00010000    ' All outputs except RA4
       TRISB      = %00000000    ' All outputs ...
       INTCON.5   = 1            ' Enable TMR0 interrupts   
       INTCON.2   = 0            ' Reset overflow flag
       
       on interrupt goto Clock 
                     
       '// Chrs (0-9) stored in on-chip E²PROM
       data @0,62,65,65,65,62   ' 0
       data @5,64,127,66,0,0    ' 1
       data @10,70,73,81,97,66  ' 2
       data @15,54,73,73,65,34  ' 3
       data @20,16,127,18,20,24 ' 4
       data @25,49,73,73,73,39  ' 5
       data @30,50,73,73,73,62  ' 6
       data @35,3,5,9,113,1     ' 7
       data @40,54,73,73,73,54  ' 8
       data @45,62,73,73,73,38  ' 9
       data @50,0,0,0,0,0       ' Space
       data @55,8,8,8,8,8       ' Colm
    
       Row_Data     VAR BYTE    ' Contains one column worth of a chr at a time 
       Column_Scan  VAR BYTE    ' Current col that's active
       Digit_Pos    Var byte    ' E²PROM address pointing to current col data 
       Digit_Loc    VAR Byte    ' Start E²PROM address for new chr
       Colm         var byte    ' Blinking colm ...
       Counter      VAR Word    ' Time keeping counter               
       Secs_Digit1  var byte    ' Secs (1's)
       Secs_Digit2  var byte    ' Secs (10's)
       Mins_Digit1  var byte    ' Mins (1's)
       Mins_Digit2  var byte    ' Mins (10's)
       Hrs_Digit1   var byte    ' Hrs (1's)
       Hrs_Digit2   var byte    ' Hrs (10's)
     
       Clock_Cols   VAR PORTB.6
       Reset_Cols   VAR PORTB.5
       ROW1         VAR PORTA.2
       ROW2         VAR PORTA.3
       ROW3         VAR PORTB.4
       ROW4         VAR PORTB.3
       ROW5         VAR PORTB.0
       ROW6         VAR PORTB.2
       ROW7         VAR PORTB.1
       Prog_Button  VAR PORTA.4
       TX_To_PC     var PORTB.7
           
       Counter     = $7A12               
       TMR0        = 0                    
       Column_Scan = 0
       Digit_Pos   = 0
       Secs_Digit1 = 0
       Secs_Digit2 = 0
       Mins_Digit1 = 0
       Mins_Digit2 = 0
       Hrs_Digit1  = 2
       Hrs_Digit2  = 1
       Colm        = 0
       Reset_Cols  = 1
       Reset_Cols  = 0
       
    LED_Display:                                         ' Scan cols & output row dat
       @ incf _Column_Scan, 1                            ' Inc col
       @ incf _Digit_Pos, 1                              ' Inc chr pos (0-4)
       Row_Data = 0                                      ' Reset 
       IF Column_Scan = 37 THEN Column_Scan = 1          ' ^     
        
       select case Column_Scan
          case 1                                         ' Secs (1's) 
             Digit_Pos = 0                               ' Reset  
             Digit_Loc = (Secs_Digit1 * 5)               ' Set loc
          case 6                                         ' Space
             Digit_Pos = 0
             Digit_Loc = 50
          case 7                                         ' Secs (10's)
             Digit_Pos = 0
             Digit_Loc = (Secs_Digit2 * 5)
          case 12,13                                     ' Colm
             Digit_Pos = 0
             IF Colm = 2 then                            ' Blink colm
                Digit_Loc = 55 
             else
                Digit_Loc = 50
             endif
          case 14                                        ' Mins (1's)
             Digit_Pos = 0
             Digit_Loc = (Mins_Digit1 * 5)
          case 19
             Digit_Pos = 0                               ' Space
             Digit_Loc = 50
          case 20                                        ' Mins (10's)
             Digit_Pos = 0
             Digit_Loc = (Mins_Digit2 * 5)
          case 25,26                                     ' Colm
             Digit_Pos = 0
             IF Colm = 2 then
                Digit_Loc = 55 
             else
                Digit_Loc = 50
             endif
          case 27                                        ' Hours (1's)
             Digit_Pos = 0
             Digit_Loc = (Hrs_Digit1 * 5)
          case 32                                        ' Space
             Digit_Pos = 0
             Digit_Loc = 50
          case 33                                        ' Hours (10's)
             Digit_Pos = 0
             if Hrs_digit2 = 0 then                      ' Show either 1 or nothing 
                Digit_Loc = 50                           ' (12hr time only)
             else
                Digit_Loc = 5
             endif  
       end select
    
       read Digit_loc + Digit_Pos, Row_Data              ' Fetch portion of digit
                                                         ' One column at a time                
       '// Switch off all rows before advancing the counters
       ROW1 = 0
       ROW2 = 0
       ROW3 = 0
       ROW4 = 0
       ROW5 = 0
       ROW6 = 0
       ROW7 = 0
    
       '// Prog button pressed?
       if Prog_Button = 0 then GOTO Set_Time             
    
       '// Clock cascaded counters
       Clock_Cols = 1 
       Clock_Cols = 0 
    
       '// Logically AND data with row bit values and write to port asynchronously 
       IF Row_Data & 1  THEN ROW1 = 1
       IF Row_Data & 2  THEN ROW2 = 1 
       IF Row_Data & 4  THEN ROW3 = 1
       IF Row_Data & 8  THEN ROW4 = 1       
       IF Row_Data & 16 THEN ROW5 = 1
       IF Row_Data & 32 THEN ROW6 = 1 
       IF Row_Data & 64 THEN ROW7 = 1  
       GOTO LED_Display                                  ' Loop back
    
       disable                                           ' Disable interrupts here
    Clock:                                               ' Time keeping routine   
       INTCON.2 = 0                                      ' Clear TMR0 overflow flag
       Counter = Counter - $1000                         ' Dec      
       IF Counter < $1000 THEN                           ' 0.5 sec elapsed? 
          if colm = 2 then                               ' 1 sec elapsed
             @ incf _Secs_Digit1, 1                      ' Inc secs first digit
             If Secs_digit1 = 10 Then                    ' Secs first digit = 10? 
                @ incf _Secs_Digit2, 1                   ' Inc 10's of secs 
                Secs_digit1 = 0                          ' Reset first digit
                If Secs_digit1 = 0 then                  ' Has one minute elapsed?
                   if Secs_digit2 = 6 Then              
                      @ incf _Mins_Digit1, 1             ' Inc mins first digit
                      Secs_digit2 = 0                    ' Reset secs second digit
                      if Mins_digit1 = 10 then           ' 10 mins elapsed?
                         @ incf _Mins_Digit2, 1          ' Inc 10's of mins
                         Mins_digit1 = 0                 ' Reset first mins digit
                         If mins_digit1 = 0 then         ' 60 mins elapsed?
                            if mins_digit2 = 6 Then      '
                               @ incf _Hrs_Digit1, 1     ' Inc hours first digit
                               mins_digit2 = 0           ' Reset mins second digit
                               if Hrs_digit1 = 10 then   ' 10 hours elapsed?
                                  Hrs_digit1 = 0         ' Set hours digits to show 10
                                  Hrs_Digit2 = 1        
                               EndIf                   
                               if Hrs_digit1 = 3 then    ' 12 hours elapsed?
                                  if hrs_digit2 = 1 then '
                                     Hrs_digit1 = 1      ' Reset hours to 1
                                     Hrs_digit2 = 0      '
                                  endif
                               endif
                            endif
                         endif
                      endif        
                   endif
                endif
             endif      
             Colm = 0                                    ' Colm off ...
          endif                                          '
          Counter = Counter + $7A12                      ' Reset counter with 0.5s            
          @ incf _Colm, 1                                ' Toggle colm every 0.5s
       endif      
       resume
    
    Set_Time:
       low Prog_Button                                   ' Set LED    
       SERIN TX_To_PC, N2400, ["@"], Hrs_Digit2, Hrs_Digit1, Mins_Digit2, Mins_Digit1, Secs_Digit2, Secs_Digit1
       input Prog_Button                                 ' Resume as input for prog but  
       Reset_Cols  = 1                                   ' Reset 4017 counters
       Reset_Cols  = 0                                   '
       Column_Scan = 0                                   ' Reset to start of scan
       goto LED_Display                                  ' Start clock
    Trent Jackson
    <hr/>
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1694&stc=1&d=118076150 6" align="right">
    Attached Images Attached Images   
    Attached Files Attached Files

  3. #3
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Talking I passed!

    <h1>I passed the Discrete Maths unit !!!</h1>
    Excuse the enthusiasm, but I just got my results back and it's the hardest thing I've ever done in my life!.

  4. #4
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Thumbs up Yahoo!

    Great Trent, congrats on passing. We knew you could do it!
    Ohm it's not just a good idea... it's the LAW !

  5. #5
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Talking

    Thanks

    Getting back to the clock for a moment - I've had it running for 24hrs so far and its gained 3 secs. Anyone have any thoughts on how to improve its accuracy?

  6. #6
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    I think use DS1307 or Darrel Taylor's time solution.

  7. #7
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Post

    Converting the display project to a clock was a really nice idea.
    I think i will be making it sometime.
    About the clock gaining 3 sconds in 24hrs, using Darrels's instant Interrupts system will keep it within 0.5 sec a day.
    I've tried making clocks with the PBP interupt system but i faced the same accuracy problem.

  8. #8
    Join Date
    Nov 2005
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Thanks

    Getting back to the clock for a moment - I've had it running for 24hrs so far and its gained 3 secs. Anyone have any thoughts on how to improve its accuracy?
    Adjust the oscillator frequency! 3 sec/day means 34 ppm; that sounds reasonable for an unadjusted oscillator.
    Or change the divisor rate from the nominal 31250/4096 to a value who meet the actual frequency.

    Regards
    Gianni

  9. #9
    Join Date
    Apr 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Smile Picture

    Dear Trent, can't you at least post a big rezolution picture of the circuit's pcb, of the logical part, not of the led's? 10q

  10. #10
    Join Date
    May 2007
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    i want to delete my post with the led display from this forum !!!
    Anything Is Possible ...
    (If someone helps you is some cases.)

  11. #11
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    magu. You only need to post your request ONCE - not half a dozen times in every category and in totally unassociated threads - in order for it to be read. You made a valuable contribution to this forum, you found some errors posted by others and put in commendable effort that was recognised by many people. In fact, if anyone else wants to build the same project, they won't fall into the same difficulties you had. So to the greater good of the forum I think it should remain. It's also a good reminder to all forum members that if you post something on the internet, it becomes public domain - so good or bad, think before you post.

  12. #12
    Join Date
    May 2007
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    magu. You only need to post your request ONCE - not half a dozen times in every category and in totally unassociated threads - in order for it to be read. You made a valuable contribution to this forum, you found some errors posted by others and put in commendable effort that was recognised by many people. In fact, if anyone else wants to build the same project, they won't fall into the same difficulties you had. So to the greater good of the forum I think it should remain. It's also a good reminder to all forum members that if you post something on the internet, it becomes public domain - so good or bad, think before you post.
    i don`t want my post to remain !!!
    Anything Is Possible ...
    (If someone helps you is some cases.)

  13. #13
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    The link to your youtube movie clip has been removed... that safeguards your continued privacy, however everything else stays for the reasons I've already stated.

  14. #14
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi Magu,

    I have verified the thread and personal info has been removed.

    Best regards,

    Luciano
    Last edited by Luciano; - 18th July 2007 at 20:31.

  15. #15
    Join Date
    May 2007
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    The link to your youtube movie clip has been removed... that safeguards your continued privacy, however everything else stays for the reasons I've already stated.
    WHAT DO YOU NOT UNDERSTAND . I WANT ALL MY POST TO BE REMOVE . AALLLLLL !!!! INCLUDED THAT ON THE 245 LED DISPLAY AND 245 DISPLAY CONSTRUCT BY MAGU AND THE OTHER ONES !!!
    Anything Is Possible ...
    (If someone helps you is some cases.)

  16. #16
    Join Date
    May 2007
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    The purpose of that LED is to give a visual indication that the PIC is indeed receiving data from the PC. It should toggle on/off with every byte received.
    Initially, when the program button is pressed - the LED should be lit, assuming that the TX line from the PC to the PIC is idle (or not connected at all).

    After the PIC receives its first byte - the LED should change states. Upon receiving the second, once again changing states. It should continue to do so until the PC has finished programming it. The LED is of little importance and the message that you program should begin to scroll automatically after successful download.
    Then tell me a program with o can program the PIC...and tell me pls if it is a setting required when program the PIC

  17. #17
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post Atomic clocks

    Check this out: http://www.symmttm.com/pdf/NYTimes_T...p_09-30-04.pdf
    Atomic clock has accuracy of +/- 1 sec over 30 million years.

  18. #18
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Smile Improved accuracy for LED clock

    I've got some much better accuracy now. Not exactly sure how much - only time will "literally" tell!

    Here's what I've done to improve things:

    <ul>
    <li>TMR0 pre-scaler remains @256</li>
    <li>TRM0 always starts with 12 dec (256 x 244) = 62.464 mS</li>
    <li>Now, it takes 16 overflows of the timer for 0.999424 S to elapse</li>
    <li>This is short of 1 sec by 576 uS</li>
    <li>Adding 36 nops to each overflow (36 x 16 = 576 uS) compensates this</li>
    <li>The crystal now completely defines accuracy</li>
    </ul>
    Last edited by T.Jackson; - 4th June 2007 at 07:08.

  19. #19
    Join Date
    May 2007
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Look, I feel for you, believe me I do. I know how trying things can be when you're first starting out, I was once a beginner too! If you're that determine to do this project, then my best advice to you is to get some "real-World" help from someone. Or, alternatively, read a book on electronics and PICs. Put the project aside until you've got some considerable more knowledge under your belt. As I've said before, this isn't a simple straight forward project, unless you've got a PCB for it.
    ok, i understand , now i have to make the pcb, connect the rez, cap, crystal, transiztors, then the pics (4017, 74hc08, eeprom), and then program the PIC and see if work...

  20. #20
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    Why don't you put it off for a while - I'm actually planning on doing a KIT for a similar project to this. (Much, much better circuit that does more than just scroll a message) Plus, everything will mount on one large double sided through hole plated board w/silk screen printing on both sides. It will use 8 LED modules rather than the individual LEDs. Today I found a good source for low-cost PCBs. Basically, at the moment, Im in the "planing phase" of things with it, it'll be at least a year away, I need to save up some funds.

  21. #21
    Join Date
    May 2007
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Why don't you put it off for a while - I'm actually planning on doing a KIT for a similar project to this. (Much, much better circuit that does more than just scroll a message) Plus, everything will mount on one large double sided through hole plated board w/silk screen printing on both sides. It will use 8 LED modules rather than the individual LEDs. Today I found a good source for low-cost PCBs. Basically, at the moment, Im in the "planing phase" of things with it, it'll be at least a year away, I need to save up some funds.
    today i`m making the pcb in orcad layout... and tomorow i will finish this pcb... then i see if it work or not...best regards...

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 07:14
  2. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 09:42
  3. Replies: 2
    Last Post: - 14th July 2008, 23:11
  4. 245 Led Matrix Display (as constructed by Magu)
    By magu in forum Code Examples
    Replies: 11
    Last Post: - 29th June 2007, 01:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts