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

how to use a bit variable defined in another module?

Gentlemen:
I wanna use a bit variable in file:assem.asm.And the bit variable is defined in another file:main.c;Just as follows:

in main.c
unsigned char bdata flags;
sbit red_flag = flags^1;

in assem.asm
what should I do to let the keil know I want invoke the red_flag bit variable which is defined in main.c;how to declare it? The MCU I use is atmel at89s52.Thanks.
---going to mad.

Parents
  • Dear Jim:
    I have tried,but failed。:(
    no head file is included in c program.
    The head file in assem.asm is as follows:

    #ifndef __MY_H__
    #define    __MY_H__
    ->extrn unsigned char bdata flags;
       sbit red_flag = flags^1;
    #endif __MY_H__
    
    but Keil told me this:
    error A24:SEGMENT TYPE EXPECTED
    error A35:'(' EXPECTED
    error A34:',' EXPECTED
    error A17:INVALID BYTE BASE IN BIT ADDRESS EXPRESSION
    warning A232:new line expected,extra characters found
    I am confused.Don't know why.

Reply
  • Dear Jim:
    I have tried,but failed。:(
    no head file is included in c program.
    The head file in assem.asm is as follows:

    #ifndef __MY_H__
    #define    __MY_H__
    ->extrn unsigned char bdata flags;
       sbit red_flag = flags^1;
    #endif __MY_H__
    
    but Keil told me this:
    error A24:SEGMENT TYPE EXPECTED
    error A35:'(' EXPECTED
    error A34:',' EXPECTED
    error A17:INVALID BYTE BASE IN BIT ADDRESS EXPRESSION
    warning A232:new line expected,extra characters found
    I am confused.Don't know why.

Children