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 and compiling with #pragma ASM

I wanted to use the inline assembly code with C and hence added the
assembly code as follows in the last line of the program as follows

#include<reg51.h>

float test;
unsigned int t_first,t_second,new_test;
unsigned int  volatile  adc_input;
unsigned char first,second,third,fourth,zero1,zero2,zero3,zero4;
unsigned char code  lookup[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};

void main()
{
	  while(1)
	  {

		
	adc_input=P0; 
	adc_input=(int *)adc_input; 
 	test= adc_input*.02*2.78;

	new_test =test*100;

	first =  new_test /1000;
	t_first =new_test%1000;
	second  =  t_first/100;
	t_second= t_first%100;
	third   = t_second/10;
    fourth = t_second%10;

	zero1=lookup[first];
	zero2=lookup[second];
	zero3=lookup[third];
	zero4=lookup[fourth];

	P1=lookup[first];
	P1=lookup[second];
	P1=lookup[third];
	P1=lookup[fourth];

   	 #pragma asm
	JMP $	;
	#pragma endasm


	}

}


Also I have selected the " Generate assemblers SRC file"
and Assemble SRC file.The Startup A51 is added to the project.

The program compiles with out any warnings and errors, without
#pragma being added.
When the # pragma is added it generates Errors L1 and L2.

Will you kindly let me know why This error and how to solve the same .
Please explain the same to me

0