headerphoto

Developing Stop Watch Applications

Selasa, 12 Mei 2009 21:57:26 - oleh : juragan

Using the Module Microcontroller Laros Elector v2.2

Stopwatch / Clock Counters are often used in various sports activities such competitions running, swimming, soccer, and other. Usually a coach or jury to use a digital stopwatch in mini size . However, in reality, the audience must know the length of a rivalry / championship a race.
Therefore, this guide discusses the design of the Stop Watch Microcontroller module Laros Elector v2.2 and Custom Module L06 (8 digits Seven Segment Multiplexer), see figure 1.1

Port 1 is used for a number of data
Port 3 is used for common selector (selector switch as a transistor)
For modifier keys can be used that is not Port-of -

Stopwatch Applications  in general, there are facilities:
Start Button
Button Stop / pause
Add Hours button
Reduce Time button
Add a button the Minute
Reduce button Minute
  Each key can deprogram and positioned on the port that is not in use.

Configuration number 06 on the module L (custom)
Figure 1.2

Programs can be written using a programming language or languages Asembler C
In this case, the program is written using a stopwatch with the C Compiler SDCC

 (become a member and get this code aplication...it's free.. go to download sections)

below is a part of the source codes....

#include
char Pencacah20;
char Hitung;
char Detik;
char Menit;
char Jam;

char Ruas[8];
//TOMBOLPORT P2
#define TombolJam P2_0
#define  TombolMenit  P2_1
#define  TombolDetik  P2_2
#define  TombolKurangiJam  P2_3
#define  TombolKurangiMenit P2_4
#define  TombolKurangiDetik  P2_5
#define  TombolPause  P2_6
#define  TombolMulai P2_7

//******membentuk ruas-ruas angka untuk ditampilkan (angka 0 hingga 9 secara array)*******/
void Ruas2Digit (unsigned char c, unsigned char pos){
code char KombinasiRuas[]={0x88,0xBE,0xC4,0x94,0xB2,0x91,0x81,0xBC,0x80,0x90};
    Ruas[pos++] = KombinasiRuas[c/10];
    Ruas[pos]      =KombinasiRuas[c%10];
    }
       
void PerbaruiTampilan   (void)
/*  jam     menit        detik        1/100
      0 0    0 0         0 0         0 0
      0 1     2 3         4 5         6 7    posisi ruas digit
     
 */
{
    Ruas2Digit(Jam,0);
    Ruas2Digit(Menit,2);
    Ruas2Digit(Detik,4);
    Ruas2Digit(Hitung,6);
   
    }

........get this code in download section

kirim ke teman | versi cetak

Berita "C Programming for 8051/ AVR" Lainnya