[TI-H] PulseWidthModulation


[Next][Index][Thread]

[TI-H] PulseWidthModulation




Didn't test it, but this should work. The 'on' pulse is a bit longer than
the 'off' pulse.

begin:
    ld b,0
loop:
    bcall(_getky)
    cp kDown
    call z, incb    ;speed down
    cp kUp
    call z, decb    ;speed up
    cp kClear
    ret z
    ld a,C3    ;off
    out(00),a
    call wait
    ld a,C0    ;on
    call wait
    jp loop
incb:
    inc b \ ret
decb:
    dec b \ ret
wait:
    ei \ halt \ djnz wait \ ret