??? 10/13/05 11:11 Read: times |
#102302 - here is my code Responding to: ???'s previous message |
Erik
u got that right. the photoMOS relays connected to different ports of port1 operates for different timing intervals(2 - 6(port1.1; 3 - 15(port1.4) ...etc.,) in that 50 sec slot. I hav given my codes below. 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.Each code is followed by its description... /*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,L2 L3: DJNZ R0,L1 MOV R0,#13d INC R1 RETI End ; end program execution |
Topic | Author | Date |
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 |