This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

a new digital clock

hi ,

i want to build a new digital clock with a procesor and need your knowlege.

what procesor would work for it????? would arm be quik enough????

can i use a 32,768 hz watch crystal???? but would it make it slow??????

all help will be kind.

(chief programmer zuisti)

Parents Reply Children
  • Looks interesting. I should have one or two LPC21xx board laying around somewhere. Maybe I should take a closer look at the release candidate during christmas.

    An earlier thread did discuss the sparse amount of code posted by the thread regulars. One problem for me is that most code I write have licensing terms that inhibits posting. A hobby programmer on the other hand can always post anything he/she has written.

    Playing around with a completely different language at home would work as a great barrier between private and job. And the ARM is definitely big enough to play nicely with high-level languages.

  • OK - here is some of the relevant parts of Oberon-07 code used in the digital clock:

    The that module that reads the time from the LPC2148 is:

    
    MODULE Clock;
    
    IMPORT LPC, SYSTEM;
    
    CONST
      PCLK = 16000000;
    
    PROCEDURE* GetTime*(VAR hh, mm, ss: INTEGER);
    BEGIN
      SYSTEM.GET(LPC.SEC, ss);
      SYSTEM.GET(LPC.MIN, mm);
      SYSTEM.GET(LPC.HOUR, hh);
    END GetTime;
    
    
    PROCEDURE* Seconds*(): INTEGER;
    VAR
      ss: INTEGER;
    BEGIN
      SYSTEM.GET(LPC.SEC, ss);
      RETURN ss
    END Seconds;
    
    
    PROCEDURE* Init*();
    VAR
      preint, prefrac: INTEGER;
    BEGIN
      preint := (PCLK DIV 32768) - 1;
      prefrac := PCLK - ((preint + 1) * 32768);
      SYSTEM.PUT(LPC.PREINT, preint);
      SYSTEM.PUT(LPC.PREFRAC, prefrac);
      SYSTEM.PUT(LPC.CCR, {0});
    END Init;
    
    END Clock.
    

    The main part of the module that then formats the time and displays it on the LCD is:

    
    PROCEDURE DisplayTime();
    VAR
      hh, mm, ss: INTEGER;
      s: String;
    BEGIN
      Clock.GetTime(hh, mm, ss);
      Clear(s);
      AddInt(s, hh);
      AddChar(s, ':');
      AddInt(s, mm);
      AddChar(s, ':');
      AddInt(s, ss);
      LCD.SetCursor(1, 0);
      LCD.String(s.chars);
    END DisplayTime;
    
    PROCEDURE Run();
    VAR
      prevSecs, secs: INTEGER;
      i: INTEGER;
      sel2: SET;
    BEGIN
      SYSTEM.PUT(LPC.PINSEL0, 0);
      SYSTEM.PUT(LPC.PINSEL1, 0);
      SYSTEM.GET(LPC214x.PINSEL2, sel2);
      SYSTEM.PUT(LPC214x.PINSEL2, sel2 * {2, 3});
    
      LCD.Init(LCD.Linesx2, LCD.DisplayOn, LCD.Increment);
      LCD.ClearDisplay();
      LCD.String("ARM Oberon-07");
      Clock.Init();
      prevSecs := 0;
      WHILE TRUE DO
        secs := Clock.Seconds();
        IF secs # prevSecs THEN
          DisplayTime();
          prevSecs := secs
        END
      END
    END Run;
    

    (For some unknown reason Some of the lines were clipped in the preview - I hope they appear OK in the final post)

    Regards,
    Chris

  • hi frendz , thanx for teh code but its' bad and does'nt even compile!

    nebode have good code for us????

    zuisti

    (chief programmar)

  • hi frendz , thanx for teh code but its' bad and does'nt even compile!

    aaaaah.....I think you're missing something.

    What did you use to try and compile that code?

    Are you the 'chief programmar' in your house, or does a company really pay you to do this?

  • hi freind , we evaleuate mdk and pk51 and teh boss wants workng code. i Am expert on c but cant' undestand code b4 . is c plus????????

    we need code b4 end 08'

    all good helpis thanked

    zeusti

    (senor chief programme)

  • Looks very nice.

    Have you implemented the oberon compiler, or is this a spin-off, integrating the compiler with an IDE?

    Chief: It's just a question of preprocessor settings. If you adjust them properly, then the code should compile just fine. Just make sure that the oberon flag is checked.

  • and teh boss wants workng code.

    what did you do to solve the problem?
    no, the code above is not C++. if you were indeed "Am expert on c" you would know that!

    say what, you were promoted thanks to your heroic efforts to solve this problem (apparently you are now a "senor chief programme"...) ?

  • Senor is not a promotion. Just an attempt at spanish.
    Senior is a promotion, unless it is meant as "retired".

  • hei westmark , what comipler r u used????????

    i cannot' find a obaron box amd i even looked in teh help!!!!!! r u used microvisien?????? i get lots' of error's

    i thinkl avr will be good bcoz it will not be big!!!!!

    if you give mehelp you will be happy!!!!

    zeusti

    (senior chief programe)

  • zeusti,

    please, please, please can you tell me what exactly is a:

    (senior chief programe)

    Sounds like something out of Tron.

  • The original compiler was written in Oberon by Niklaus Wirth (the designer of Pascal, Modula-2 and Oberon etc.) to run on the Oberon operating system. I translated the compiler to Component Pascal to enable it to be run on Windows.

    The original compiler assumed that the entire target application was running in RAM. I had to rewrite the parts that accessed globals so that resulting applications could run out of the mixed ROM / RAM environment of the LPC2000 family.

    That was the hard part.

    The remainder of the work entailed implementing an LPC2000-specific linker, integrating the whole lot into the IDE that I had previously written to be used with Component Pascal:

    www.cfbsoftware.com/cpide

    and adapting the language-sensitive features of the IDE to Oberon-07.

  • 18-Dec-2008: "chief programmer"

    20-Dec-2008: "senior chief programe"

    But still no idea how to do a simple digital clock!

  • With seniority, comes forgetfulness. He might have forgotten more than most here have every known. Who are we to know?

    The advantage is that what has been once known should be easier to learn again.

  • can u give me some time i will build one for u with 7 segment calunder. i am busy with "c" now. by the way which topology u want, multiplex or shift regaster and also cpu.

    ===============================-------!!!!!

    A One Step Journey Start With A Single Step

  • A One Step Journey Start With A Single Step

    "A zero step journey starts with one step forward followed by one step backwards"