RSS

Pedometer [Basic]

20 Jun

$regfile = “m16def.dat”
$crystal = 8000000

Config Pind.7 = Input
Config Pinc.0 = Output

Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdmode = Port
Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portc.5 , Rs = Portc.4

 

Dim Count As Integer
Dim Dist As Single
Dist = 0
Count = 0

 

Cls
Lcd “<===Welcome====>”
Lowerline
Lcd “~Digi Pedometer~”
Wait 2
Cls

Do
Reset Portc.0
Set Portd.7
Cls
Lcd “Step :” ; Count
Lowerline
Lcd “Dist :” ; Dist ; ” m”

 

Bitwait Pind.7 , Reset
Count = Count + 1
Dist = Dist + 0.5
Set Portc.0

 
Waitms 450

Loop
End

Advertisements
 
Leave a comment

Posted by on June 20, 2010 in AVR

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: