my c code is as shown below but when i compile in keil compailer it will show as c(4): warning C318: can't open file 'DELAY.H' c(21): warning C206: 'delay_ms': missing function-prototype (21): error C267: 'delay_ms': requires ANSI-style prototype Target not created please someone help me to correct this
#include<stdio.h> #include<math.h> #include<reg51.h> #include"DELAY.H" # define DATA P1 void msdelay(unsigned int); sbit e=P3^7; sbit rw=P3^6; sbit rs=P3^5; sbit s1=P2^0; sbit s2=P2^1; sbit s3=P2^2; sbit relay=P0^6; sbit s4=P2^3; void mov_stepper(unsigned char dir,unsigned char rot) { while(rot>0) { if(dir=='c') { P0=0X08; delay_ms(5); P0=0X04; ms_delay(5); P0=0X02; ms_delay(5); P0=0X01; ms_delay(5); } if(dir=='a') { P0=0X01; ms_delay(5); P0=0X02; ms_delay(5); P0=0X04; ms_delay(5); P0=0X08; ms_delay(5); } rot--; } } void lcd_cmd(unsigned char temp) { DATA=temp; rs=0; rw=0; e=1; ms_delay(5); e=0; ms_delay(5); } void lcd_data(unsigned char temp) { DATA=temp; rs=1; rw=0; e=1; ms_delay(5); e=0; ms_delay(5); } void lcd_init() { lcd_cmd(0x38); lcd_cmd(0x06); lcd_cmd(0x0e); lcd_cmd(0x01); lcd_cmd(0x80); } void lcd_puts(unsigned char *s) { lcd_init(); while(*s!='\0') { lcd_data(*s); s++; } } void main() { P0=0X00; P2=0X00; while(1) { if(s1==1) { mov_stepper('c',3); lcd_puts("FIELD A"); while(s1!=0) { relay=1; } relay=0; mov_stepper('a',3); lcd_puts("MONITORING"); } if(s2==1) { mov_stepper('c',6); lcd_puts("FIELD B"); while(s2!=0) { relay=1; } relay=0; mov_stepper('a',6); lcd_puts("MONITORING"); } if(s3==1) { mov_stepper('a',9); lcd_puts("FIELD C"); while(s3!=0) { relay=1; } relay=0; mov_stepper('c',9); lcd_puts("MONITORING"); } if(s4==1) { lcd_puts("FIELD D"); while(s4!=0) { relay=1; } relay=0; lcd_puts("MONITORING"); } lcd_puts("MONITORING"); } }
sir actually i dont know to make c code. I am mechanical student i just copied the code for my project
are you saying that they give you a project that you have no idea how to handle, even if you had paid attention in class?
just to get the name back
I'd probably want to pay for such an education with photocopied bank notes.