PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Probleme mit scanf



XC866
22.12.2006, 12:56
Hallo zusammen

Ich habe ein Problem mit der scanf funktion. Ich möchte gernen einen Wert mit meinem uP (XC866) empfangen. Wenn ich aber den scanf Befehl schreibe kommt der unten angehängte Fehler. Das der Speicher voll ist kann ich mir aber fast nicht vorstellen, weil wenn ich den scanf Befehl im Main.C Programm schreibe kommt dieser Fehler nicht.

Gruss und danke

Code:

void UART_vInit(void)
{
// USER CODE BEGIN (UART_Init,2)

// USER CODE END

///
-----------------------------------------------------------------------
/// UART settings
///
-----------------------------------------------------------------------
/// Pin TXD_0 (P1.1) is selected for transmission
/// Pin RXD_0 (P1.0) is selected for reception
/// Receiver enabled
/// Mode 1: 8-bit data, 1 start bit, 1 stop bit, variable baud rate
/// BRG is selected for baudrate generation

SFR_PAGE(_pp2, SST2); // switch to page 2 without saving
P1_ALTSEL0 &= ~(ubyte)0x02; // configure alternate function
register 0
P1_ALTSEL1 |= (ubyte)0x02; // configure alternate function
register 1
SFR_PAGE(_pp0, SST2); // switch to page 0 without saving
P1_DIR |= (ubyte)0x02; // set output direction


MODPISEL &= ~(ubyte)0x01; // configure peripheral input select
register
BCON = 0x00; // reset baudrate timer/reload register
SCON = 0x50; // load serial channel control register

///
-----------------------------------------------------------------------
/// Baudrate generator settings
///
-----------------------------------------------------------------------
/// input clock = fPCLK
/// Fractional divider is disabled
/// baudrate = 9.5785 kbaud

BG = 0xAD; // load baudrate timer/reload register
BCON |= 0x01; // load baud rate control register

// USER CODE BEGIN (UART_Init,3)

// USER CODE END

/// UART interrupt enabled
ES = 1;

} // End of function UART_vInit


//************************************************** **************************
// @Function void UART_viIsr(void)
//
//----------------------------------------------------------------------------
// @Description This is the service routine for the UART interrupt. It
is
// called after each transmission (flag TI set) or
reception
// (flag RI set) of a data unit.
// Please note that you have to add application specific
code
// to this function.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 12.12.2006
//
//************************************************** **************************

// USER CODE BEGIN (UART_Isr,1)

// USER CODE END
int asa;
//int Empfangen;


void UART_viIsr(void) interrupt UARTINT


{
//if (TI)
{
// USER CODE BEGIN (UART_Isr,2)

// USER CODE END
// TI = 0;
}
if (RI)
{
// USER CODE BEGIN (UART_Isr,3)



scanf("%f" , &asa);
// scanf("%5i",&Empfangen);
// Ua=255;
// USER CODE END
RI = 0;
}

} // End of function UART_viIsr






und hier die Fehlermeldungen:

void UART_vInit(void)
{
// USER CODE BEGIN (UART_Init,2)

// USER CODE END

///
-----------------------------------------------------------------------
/// UART settings
///
-----------------------------------------------------------------------
/// Pin TXD_0 (P1.1) is selected for transmission
/// Pin RXD_0 (P1.0) is selected for reception
/// Receiver enabled
/// Mode 1: 8-bit data, 1 start bit, 1 stop bit, variable baud rate
/// BRG is selected for baudrate generation

SFR_PAGE(_pp2, SST2); // switch to page 2 without saving
P1_ALTSEL0 &= ~(ubyte)0x02; // configure alternate function
register 0
P1_ALTSEL1 |= (ubyte)0x02; // configure alternate function
register 1
SFR_PAGE(_pp0, SST2); // switch to page 0 without saving
P1_DIR |= (ubyte)0x02; // set output direction


MODPISEL &= ~(ubyte)0x01; // configure peripheral input select
register
BCON = 0x00; // reset baudrate timer/reload register
SCON = 0x50; // load serial channel control register

///
-----------------------------------------------------------------------
/// Baudrate generator settings
///
-----------------------------------------------------------------------
/// input clock = fPCLK
/// Fractional divider is disabled
/// baudrate = 9.5785 kbaud

BG = 0xAD; // load baudrate timer/reload register
BCON |= 0x01; // load baud rate control register

// USER CODE BEGIN (UART_Init,3)

// USER CODE END

/// UART interrupt enabled
ES = 1;

} // End of function UART_vInit


//************************************************** **************************
// @Function void UART_viIsr(void)
//
//----------------------------------------------------------------------------
// @Description This is the service routine for the UART interrupt. It
is
// called after each transmission (flag TI set) or
reception
// (flag RI set) of a data unit.
// Please note that you have to add application specific
code
// to this function.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 12.12.2006
//
//************************************************** **************************

// USER CODE BEGIN (UART_Isr,1)

// USER CODE END
int asa;
//int Empfangen;


void UART_viIsr(void) interrupt UARTINT


{
//if (TI)
{
// USER CODE BEGIN (UART_Isr,2)

// USER CODE END
// TI = 0;
}
if (RI)
{
// USER CODE BEGIN (UART_Isr,3)



scanf("%f" , &asa);
// scanf("%5i",&Empfangen);
// Ua=255;
// USER CODE END
RI = 0;
}

} // End of function UART_viIsr


Fehlermeldungen

Build target 'Target 1'
compiling MAIN.C...
compiling IO.C...
compiling ADC.C...
compiling T2.C...
compiling UART.C...
linking...
*** ERROR L107: ADDRESS SPACE OVERFLOW
SPACE: DATA
SEGMENT: ?DT?MAIN
LENGTH: 0038H
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: Y
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: X
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: W
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: XX
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: E
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: RELOAD_WERT
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: FREQUENZ
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: ESUM
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: KP
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: WINKEL_NEU
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: UA
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: TA
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: KI
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: WINKEL_ALT
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: RESULT
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: AUSGABE_STELLGROESSE
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: EMPFANGEN
SEGMENT: ?DT?MAIN
*** ERROR L105: PUBLIC REFERS TO IGNORED SEGMENT
SYMBOL: WINKEL
SEGMENT: ?DT?MAIN
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 185BH
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 185DH
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 185FH
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 1861H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1863H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1865H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1867H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1869H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 187AH
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 187CH
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 187EH
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: X
MODULE: .\T2.obj (T2)
ADDRESS: 1880H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1882H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1884H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1886H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: WINKEL
MODULE: .\T2.obj (T2)
ADDRESS: 1888H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: RELOAD_WERT
MODULE: .\T2.obj (T2)
ADDRESS: 1897H
Program Size: data=134.5 xdata=0 code=7045
Target not created

ogni42
22.12.2006, 13:36
Kenn den uC nicht, aber die erste Meldung sieht aus als wäre der Speicher zu klein, der Rest sind dann evtl. Folgefehler

SprinterSB
23.12.2006, 18:14
Offenbar ist es nicht der gesamte Quellcode...

Bist du sicher, daß das RAM ausreicht? Ich vermite mal Section DATA ist RAM?
--