Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

dely routine to turn on port b pin 1 of the 68hc11

Need help writing a delay routine to turn on port b pin one at a 15 KHz rate. Any Ideas

How do I count the cpu cycles to develop a loop to turn the pin on nad off? Any ideas would be helpful. Thanks

Comments

  • babyjeanbabyjean Member Posts: 3
    : Need help writing a delay routine to turn on port b pin one at a 15 KHz rate. Any Ideas
    :
    : How do I count the cpu cycles to develop a loop to turn the pin on nad off? Any ideas would be helpful. Thanks
    :

    I need to measure a very short pulse width(5 us). Can
    anyone do that??

  • dieharddiehard Member Posts: 87
    : : Need help writing a delay routine to turn on port b pin one at a 15 KHz rate. Any Ideas
    : :
    : : How do I count the cpu cycles to develop a loop to turn the pin on nad off? Any ideas would be helpful. Thanks
    : :
    :
    : I need to measure a very short pulse width(5 us). Can
    : anyone do that??
    :
    : Yes, the same to me. Only it has to be a pulse width of 8us.

  • dieharddiehard Member Posts: 87

    I found something in a book!!! It makes a delay of 10ms. ;-)

    ===================================
    ;Subroutine DLY10
    ;Time delay of approx. 10ms
    ;really loops 3400 times for a delay of 6*3400*E
    ;No calling registers
    ;No return registers
    ;CCR affected, rest unaffected

    DLY10
    PSHX ;preserve IX
    LDX #3400 ;init loop

    LDLDY10 ;run loop
    DEX
    BNE
    PULX ;restore IX
    RTS
    ===================================

    So i think if you want a delay of 1ms you init. the loop whit #340.
    I will testing this with my scope, if i have some free time. I hope it work.
  • babyjeanbabyjean Member Posts: 3
    : : : Need help writing a delay routine to turn on port b pin one at a 15 KHz rate. Any Ideas
    : : :
    : : : How do I count the cpu cycles to develop a loop to turn the pin on nad off? Any ideas would be helpful. Thanks
    : : :
    : :
    : : I need to measure a very short pulse width(5 us). Can
    : : anyone do that??
    : :
    : : Yes, the same to me. Only it has to be a pulse width of 8us.
    :
    : i am trying to use 2 ic(1 for rise, 1 for fall)

  • dieharddiehard Member Posts: 87
    : : : : Need help writing a delay routine to turn on port b pin one at a 15 KHz rate. Any Ideas
    : : : :
    : : : : How do I count the cpu cycles to develop a loop to turn the pin on nad off? Any ideas would be helpful. Thanks
    : : : :
    : : :
    : : : I need to measure a very short pulse width(5 us). Can
    : : : anyone do that??
    : : :
    : : : Yes, the same to me. Only it has to be a pulse width of 8us.
    : :
    : : i am trying to use 2 ic(1 for rise, 1 for fall)
    :
    :
    I think we cant make a pulse of 5us or 8us!
    My 68hc11 drives on a 8Mhz crystal so the 68hc11 use one-fourht of that the crystal supplied. Thus the clock speed is 2 Mhz.
    So you cant make a pulse of a 5us(=5Mhz) or 8us(=8Mhz).

    ;Test.
    ;ACCA = $FF
    ;ACCB = $00

    START:
    STAA #$1004,$FF ;Make port C high.
    STAB #$1004,$00 ;Then make port C low.
    JMP START ;Again.
    END.

    STAA takes 3 cycles.
    STAB takes 3 cycles. This are 6 cycles so if you see you cant make that pulse with the 68HC11 if im right.!!!

    Maybe we can overclock the 68hc11????!!!!


  • babyjeanbabyjean Member Posts: 3
    : : : : : Need help writing a delay routine to turn on port b pin one at a 15 KHz rate. Any Ideas
    : : : : :
    : : : : : How do I count the cpu cycles to develop a loop to turn the pin on nad off? Any ideas would be helpful. Thanks
    : : : : :
    : : : :
    : : : : I need to measure a very short pulse width(5 us). Can
    : : : : anyone do that??
    : : : :
    : : : : Yes, the same to me. Only it has to be a pulse width of 8us.
    : : :
    : : : i am trying to use 2 ic(1 for rise, 1 for fall)
    : :
    : :
    : I think we cant make a pulse of 5us or 8us!
    : My 68hc11 drives on a 8Mhz crystal so the 68hc11 use one-fourht of that the crystal supplied. Thus the clock speed is 2 Mhz.
    : So you cant make a pulse of a 5us(=5Mhz) or 8us(=8Mhz).
    :
    : ;Test.
    : ;ACCA = $FF
    : ;ACCB = $00
    :
    : START:
    : STAA #$1004,$FF ;Make port C high.
    : STAB #$1004,$00 ;Then make port C low.
    : JMP START ;Again.
    : END.
    :
    : STAA takes 3 cycles.
    : STAB takes 3 cycles. This are 6 cycles so if you see you cant make that pulse with the 68HC11 if im right.!!!
    :
    : Maybe we can overclock the 68hc11????!!!!
    :
    :
    : I dont want to make a pulse, I want to measure a pulse
    using input capture. On a 2mhz processor, each clock cycle
    is .5us. So, 6 cycles should equal 3us.

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _____ \ http://forcoder.org \ free video tutorials and ebooks about / Swift PL/SQL Perl C++ Visual Basic .NET Ruby JavaScript Delphi Visual Basic PHP R C C# Java Scratch Objective-C MATLAB Assembly Go Python D Apex F# Erlang Kotlin FoxPro SAS Awk Scala Transact-SQL Lua LabVIEW Fortran Logo Clojure VBScript Crystal Ada ABAP COBOL Alice Hack Prolog Lisp Dart Julia Scheme Bash ML Rust / _____________

Sign In or Register to comment.