??? 02/13/05 11:16 Read: times |
#87256 - tested code and pulses Responding to: ???'s previous message |
Yes, that TMOD instruction has no #, before entering the code I tested in KEIL. there I found timer is not set at 16-bit mode, due to missing #. I have corrected that one and entertered. But still its the same problem. i roughly drawn the pulses seen in the oscilloscope (CRO). the pulses generated from P1.5. i also changed the pin no. but same thing happens. the pulse is shown below.
Then I changed the code posted very first by me, where I send the pulses through 8255-parallel port interface. The pulses from the 8255 ports are clear. and also the timer gets loaded with the different time delays. the timer runs correctly. C:0x0000 90FF0F MOV DPTR,#0xFF0F ; I/O memory map for 8255 C:0x0003 7480 MOV A,#0x80 ; control word for 8255 C:0x0005 F0 MOVX @DPTR,A C:0x0006 758901 MOV TMOD(0x89),#0x01 REPEAT: C:0x0009 7CA1 MOV R4,#0xA1 ;counts for delay values C:0x000B 7A42 MOV R2,#0x42 ; pointer to delay address H-byte C:0x000D 7B00 MOV R3,#0x00 ;pointer to delay address L-byte C:0x000F 904400 MOV DPTR,#0x4400 ; desired output pulse pattern address pointer AGAIN: C:0x0012 E0 MOVX A,@DPTR C:0x0013 C082 PUSH DPL(0x82) C:0x0015 C083 PUSH DPH(0x83) C:0x0017 90FF0C MOV DPTR,#0xFF0C ;port-A I/O address C:0x001A F0 MOVX @DPTR,A C:0x001B D083 POP DPH(0x83) C:0x001D D082 POP DPL(0x82) C:0x001F A3 INC DPTR C:0x0020 E0 MOVX A,@DPTR C:0x0021 C082 PUSH DPL(0x82) C:0x0023 C083 PUSH DPH(0x83) C:0x0025 90FF0D MOV DPTR,#0xFF0D ; port-B I/O address C:0x0028 F0 MOVX @DPTR,A C:0x0029 D083 POP DPH(0x83) C:0x002B D082 POP DPL(0x82) C:0x002D A3 INC DPTR C:0x002E A882 MOV R0,DPL(0x82) C:0x0030 A983 MOV R1,DPH(0x83) C:0x0032 8A83 MOV DPH(0x83),R2 C:0x0034 8B82 MOV DPL(0x82),R3 C:0x0036 E0 MOVX A,@DPTR C:0x0037 F58A MOV TL0(0x8A),A C:0x0039 A3 INC DPTR C:0x003A E0 MOVX A,@DPTR C:0x003B F58C MOV TH0(0x8C),A C:0x003D A3 INC DPTR C:0x003E D28C SETB TR0(0x88.4) HERE: C:0x0040 308DFD JNB TF0(0x88.5),HERE(C:0040) C:0x0043 C28C CLR TR0(0x88.4) C:0x0045 C28D CLR TF0(0x88.5) C:0x0047 AA83 MOV R2,DPH(0x83) C:0x0049 AB82 MOV R3,DPL(0x82) C:0x004B 8983 MOV DPH(0x83),R1 C:0x004D 8882 MOV DPL(0x82),R0 C:0x004F DCC1 DJNZ R4,AGAIN(C:0012) C:0x0051 80B6 SJMP REPEAT(C:0009) this code works as I aimed, but the problem is that it needs more instruction cycles than the first code by PUSH,POP and extra I/O MAP. so the switching period is more than I designed. If i able to use the port pins of 8051 directly without 8255, i can reduce some cycles, where the pusles are distorted. Please suggest me how reduce the cycle timings. |