Microcontroller Help: how to program codewarrior ide?

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

  • Kaustubh Katdare
    Kaustubh Katdare
    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
    thread moved to where??? superblog?
  • debu
    debu
    @tyr: Welcome to CE! ๐Ÿ˜

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

    Regards,

    Debu ๐Ÿ˜€
  • tyr
    tyr
    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
    @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 ๐Ÿ˜€

You are reading an archived discussion.

Related Posts

Our moderator, CEan Patty is down with fever. I wish a big "Get Well Soon" โ€‹ to Patty! โ€‹
๐Ÿ˜hi friends before 4days ido know nothing adout CE but, now i was very happy with your replies hope i will be loyal
I was wondering if anyone knows if there is anywhere to find default values that can be used to calculate HVAC loads and other baseloads for different building types. I...
hi all i am vibhu an ece 3rd year student..hope to learn a lot from this great forum.
Hi Does windows Vista allow graphics in C using tc,it gives nothing when I run it,inspite of an errorfree code. If not, then please suggest which compiler should I use?