This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using asm variable in C

Hello!
In my project in Keil i am using mixing programming C and ASM with working inline assembler.
I have some problems to access variable define in asm from C.

I define variable in module spi (spi.src file)

NAME SPI

?DT?spi_vars?SPI SEGMENT DATA

PUBLIC ADC1H,ADC1L,DAC2H,DAC2L

RSEG ?DT?spi_vars?SPI

ADC1H DATA 0x32
ADC1L DATA 0x33
DAC2H DATA 0x34
DAC2L DATA 0x35

?BT?spi_bit_vars?SPI SEGMENT BIT

PUBLIC SPI_num

RSEG ?BT?spi_bit_vars?SPI

SPI_num BIT0x24.1

and define this variable using C (file main.h included in main.c)

extern data unsigned char DAC2H;
extern data unsigned char DAC2L;
extern data unsigned char ADC1H;
extern data unsigned char ADC1L;
extern bit SPI_num;

.

But when i try using this variable i get error

main.src(250): error A45: UNDEFINED SYMBOL

Also i try using inline assembler in my main.c file

EXTRN DATA (DAC2H,DAC2L,ADC1H,ADC1L)
EXTRN BIT  (SPI_num)

but get error:

CLASSES (XDATA (X:0x0-X:0x7FF), HDATA (X:0x0-X:0x7FF), CODE (C:0x0-C:0x7FFF), CONST (C:0x0-C:0x7FFF),
ECODE (C:0x0-C:0x7FFF), HCONST (C:0x0-C:0x7FFF))
*** ERROR L220: INVALID INPUT MODULE
    MODULE:  main.obj (MAIN)

question :
How to correct access to assembler variable fro C with working inlin assembler or without.

0