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.
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 } }