Username:     
Password:     
            Register  

Projects
Analog Clock 1.0
 
An Analog Clock

Code size:4KB Author:strongtang
Source files included:yes Version:1.0
Use circleOS:yes (1.7) Creation date:2008-04-15 14:13:18
Hardware modification:no Modification date:2008-12-23 10:06:26
Based on the STM32 Primer:Primer1
   
Downloads:2558 Views:10104
   
Vote:
Average ratings:3.19/5 (1420 rates)

Download:    Analog-Clock-1.0.zip (97 KB)

Description:

This is a small program can display  time in your Primer in analog mode.Have a good time!!



Project comments

how to use it( compile it or Run it)                                                                                                             Please, log you to post a reply.
#1   2010-02-25 09:10:19
rahuljiv
New member

Offline

guys i am new to all these. Excuse for that.
Could any one let me know how to use it( compile it or Run it)
I am using WINXP. dont have any other OS (circle OS)

Rahul

 

Bad math in varsion 1.0 code.                                                                                                             Please, log you to post a reply.
#1   2009-05-01 21:00:06
rlstrand
New member

Offline

There is a bug in the original code due to integer math.

The original code tries to move the hour hand to a location between the hours.

i.e.  at 01:30:30 the hour hand should point midway betweem the 1 and the 2

The original code had this:

   RTC_GetTime(&hh,&mm,&ss);
   LCD_FillRect ( 32, 32, 65, 63, 65535);
   d(29,mm,6);       
   n=hh+mm/60;
   d(20,n,30);
   //DRAW_Clear();
   d(30,ss,6);

hh,mm,ss are declared int and n is declared u32

For hh=1 mm=30 ss=30 then n = 1 + 30/60 gives n = 1 as 30/60 for integer math is 0 even if converted u32.

macro d takes n and multiplies by 30 to get the angle of the hour hand.

As written the code can only point the hour hand to multiples of 30 degrees depending only on hh.

Here is an improvement for this:

Does not update the display unless 1 second has elapsed (less flicker).
Correctly updates the hour hand.
Also adjusts the minute hand.

    static lastSS = -1;
    if (lastSS != ss)
        {
        LCD_FillRect ( 32, 32, 65, 63, 65535);
        d(29,mm*6 + ss*6/60,1);       
        d(20,hh*30 + mm*30/60,1);
        d(30,ss,6);
        lastSS = ss;
        }

As an aditional improvement some rounding can be added to the floating point to integer x.y conversions to slightly improve the look.

rlstrand

 

It not a ZIP, it is a RAR !                                                                                                             Please, log you to post a reply.
#1   2008-12-21 14:54:26
zwieblum
Member

Offline

The file is not currupt, it just a RAR-file named ZIP. Download and renme it to Analog-Clock-1.0.rar and it will work.

 
#2   2008-12-23 09:53:22
matloub
Administrator

Offline

Hi

Thank you for the information, it seems that winzip could not extract this file because of this problem whereas 7zip could.
This is the reason why some people had no problem with this file and other people could not open it.
I rezip the file and put it on the website.

Matloub

 

Corrupt under Vista SP1                                                                                                             Please, log you to post a reply.
#1   2008-11-08 17:45:30
coconnor55
New member

Offline

Vista SP1 and WinZip 12.0 both report corruption - WinZip 12 says "End-of-central-directory signature not found.  Either this file is not a Zip file, or it constitutes one disk of a multi-part Zip file." - perhaps you could re-zip it?  Thanks, Clint

 
#2   2008-12-23 09:49:41
matloub
Administrator

Offline

 

Problem with the zip file                                                                                                             Please, log you to post a reply.
#1   2008-09-22 17:08:25
Stefanp
New member

Offline

There is something wrong with the zip file. Iget the error message ...invalid or corrupted in windows XP SP3.

 
#2   2008-09-23 15:45:36
matloub
Administrator

Offline

Hi

Please post the link of the zip file that is corrumpted.

Matloub

 
#3   2008-10-31 20:25:14
erich.schmucker
New member

Offline

Hello,
a double-click on "Analog-Clock-1.0.zip" within WinXpExplorer ended to the same error message. But open with 7-Zip worked without problems.
Erich

 
#4   2008-12-23 09:48:53
matloub
Administrator

Offline

 

The Analog-Clock-1.0.zip is also corrupt for me.                                                                                                             Please, log you to post a reply.
#1   2008-09-24 23:42:50
JohnPA
New member

Offline

URL: The page http://www.stm32circle.com/projects/project.php?id=47 has the link to www.stm32circle.com/projects/download.p … ck-1.0.zip (which I can't hotlink to smile  When I try to open it in XP SP3 and I get "The Compressed (zipped) Folder is invalid or corrupted."

 
#2   2008-09-25 11:30:43
matloub
Administrator

Offline

Hi

I do also use XP SP3 and I met no problem to download it neither to open it.
I can send this file to you by email, you will tell me if you can use it

Matloub

 


To add comments, please register you.



replica handbags Wholesale China Replica Purses Louis Vuitton Handbags Burberry handbags louis vuitton replica handbags Replica LOUIS VUITTON Gucci Handbags Prada Handbags Burberry Handbag Hermes Handbags Hermes Belts Gucci Belts Louis Vuitton Belts Louis Vuitton Wallets Hermes Wallets Gucci Wallets Burberry ScarfLouis Vuitton ScarfHermes Scarf Louis Vuitton Bracelets Louis Vuitton handbags Gucci handbags Prada handbags Prada Wallets Louis Vuitton Wallets Gucci Wallets Prada Wallets Wholesale Jewelry Replica handbags replica watches Louis Vuitton Bikini Burberry BikiniMiu Miu Handbags Hermes Bracelets