This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Instruction cycle

Hi,
I am generating pulse output through 8051 microcontroller using assembly langauge.
I don't wnat to use any timer for time delay, I would like to use instruction delays as follows...

CLR portbit......3 cycles
NOP..............1 cycle
NOP..............1 cycle
NOP..............1 cycle
SETB portbit.....3 cycles
NOP..............1 cycle
NOP..............1 cycle
NOP..............1 cycle
CLR portbit......3 cycles

6cycles
---| |-------|
|-------| |
6cycles

OFF time = 1+1+1+3
ON time = 1+1+1+3

Is it my calculation is correct here?.
SETB portbit.....3 cycles will be added into OFF time or ON time?

Please comment on this...

Thanks in advance
Rajesh

  • hi,

    why just not read hardware manual. For example, Atmel hardware manual says:

    Writing to a Port
    When an instruction changes a port latch value, the new value arrives at the latch during S6P2 of the final cycle of the instruction. However, port latches are sampled by their output buffers only during Phase 1 of any clock period. (During Phase 2, the output buffer holds the value sampled
    during the previous Phase 1). Consequently, the new value in the port latch does not actually appear at the output pin until the next Phase 1, which is at S1P1 of the next machine cycle. See Figure 39 in the Internal Timing section.
    If the change requires a 0-to-l transition in Port 1, 2, or 3, an additional pullup is turned on during S1P1 and S1P2 of the cycle in which the transition occurs to increase the transition speed. The extra pullup can source about 100 times the current that the normal pullup can. The internal pullups are field-effect transistors, not linear esistors. The pullup arrangements are shown in Figure 5.

    In your case the duty cycle will be about 50% (meandre).

    Regards,
    Oleg

  • Hi,
    In the above posting please ignore the waveform...
    ************************
    6cycles
    ---| |-------|
    |-------| |
    6cycles
    ***********************

    I have tried to create waveform with ON and OFF times. But it was become something else after posting it.

    thanks
    Rajesh

  • well, the least you could do would be to verify the cycles you calculate with in "the bible". If you state the wrong cycle count for an instruction, the total will be off as well.

    Erik

  • "But it was become something else after posting it."

    For "ASCII-Art" to work, you need a monospaced (non-proportional) font.

    Follow the instructions for posting code, and it'll work:

          6cycles
    ---| |-------| |-------| |
                    6cycles
    And don't forget to check it by pressing the 'Preview' button before 'Post'

  • Thanks erik and Neil,
    My original thought was to show OFF time and ON time as follows...

    |6cycles|-------|
    |-------|6cycles|


    Thanks for ur special inputs which I have asked to ignore.

    I got very good explaination from Sergeev. If u want to add any thing to that part I will be very happy.

  • I got very good explaination from Sergeev. If u want to add any thing to that part I will be very happy.
    If the explaination from Sergeev was good, why do you want micro to add to it.

    as said so often before when specifically addressing micro, use e-mail, not the forum

    Erik

  • Erik,
    I am sorry I didn't get why u mensioned "micro" in ur message?
    If u want to give explaination otherthan technical, please give me ur email id I will continue to mail u directly instead of wasting the space on this forum.
    I have lot of respect on the people who works for the forum to give stright technical answers.

    Thanks in advance

  • I am sorry I didn't get why u an abbreviation for micro mensioned "micro" in ur an abbreviation for micro resistor message?
    If u an abbreviation for micro want to give explaination otherthan technical, please give me ur an abbreviation for micro resistor email id I will continue to mail u an abbreviation for micro directly instead of wasting the space on this forum.
    I have lot of respect on the people who works for the forum to give stright technical answers.

    So reading the above as something related to the '51 does not make one bit of sense

    THIS IS NOT A FRIGGIN CELLPHONE MESSAGE IT IS A COMPUTER FORUM POST

    Erik