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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/15/05 20:22
Read: times


 
#87580 - picture and code posted again
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.




List of 41 messages in thread
TopicAuthorDate
constant delay-----problem            01/01/70 00:00      
   clarification needed            01/01/70 00:00      
   Timer 0 Mode 1            01/01/70 00:00      
       Timer 0 Mode 1            01/01/70 00:00      
         yes 16-bit mode            01/01/70 00:00      
            show the code            01/01/70 00:00      
               code            01/01/70 00:00      
                  check            01/01/70 00:00      
                  be sure your problem easily solved            01/01/70 00:00      
                     no i am using a trainer kit            01/01/70 00:00      
                        re:no i am using a trainer kit            01/01/70 00:00      
                           code again            01/01/70 00:00      
                              direct vs. immediate addressing            01/01/70 00:00      
                              be sure your problem easily solved again            01/01/70 00:00      
                                 i tried ur code            01/01/70 00:00      
                                    Please be specific!            01/01/70 00:00      
                                       oh YOU            01/01/70 00:00      
                                       re:jan            01/01/70 00:00      
                                          hello            01/01/70 00:00      
                                             use MOVX @Ri            01/01/70 00:00      
                                                8-BIT MEMORY I/O ?            01/01/70 00:00      
                                                   can't be done            01/01/70 00:00      
                                                   can be done            01/01/70 00:00      
                                                      i am asking 8-bit I/O            01/01/70 00:00      
                                                         If you read Erik's answer            01/01/70 00:00      
                                                         now you lost me            01/01/70 00:00      
                                                            Guessing what he means            01/01/70 00:00      
                                                         Set P2            01/01/70 00:00      
                                                            Write P2 once            01/01/70 00:00      
                                       tested code and pulses            01/01/70 00:00      
                                          Missing Picture            01/01/70 00:00      
                                          picture again            01/01/70 00:00      
                                             Re:Picture again            01/01/70 00:00      
                                          picture and code posted again            01/01/70 00:00      
                                    Have you Tried a fixed value?            01/01/70 00:00      
                     no i am using a trainer kit            01/01/70 00:00      
                        Divide and conquer            01/01/70 00:00      
                           And not writing them...            01/01/70 00:00      
               want a program of timer            01/01/70 00:00      
   tracing your code manually....            01/01/70 00:00      
   thanks            01/01/70 00:00      

Back to Subject List