We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all I want to add Asm file to a 'C' project. Project has one '.c'and one '.h' file. Assmbly file to be added is with '.a51' extension.only one routine is added to a51 file,which is called from main.A51 file is getting assembled successfully,but project is not getting compiled as whole. decleration in main file is :
extern void delay_asm(unsigned char);
void main() { . delay_asm(2); . }
PR?delay_asm?delay_asm SEGMENT CODE PUBLIC delay_asm delay_asm: USING 0 mov a,R7 rv:dec A Jnz rv RET END
can i write mov DPTR,var_int No - Although the 8051 does a decent job manipulating the 16 bit DPTR, it is an 8 bit processor and just can't do this in one instruction. The DPTR can be loaded with a constant value in one fell sweep, but not with the value contained in a variable. Stick with: mov A,R7 ;take low byte of var_int to acc .. ; logic oprns mov A,R6 ;take high byte of var_int to acc or, if you want this value in DPTR do: mov DPL, R7 ;DPL is low byte of DPTR mov DPH, R6 ;DPH is high byte of DPTR Bill
Hi Bill since we have started discussion on assembly <----> 'C' why don't we discuss other issues which are related to this topic.This can be helpful to all. Every body is invited to share different type of problems they experience while workin with C <-> Assembly. regards Naresh
"Every body is invited to share different type of problems they experience while workin with C <-> Assembly" Better to make that a new thread - with a relevant Subject line. Of course, you'd start with a link to this one!