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 am getting multiple public definition error. can anyone help me with this.
driver.c
#include<reg51.h>#include"header.h"sbit RS=P0^4;sbit RW=P0^5;sbit E=P0^6;void lcd_cmd(u8 cmd){ P0=cmd; RS=0; RW=0; E=SET; delay_ms(2); E=CLEAR;}void lcd_data(u8 ch){ P0=ch; RS=1; RW=0; E=SET; delay_ms(2); E=CLEAR;}void lcd_init(){ lcd_cmd(0x2); lcd_cmd(0x38); lcd_cmd(0xE); lcd_cmd(0x6); lcd_cmd(0x1);}
main.c
#include"header.h"void main(){ lcd_init(); lcd_data('A'); while(1);}
header.h
#define PORT0 0#define PORT1 1#define PORT2 2#define PORT3 3#define SET 1#define CLEAR 0typedef unsigned char u8;typedef signed char s8;typedef unsigned int u16;typedef signed int s16;typedef unsigned long int u32;typedef signed long int s32;void io_write(u8 PORT,u8 PIN,u8 val);u8 io_read(u8 PORT,u8 pin);void delay_ms(int d);void lcd_cmd(u8 cmd);void lcd_data(u8 ch);void lcd_init();
Perhaps the error has more specificity about what/where the definitions are coming from?
Don't redefine 8051 registers.