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

"NUMBER" directive

Hello All,

I need some help here on this directive...

I have two files main.asm and lcd.asm

I have declared the port pin as
"light equ p2.1" in lcd.asm

I am able to access all other function,variable in lcd.asm using extrn and public, but I am not able to access the "light equ p2.1"

I searched the threads ,also the examples and pdf files,I was not able to get a clear understanding.

Rgds
Raj Shetar

  • Hi All,

    The error message is as follows

    *** ERROR L121: IMPROPER FIXUP
        MODULE:  main.obj (MAIN)
        SEGMENT: MAIN_PRG
        OFFSET:  0007H
    

    The source code of the main.asm file is like...
    name main
    
    extrn code   (lcd_init,LCD_LINE1,LCD_LINE2,LINE1_CHAR,LINE2_CHAR,L_DELAY,DLAYms)
    extrn code   (TITLE1,TITLE2)
    extrn number (LITE)
    
    main_prg segment code
    
    	cseg at 0
    	using 0
    	jmp start
    
    	rseg main_prg
    start:	mov sp,#30h
    
    	LCALL L_DELAY
    	SETB	LITE ;I am not able to access this,If I comment this there is no error
    
    	LCALL LCD_INIT		;THIS WILL INITIALISE THE LCD FOR 4 BIT MODE
    
    	MOV DPTR,#TITLE1
    	LCALL LCD_LINE1		;THIS WILL DISPLAY THE MESSAGE ON LINE 1 OF THE LCD
    
    loop:	jmp loop
    
    	end
    

    The source code for lcd.asm goes like(full code not shown)...
    
    name lcd
    
    public lcd_init,LCD_LINE1,LCD_LINE2,LINE1_CHAR,LINE2_CHAR,L_DELAY,DLAYms
    public TITLE1,TITLE2,LITE
    
    
    lcd_prg 	segment code
    lcd_const	segment code
    lcd_var		segment data
    
    
    
    	rseg lcd_var
    
    TEMP1:	ds 1
    TEMP2:  ds 1
    TEMP3:	ds 1
    TEMP4:  ds 1
    TEMP5:  ds 1
    
    
    ;I need to access the following variables in another file
    LCD_D3	EQU	P2.2
    LCD_D2	EQU	P2.3
    LCD_D1	EQU	P2.4
    LCD_D0	EQU	P2.5
    EN	EQU	P2.6
    RS	EQU	P2.7
    LITE	EQU	P2.1
    
    	rseg lcd_prg
    ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    LCD_INIT:
    ;***************************************
    ;THIS IS REQUIRED.
    ;0010[4 BIT MODE]
    
    	CLR	RS
    	NOP
    	CLR	LCD_D3
    	CLR	LCD_D2
    	SETB	LCD_D1
    	CLR	LCD_D0
    	NOP
    	SETB	EN
    	NOP
    	NOP
    	CLR	EN
    ;
    ;full code not shown
    ;
    

    I need to know how to access the variable names declared using equ...I know it can be used by making use of "NUMBER" but I guess I need some help here.

    Rgds
    Raj Shetgar

  • Wouldn't sbit be more appropriate?

  • I have similar error while working on C51.
    But for me it was due in sufficient code memory . Once i expanded code memory settings to 64k the error L121: IMPROPER FIXUP was fixed.

    NITIN

  • Hi Andy,

    Can you please explain how it can be done...

    Rgds
    Raj Shetgar

  • You not using directive extern number but extern data ???

  • hi,

    Can you please explain how to use it...I have been trying it for a long time with no resutls.

    Rgds
    Raj

  • Raj,
    you now have two threads running on two boards that both say basically the same:
    "I have a problem with something and instead of tackling the problem as anyone else would I hunt for some exotic assembler/compiler/linker function"

    Why do you not sit back, figure out what your problem is and fix ir using standard means

    It serves no purpose to hunt for exotic features when the solution is as basic as "you should have used a /h file" or "buss two pins".

    Erik