0-999 DIGITAL COUNTER
5 posters
Page 1 of 1
Digitap- Admin
- Posts : 927
Join date : 2010-09-03
Age : 32
Location : Makati City
Re: 0-999 DIGITAL COUNTER
how can mul by signe byte to un signe byte for 8051
.
.
samarnathdev@yahoo.com- AAA Battery
- Posts : 1
Join date : 2013-04-25
Re: 0-999 DIGITAL COUNTER
Di ko maintindihan ang lengwahe dito.
james- 24V BATTERY
- Posts : 1081
Join date : 2011-11-14
Re: 0-999 DIGITAL COUNTER
mul means multiplex cguro... 8051 hmmpppfff diba mcu nato?
so hands down nko, bsta my knalaman sa programmng (^_^
btw.. na wash out din pla ang diag nito...
so hands down nko, bsta my knalaman sa programmng (^_^
btw.. na wash out din pla ang diag nito...
_________________
6th member of STTM
former 2nd member
im always walking on the rain so that no one could see me crying
ultrasonic™- 24V BATTERY
- Posts : 4475
Join date : 2010-08-19
Age : 38
Location : Davao City
Re: 0-999 DIGITAL COUNTER
" />
once again an old thread. thinking somebody may have a use for this code.
Device=16F84
Symbol Segments = PORTB
Symbol Digits = PORTA
Dim i As Byte
Dim n As Byte
Dim m As Byte
Dim Value As Word
TRISB = $80 ' Set segment pins to output
TRISA = $f0 ' Set digit pins to output
mainloop:
For Value = 0 To 9999
GoSub display ' Display the value
Next Value
GoTo mainloop ' Do it forever
' Subroutine to send the number (0 - 9999) in Value to LEDs
display:
m = m + 1
For i = 0 To 3 'Loop through 4 digits
n = Value Dig i 'Get digit to display
'DIG returns the value of a decimal digit. Simply tell it
'the digit number (0 - 4 with 0 being the rightmost digit)
'you would like the value of, and voila.
GoSub display1 'Display the digit
DelayMS 1 'Leave it on 1 millisecond
Next i ' Do next digit
' This code will display each count 100 times before incrementing to the next value
If m <> 100 Then
GoTo display
EndIf
m = 0
Return 'Return from subroutine. RETURN resumes execution at the statement
'following the GOSUB which called the subroutine
' Surboutine to display one digit on LED
' i = digit number
' n = number to display
display1:
Digits = $00 ' All digits off to prevent ghosting
' Convert binary number in n to segments for LED
Segments = LookUp n, [$40, $79, $24, $30, $19, $12, $02, $78, $00, $18]
' Set digit pin i to 1 (on) and the rest of the pins to 0 (off)
Digits = Dcd i 'ex. if i=2, Digits = 0100
'DCD returns the decoded value of a bit number. It changes a
'bit number (0 - 15) into a binary number with only that bit
'set to 1. All other bits are set to 0.
Return 'Return from subroutine. RETURN resumes execution at the statement
'following the GOSUB which called the subroutine
once again an old thread. thinking somebody may have a use for this code.
Device=16F84
Symbol Segments = PORTB
Symbol Digits = PORTA
Dim i As Byte
Dim n As Byte
Dim m As Byte
Dim Value As Word
TRISB = $80 ' Set segment pins to output
TRISA = $f0 ' Set digit pins to output
mainloop:
For Value = 0 To 9999
GoSub display ' Display the value
Next Value
GoTo mainloop ' Do it forever
' Subroutine to send the number (0 - 9999) in Value to LEDs
display:
m = m + 1
For i = 0 To 3 'Loop through 4 digits
n = Value Dig i 'Get digit to display
'DIG returns the value of a decimal digit. Simply tell it
'the digit number (0 - 4 with 0 being the rightmost digit)
'you would like the value of, and voila.
GoSub display1 'Display the digit
DelayMS 1 'Leave it on 1 millisecond
Next i ' Do next digit
' This code will display each count 100 times before incrementing to the next value
If m <> 100 Then
GoTo display
EndIf
m = 0
Return 'Return from subroutine. RETURN resumes execution at the statement
'following the GOSUB which called the subroutine
' Surboutine to display one digit on LED
' i = digit number
' n = number to display
display1:
Digits = $00 ' All digits off to prevent ghosting
' Convert binary number in n to segments for LED
Segments = LookUp n, [$40, $79, $24, $30, $19, $12, $02, $78, $00, $18]
' Set digit pin i to 1 (on) and the rest of the pins to 0 (off)
Digits = Dcd i 'ex. if i=2, Digits = 0100
'DCD returns the decoded value of a bit number. It changes a
'bit number (0 - 15) into a binary number with only that bit
'set to 1. All other bits are set to 0.
Return 'Return from subroutine. RETURN resumes execution at the statement
'following the GOSUB which called the subroutine
redskin61- AAA Battery
- Posts : 10
Join date : 2014-01-03
Similar topics
» Digital Step-Km Counter
» DIGITAL CLOCK (seconds & minutes) only
» Digital delay pedal
» Led display digital Voltmeter
» HELP? BUYING RELIABLE DIGITAL MULTIMETER
» DIGITAL CLOCK (seconds & minutes) only
» Digital delay pedal
» Led display digital Voltmeter
» HELP? BUYING RELIABLE DIGITAL MULTIMETER
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|