Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/14/07 06:41
Read: times


 
#134943 - Re Help:Need Counter Program counts
Responding to: ???'s previous message
Hi
Please try my code here. This program will display 0-99 to 7 segment display with 7447 decoder. The program is very simple.
Two 7447 connect to P1. Number will be displayed is stored at My_Number (internal RAM 30H). Before send to 7447 this number should convert to BCD data with HexaToDecimal sub-routine, the result is BCD_Number (31H).

Try it!!

;==========================================================
;Program Title : "7 Segmen Display with 74LS47"

;**********************************************************
;Microcontroler Pin/Port Assignment
;**********************************************************

DisplayData equ P1

;**********************************************************
;Internal RAM mapping
;**********************************************************

My_Number equ 30H
BCD_Number equ 31H

;**********************************************************
;Main Program
;**********************************************************
Org 0000H
Main_Prog:
mov My_Number, #0
mov DisplayData, My_Number
Main_Prog_Loop:
inc My_Number
call HexaToDecimal
mov DisplayData, BCD_Number
call Delay
mov A, BCD_Number
cjne A, #99H, Main_Prog_Loop
mov My_Number, #0FFH
sjmp Main_Prog_Loop

;**********************************************************
HexaToDecimal:
mov A, My_Number
mov B, #10
div AB
swap A
orl A, B
mov BCD_Number, A
ret

;****************************************************************************
;Delay Routine
;****************************************************************************
Delay:
mov R6, #0
mov R7, #0
Delay_Loop:
djnz R6, Delay_Loop
djnz R7, Delay_Loop
ret

end






List of 11 messages in thread
TopicAuthorDate
Help:Need Counter Program counts from 0 to 70 dec            01/01/70 00:00      
   I know no digit with '51 expertise            01/01/70 00:00      
   0-70 in Decimal            01/01/70 00:00      
   Re Help:Need Counter Program counts            01/01/70 00:00      
      Microcontroler Pin/Port Assignment            01/01/70 00:00      
         Re Microcontroler Pin/Port Assignment            01/01/70 00:00      
      Nice program. Here is a schematic            01/01/70 00:00      
         and the fried pigeons flew in through the window            01/01/70 00:00      
         Are you going to be there ...            01/01/70 00:00      
   Why you need microcontroller            01/01/70 00:00      
      Alternatively            01/01/70 00:00      

Back to Subject List