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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/14/05 02:09
Read: times


 
#102369 - Avoid my previous post "here is my code"
Responding to: ???'s previous message
Here i hav reposted my codes with some correction

When i programmed this in AT89C51 and tested with LED's i could see only till the seventh instruction getting executed (i.e., mov P2,#0FEh). I compensated bounce in software and my triggering circuit connected to port3.2 (to start timer) is same as the reset circuit.

can any one help me solve the problem.
The description is given with each code...

/*Control sequence generation for Miniature assembly head*/
LOOP: mov TH0,#00d ; loads high byte of T0 with 00
mov TL0,#00d ; loads low byte of T0 with 00
mov TH1,#00d ;T1 used for debounce delay
mov TL1,#18d ; 2msec
mov TMOD,#11h ; sets T0 & T1 in 16 bit mode and sets gate
mov 90h,#09Eh ; sets apppropriate ports before running the Timer
mov P2,#0FEh ; sets p2.0 to drive an LED
clr RS0 ; clears RS0 in PSW to select register bank R0
clr RS1 ; clears RS1 in PSW to select register bank R0
mov R1,#00d ; loads R1 with 00
MOV R0,#13d ; loads R0 with 13
mov IE,#83h ; enabling interrupts(Global,INT0,and Timer0 )
setB IT0 ; Enables p3.2 to receive falling edge signal
L1: NOP
JNB IE0,L1 ; Jumps to L1 if IEO is not set
SetB TR1 ; for debounce
CLR IE0 ; Clears IE0
JNB TF1,$
CLR TR1
SetB TR0 ; starting Timer to run the 50 sec slot
mov P2,#0FFh ; switch off LED(just indication for start)
mov 90h,#05Ch ; sets appropriate ports upto 2sec
S1: ACALL SUB ; calls subroutine
cjne R1,#2d,S1; compares 2f with R1 and comes out of loop if found equal
mov 90h,#056h ; sets appropriate ports upto 3sec
S2: ACALL SUB
cjne R1,#3d,S2
mov 90h,#052h ; sets appropriate ports upto 13sec
S3: ACALL SUB
cjne R1,#13d,S3
mov 90h,#05Ah ; sets appropriate ports upto 15sec
S4: ACALL SUB
cjne R1,#15d,S4
mov 90h,#04Ah ;sets appropriate ports upto 19sec
S5: ACALL SUB
cjne R1,#19d,S5
mov 90h,#0EAh ;sets appropriate ports upto 35sec
S6: ACALL SUB
cjne R1,#35d,S6
mov 90h,#0FBh ; sets appropriate ports upto 38sec
S7: ACALL SUB
cjne R1,#38d,S7
mov 90h,#0BBh ;sets appropriate ports upto 40sec
S8: ACALL SUB
cjne R1,#40d,S8
mov 90h,#0BFh ;sets appropriate ports upto 49sec
S9: ACALL SUB
cjne R1,#49,S9
clr TR0 ; clears run T0 bit
mov 90h,#09Eh
mov P2,#0FEh
AJMP Loop ; Absolute jump to program start

SUB: NOP
L2: JB TF0,L3
L3: DJNZ R0,L2
MOV R0,#13d
INC R1
RETI

End ; end program execution





List of 21 messages in thread
TopicAuthorDate
Doubts regarding AT89C51 Port Usage            01/01/70 00:00      
   Answers            01/01/70 00:00      
   your suggestions were useful            01/01/70 00:00      
      Central ground star point            01/01/70 00:00      
   doubts            01/01/70 00:00      
      Why using an interrupt?            01/01/70 00:00      
         use an interrupt for debounce, not key            01/01/70 00:00      
   This is what iam going on with            01/01/70 00:00      
      Why even consider sleep mode for a machi            01/01/70 00:00      
         can RC network eleminate bounce            01/01/70 00:00      
            nope, you will be hanging at the noise m            01/01/70 00:00      
               Debounce            01/01/70 00:00      
            Possible, but...            01/01/70 00:00      
      What else does your program?            01/01/70 00:00      
         outside of 50 sec slot            01/01/70 00:00      
            do I get it right            01/01/70 00:00      
               yes            01/01/70 00:00      
                  ttthhattsss all fffolks            01/01/70 00:00      
   here is my code            01/01/70 00:00      
      I did not ask that            01/01/70 00:00      
      Avoid my previous post "here is my code"            01/01/70 00:00      

Back to Subject List