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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/06/09 10:34
Read: times


 
Msg Score: -1
 -1 Non-Specific question
#170490 - moving display....
In this code i m just moving the display towards left. e.g from 0123 it becomes 1234...and so on...now after it reaches 789...i want it to restart from 0123...where should i put the condition and how?


$mod51

alarm_output equ P1.7
key_start equ p3.0

digit1 data 08h
digit2 data 09h
digit3 data 10h
digit4 data 11h

delayreg data 15h
delayreg100us data 16h
delayreg1ms data 17h

org 2000h
mov sp,#50h
mov digit1,#0
mov digit2,#1
mov digit3,#2
mov digit4,#3



start:
back:
call display
call pip_pip
call delay1ms
inc digit1
inc digit2
inc digit3
inc digit4
jmp start


;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

display:
mov a,digit1
clr p3.2
call segdisplay
setb p3.2

mov a,digit2
clr p3.3
call segdisplay
setb p3.3

mov a,digit3
clr p3.4
call segdisplay
setb p3.4

mov a,digit4
clr p3.5
call segdisplay
setb p3.5

ret

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

segdisplay:
mov dptr,#lookup
movc a,@a+dptr
cpl a
mov p1,a
call delay1ms
mov p1,#0ffh
ret

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pip_pip:
mov r1,#150
pp1:
clr alarm_output
call delay100us
call delay100us
call delay100us
setb alarm_output
call delay100us
call delay100us
djnz r1,pp1
mov r1,#150
bp11:
call display
djnz r1,bp11
mov r1,#250
pp2:
clr alarm_output
call delay100us
call delay100us
call delay100us
setb alarm_output
call delay100us
call delay100us
djnz r1,pp2
mov r1,#15
bp10a:
call display
djnz r1,bp10a
setb alarm_output
mov r1,#30
bp11a:
call display
djnz r1,bp11a
ret

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
delay100us:
mov delayreg100us,#48 ;11.05mhz
djnz delayreg100us,$
ret

delay1ms:
mov delayreg1ms,#10
d1ms:call delay100us
djnz delayreg1ms,d1ms
ret

delay10ms:
mov r4,#10
d10ms:call delay1ms
djnz r4,d10ms
ret

delay100ms:
mov r7,#100
x4: call delay1ms
djnz r7,x4
ret

delay1s:
mov r6,#10
x5: call delay100ms
djnz r6,x5
ret

delay1sec:
mov r5,#100
d1s:call delay10ms
djnz r5,d1s
ret

delaydisp:
call delay1ms
ret

lookup:
db 3fh,06h,5bh,4fh,66h,6dh,7dh,07h ;0,1,2,3,4,5,6,7,8
db 7fh,6fh,48h,43h,0c6h,61h,44h,4eh ;9,a,b,c,d,e,f

end

List of 23 messages in thread
TopicAuthorDate
moving display....            01/01/70 00:00      
   What do *you* think?            01/01/70 00:00      
   Have you written the code?            01/01/70 00:00      
      Understanding your own code is a minimum requirement            01/01/70 00:00      
   what you show is not code            01/01/70 00:00      
   No way to help...            01/01/70 00:00      
      Probably broken output code            01/01/70 00:00      
         Code suggestions for 7segment moving display            01/01/70 00:00      
   You can try this..            01/01/70 00:00      
   NO reply in 4 days.!! Where are you Vijay?            01/01/70 00:00      
      That feature is broken            01/01/70 00:00      
         I would like to, but...            01/01/70 00:00      
         ... and it wouldn't harm anyone to pause the thread            01/01/70 00:00      
            Did you miss the point?            01/01/70 00:00      
               NO, I didn't ... but ...            01/01/70 00:00      
                  jumps in promptly to show how clever they are,            01/01/70 00:00      
      Typical of this poster            01/01/70 00:00      
      O/P has concluded that he has to do it himself            01/01/70 00:00      
         Haha! Do you really think this?            01/01/70 00:00      
            Probably a bit of both?            01/01/70 00:00      
               Yes, most probably both reasons            01/01/70 00:00      
               "Top 5 ways to motivate engineers"            01/01/70 00:00      
            It's only fun the first time!            01/01/70 00:00      

Back to Subject List