EmbeddedRelated.com
Forums

HCS12 and Code Warrior

Started by big_bear_london June 3, 2004
I am new to cross compiling C (but not Mot assembly) and although it
looked quite intuitive I am at loss for why my program does not work.
Any assistance would be appreciated.

I'm using a Technological Arts 9S12C Docking Station, the
NanoCore12MAX (9S12C32 MCU, 8MHz, 48-pin), and a PEMicro ICD12 BDM.
The sample program on the chip ran properly (LED flashed), however the
"Getting Started" TnA sample CodeWarrior code did not. So by digging
through I have written a simple piece of code to turn on the LEDS
(PT0, PT1).

Here's the code:

#include <hidef.h>
#include <mc9s12c32.h> /* derivative information */

void main(void) {
INITRG = (unsigned char) 0; // ; Initialization of internal
register position
INITRM = (unsigned char) 39; // Initialization of Internal RAM
Position Register
PWME = (unsigned char) 0; // disable PWM
MODRR = (unsigned char) 0; // port T is multiplexed to allow PWM
or IOC,
// Module Routing Register must be
configured
RDRT = (unsigned char) 0; // full drive o/p

DDRT = (unsigned char) 3; // port T b0 and b1 enables to control
lights on TnA board.
PTT = (unsigned char) 3; // LEDs on

while(1){}
}



Please try PT2 and PT3 instead of PT0 and PT1. It will work then.
--- In , "big_bear_london"
<big_bear_london@y...> wrote:
> I am new to cross compiling C (but not Mot assembly) and although it
> looked quite intuitive I am at loss for why my program does not
work.
> Any assistance would be appreciated.
>
> I'm using a Technological Arts 9S12C Docking Station, the
> NanoCore12MAX (9S12C32 MCU, 8MHz, 48-pin), and a PEMicro ICD12 BDM.
> The sample program on the chip ran properly (LED flashed), however
the
> "Getting Started" TnA sample CodeWarrior code did not. So by
digging
> through I have written a simple piece of code to turn on the LEDS
> (PT0, PT1).
>
> Here's the code:
>
> #include <hidef.h>
> #include <mc9s12c32.h> /* derivative information */
>
> void main(void) {
> INITRG = (unsigned char) 0; // ; Initialization of internal
> register position
> INITRM = (unsigned char) 39; // Initialization of Internal
RAM
> Position Register
> PWME = (unsigned char) 0; // disable PWM
> MODRR = (unsigned char) 0; // port T is multiplexed to allow
PWM
> or IOC,
> // Module Routing Register must be
> configured
> RDRT = (unsigned char) 0; // full drive o/p
>
> DDRT = (unsigned char) 3; // port T b0 and b1 enables to
control
> lights on TnA board.
> PTT = (unsigned char) 3; // LEDs on
>
> while(1){}
> }






Thank you it works now, but where in all this documentation did you
find that? Their own schematic and PCB say it is PT0 and PT1. gah.

--- In , "zeta_alpha2002" <zeta_alpha2002@y...>
wrote:
> Please try PT2 and PT3 instead of PT0 and PT1. It will work then.
>