Microcontroller Help: how to program codewarrior ide?

tyr

tyr

@tyr-BTjgRw Oct 26, 2024
I'm new to the website and having difficulty learning how to program codewarrior ide. we are using assembly language and HCS12 microcontroller.

could anyone help me with some lab related questions?

thanks

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Kaustubh Katdare

    Kaustubh Katdare

    @thebigk Aug 11, 2009

    Thread moved to here.

    Feel free to ask questions and provide as many details you can along with your questions. Be assured that you'll be helped by CEans.
  • tyr

    tyr

    @tyr-BTjgRw Aug 11, 2009

    thread moved to where??? superblog?
  • debu

    debu

    @debu-62iszV Aug 11, 2009

    @tyr: Welcome to CE! 😁

    What do you want to know? Shoot away...

    Regards,

    Debu 😀
  • tyr

    tyr

    @tyr-BTjgRw Aug 11, 2009

    using code warrior....

    ldy #6000
    loop:
    dey
    bne loop


    try embedding this in an outer loop to successively turn an led at port b on and off with a one second period. then embed the wole thing in a continuous loop to run forever.

    second


    use the led flasher code from the other exercise to build a pulse width modulator. the modulator should read a byte from port h and output a pulse to port b with a period of 256 ms and a duty cycle equal to the value of the byte at port h divided by 256


    thanks
  • debu

    debu

    @debu-62iszV Aug 11, 2009

    @tyr:

    This looks like a homework assignment. Anyway, here:
    ;Blink LED on 0th bit of PORTB    
        ORG 0xF000        ;Beginning of code stack
            Start:
                LDS    #0x0C00        ;Load 0x0C00 to the top of the stack
                CLR    COPCTL        ;Disable COP by making the COPCTL register 0
                BSET PORTB, 0     ;Set bit 0 of PORTBB
                ;Outer loop
                outer:
                ; Your code starts here:
                    ldy #6000    ;Load Y with 6000
                    loop:
                        dey        ;Decrement Y
                    bne loop    ;If y!=0 branch to loop
                    ;After wasting 6000 cycles (roughly 1 sec in this case)
                    COM PORTB    ;Complement PORTB
                JMP outer        ;Jump to outer
        END
    
    Now, you should use my code above to make PWM on your own, its really simple.

    Regards,

    Debu 😀