I need help!  L1822 linker error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I need help!  L1822 linker error

Jump to solution
1,500 Views
nathanso
Contributor I

3203_3203.jpgwk5_link error.jpg

 

This is the error I'm getting. I'm using CodeWarrior IDE version5.9.0, build 5294.   I'm in an online class and this is for a lab to control a dc motor through PWM in a closed loop using an optical interrupter switch.  I told my instructor I was having a problem and he sent me this code which is complete and should work, but now I'm having a linking error and he's ignoring my e-mails.  I'm kind of a noob at CodeWarrior, but I think this should be an easy fix I think I just need to point these functions to the correct files(?).  I just have no idea how to do it.   Thanks!

 

------------------------------------------------

// encoder_period.c

 

// Display motor period measured by HC12 Timer to Hyperterminal

// Wytec HC12 Dev Board (24MHz eclk) using Codewarrior-

// Input: Port T pin 0 (PT0) - connects to Opto-interrupter output

// Open J24 to disconnect PT0 from 7-segment display

// Additional connections and ports as in motor_test.c above

// This program will not download to flash or start with the motor connected

 

#include <hidef.h>/* common defines and macros */

#include <mc9s12dg256.h>/* derivative information */

#pragma LINK_INFO DERIVATIVE "mc9s12dg256b"

 

#include "TERMIO.h"

#include <stdio.h>

 

//RAM variables

int rawvalue=0;// unreduced timer period count

 

void init_PLL();

void init_timer();

unsigned int get_period();

void motor_1speed(char);

void delay(int);

 

/************main************/

void main(){

init_PLL();// added - initialize PLL for 24 MHz CPU clock

 

EnableInterrupts;

HILO1_init();

 

TERMIO_Init();

SCI0BDL=156;// added to slow down baudrate to 9600 for hardware

 

init_timer();// configures input capture timer ch.0:...

// ... set main timer period = 5.33us

motor_1speed(133);//run motor at duty cycle passed into fcn as parameter

puts("started");//wait until this is displayed, then connect motor lead

 

for(;;){

rawvalue=get_period();//returns timer period count between 2 pulses

printf("period counts = %d\n\r",rawvalue);// send rawvalue to monitor

printf("RPM = %d\n\r",(rawvalue/80)*60);

delay(1000);//wait 1 sec. for rawvalue to be sent to monitor

}/* keep on */

}

 

void init_timer(){//configures input capture timer: main timer period = 5.33us

TSCR1=0x90;

TSCR2=0x06;

TIOS&=~0x01;

TCTL4=0x01;

}

 

unsigned int get_period(){//measures period between 2 timer ch. 0 input pulses

int event1;

int period;

TFLG1|=0x01;

while(!(TFLG1&0x01)){}

event1=TC0;

while(!(TFLG1&0x01)){}

period=TC0+event1;

return period;

}

 

void motor_1speed(char speed){  //init Port B; run motor at single speed (dutycounts)

DDRB|=0x03;

PORTB=0x01;

PWMCLK=0x01;

PWMSCLA=0x03;

PWMPOL=0x01;

PWMPER0=200;

PWMDTY0=speed;

PWME|=0x01;

}

 

void init_PLL(){// initializes phase-locked loop (hardware)for 24Mhz CPU clock

asm(sei);// for running board standalone w/out Codewarrior

CLKSEL&=~0x80;

PLLCTL|=0x40;

SYNR=0x05;

REFDV=0x01;

while((CRGFLG&0x08)==0){// wait here for lock

CRGFLG|=0x08;

}

CLKSEL|=0x80;

asm(cli);

}   // use this function as is

 

void delay(int del){// delay for 'del' msecs

int i,j;

for(i=0;i<del;i++)

for(j=0;j<2000;j++);

}

 

 

/******* end of file **********/

 

 

------------------------------------------------------------------

 

 

 

 

 

 

 

 

 

 

Labels (1)
0 Kudos
Reply
1 Solution
1,056 Views
CrasyCat
Specialist III

Hello

You are missing implementation of functions HILO1_init,  TERMIO_Init and TERMIO_PutChar in your project.

In order to add implementation of TERMIO_Init and TERMIO_PutChar to your application you need to add the file

{Install}\lib\hc12c\src\termio.c to your project.

I do not know where the function HILO_init is coming from. You may have to add a library or another source file to your project.

CrasyCat

View solution in original post

0 Kudos
Reply
1 Reply
1,057 Views
CrasyCat
Specialist III

Hello

You are missing implementation of functions HILO1_init,  TERMIO_Init and TERMIO_PutChar in your project.

In order to add implementation of TERMIO_Init and TERMIO_PutChar to your application you need to add the file

{Install}\lib\hc12c\src\termio.c to your project.

I do not know where the function HILO_init is coming from. You may have to add a library or another source file to your project.

CrasyCat

0 Kudos
Reply