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

Include files in assembly...

Hi all,
I have two files,as follows...when I simulate the sub routine is never executed.

file 1(main.asm)

#include "rs_485.asm"


	org 0000h
	ljmp on_reset


	org 002bh
on_reset:
	mov ie,#00h
	mov sp,#07h
	lcall rs_485_init	;initailise the serial communication

	end

file2(rs_485.asm)
rs_485_init:

	mov tmod,#20h		;timer 1 in mode2(auto reload)
	mov th1,#-3		;reload value for 9600 baud rate
	mov scon,#50h		;8 bit,1 start,1 stop and REN enabled
	clr ti			;clear transmit interrupt flag
	clr ri			;clear receive interrupt flag
	setb tr1		;Start timer 1
	ret

Parents Reply Children
  • Aagh! another one!!

    This is Assembler - so it has nothing to do with any compiler!!!

    See: http://www.keil.com/forum/docs/thread3247.asp

    Also, it is the Linker which does linking (surprisingly enough) - not the compiler!!

    Anyway, since he's #including the file, there's no need for linking - effectively this is just a single source file giving a single object file!

  • Hi all,
    I got the soultion,I'm posting it here so that It could help some one in future...the submodule files are include as shown below(bold text)

    file 1(main.asm)

    org 0000h
    ljmp on_reset
    
    org 002bh
    #include "rs_485.asm" 
    on_reset:
    mov ie,#00h
    mov sp,#07h
    lcall rs_485_init ;initailise the serial communication
    end
    


    file 2(rs_485.asm)
    rs_485_init:
    mov tmod,#20h ;timer 1 in mode2(auto reload)
    mov th1,#-3 ;reload value for 9600 baud rate
    mov scon,#50h ;8 bit,1 start,1 stop and REN enabled
    clr ti ;clear transmit interrupt flag
    clr ri ;clear receive interrupt flag
    setb tr1 ;Start timer 1
    ret
    

  • "I'm posting it here so that It could help some one in future."

    Excellent! - That's the spirit! :-)