Home arrow Support arrow Forums

Luminary Micro Forums

JorgeOrlando

Junior Boarder

2008/11/08 23:38

problem with the usprintf

Hello, I'm currently working with some adc configuring and working with the on-chip temperature sensor of my ek LM3S6965 ev board.
My problem is with the routine I mentioned above, usprintf. The output says this:

undefined reference to `usprintf'

and the code is here:

#include "hw_types.h"
#include "debug.h"
#include "sysctl.h"
#include "diag.h"
#include "../displays/rit128x96x4.h"

#include "hw_memmap.h" //esta la agregue
#include "adc.h" //esta la agregue
#include "ustdlib.h"
int
main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_8MHZ);
//a partir de aqui empece a agregar el adc
unsigned long temp;

//
// Activar el clock del ADC
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC);
//
// Configurar el ADC para muestrear 500KSps
//
SysCtlADCSpeedSet(SYSCTL_ADCSPEED_500KSPS);
//
// Desabilitar el sample sequencer 3
//
ADCSequenceDisable(ADC_BASE, 3); //<--- solo quiero checar temperatura

// Configure sample sequence 3: processor trigger, priority = 0
//
ADCSequenceConfigure(ADC_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
// **************************************************************************************************** ****//

// Configure sample sequence 3 step 0
//
ADCSequenceStepConfigure(ADC_BASE, 3, 0, ADC_CTL_TS | ADC_CTL_END);
//Activa el sequencer 3
ADCSequenceEnable(ADC_BASE,3);
//Activa la interrupcion
ADCIntEnable(ADC_BASE, 3);
//
// Obtiene los datos del sample sequencer 3 de la FIFO
//
//ADCSequenceDataGet(ADC_BASE, 1, &ulValue);
ADCSequenceDataGet(ADC_BASE, 3, &temp);

//aqui termino de configurara ADC
//int temperatura = (int)temp;
unsigned int abc = 0x100;
char szBuffer[32];
//sprintf((char *)szBuffer, "%d", abc);
usprintf(szBuffer, "%02d", abc);

//
// Initialize the OLED display.
//
RIT128x96x4Init(1000000);
RIT128x96x4StringDraw(szBuffer, 30, 24, 15);
DiagExit(0);
}

The problem is in this line:

usprintf(szBuffer, "%02d", abc);

Can anybody help me ? I don't know what I'm doing wrong :S

login or register to reply

patrickleugue

Fresh Boarder

2008/12/10 21:26

Re:problem with the usprintf

Personally, I've tried to use the printf familly without success. I had to use the itoa function that is available in the forum to convert my data into ascii. It solved my problem.

login or register to reply

LMI Brian

Admin

2008/12/10 21:54

Re:problem with the usprintf

Jorge,

You need to build ustdlib.c and link it with your application in order for usprintf to be defined. By including ustdlib.h in your code, you get the declaration for usprintf but not the code for the function.

--Brian

login or register to reply