Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Plz suggest the right programme of the EEPROM

Status
Not open for further replies.

bikash123

Member level 2
Joined
Feb 19, 2012
Messages
48
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Tezpur University
Activity points
1,672
hello friends, plz tell me how i will display in lcd using interna eeprom of pic16f877a microcontrollers.plz hel me . my compiler is micro c. i have written to this programme . what will require t0 write plz tell me. urgent one.diagram also tell me. plz...

Code:
/
/ LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
void WriteEEPROM(char Addr, char Data);
char ReadEEPROM(char addr);

void main()
{
PORTB=0;
TRISB=0;
TRISA=0xFF;
}

void WriteEEPROM(char Addr, char Data)
{
while(EECON1.WR == 1);
EEADR = Addr;
EEDATA = Data;
EECON1.EEPGD = 0;
EECON1.WREN = 1;
EECON2 = 0x55;
EECON2 = 0xAA;
EECON1.WR = 1;
EECON1.WREN = 0;
}
char ReadEEPROM(char addr)
{
EEADR = addr;
EECON1.EEPGD = 0;
EECON1.RD = 1;
asm nop; asm nop;
return EEDATA;
}
 

Try this

Code:
/
/ LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
void WriteEEPROM(char Addr, char Data);
char ReadEEPROM(char addr);
int idata;
char strdata[17];

void main()
{
PORTB=0;
TRISB=0;
TRISA=0xFF;

idata = ReadEEPROM(Addr);
IntToStr(idata, strdata);
LcdOut(1,1,strdata);

}

void WriteEEPROM(char Addr, char Data)
{
while(EECON1.WR == 1);
EEADR = Addr;
EEDATA = Data;
EECON1.EEPGD = 0;
EECON1.WREN = 1;
EECON2 = 0x55;
EECON2 = 0xAA;
EECON1.WR = 1;
EECON1.WREN = 0;
}
char ReadEEPROM(char addr)
{
EEADR = addr;
EECON1.EEPGD = 0;
EECON1.RD = 1;
asm nop; asm nop;
return EEDATA;
}


---------- Post added at 11:53 ---------- Previous post was at 11:40 ----------

Check these links...

https://www.mikroe.com/forum/viewtopic.php?f=147&t=48433
https://www.mikroe.com/forum/viewtopic.php?f=147&t=48450
 
Last edited:

#
I have written this program in micro c and also build it after then i am using this program in microcontroller but what happen, it does n't displayed in LCD. So, where is the problem i am unable solve it. Plz if any bodyhave suggestion plz share it. so that i can solve to that problem.
 

i want to store the battery charging stage at every 10 sec intervals. the battery is 12V and 7Ahr capacity. It is connected with a solar module of capacity 10Wp and 0.4-06 short circuit current with 12v supply.
Charge= current*time concept. when the battery voltage will reach 7Ahr then it will disconnect the supply.
 

unsigned int j, i ;
char disp[10];

// Software I2C connections
sbit Soft_I2C_Scl at RC3_bit;
sbit Soft_I2C_Sda at RC4_bit;
sbit Soft_I2C_Scl_Direction at TRISC3_bit;
sbit Soft_I2C_Sda_Direction at TRISC4_bit;
// End Software I2C connections

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections



void Write_Rom() {

Soft_I2C_Start(); // Issue start signal
Soft_I2C_Write(0xA0); // Address PCF8583, see PCF8583 datasheet
Soft_I2C_Write(0); // Start from address 2
Soft_I2C_Write(10);
Soft_I2C_Stop();

}



void Read_Rom() {

Soft_I2C_Start(); // Issue start signal
Soft_I2C_Write(0xA0); // Address PCF8583, see PCF8583 datasheet
Soft_I2C_Write(0); // Start from address 2
Soft_I2C_Start(); // Issue repeated start signal
Soft_I2C_Write(0xA1); // Address PCF8583 for reading R/W=1

j = Soft_I2C_Read(0); // Read weekday/month byte
Soft_I2C_Stop(); // Issue stop signal

}



void Init_Main() {

TRISB = 0;
PORTB = 0xFF;
TRISB = 0xff;
ADCON0 = 0; // Configure AN pins as digital I/O
ADCON1 = 0;
C1OUT_bit = 0; // Disable comparators
C2OUT_bit = 0;

Soft_I2C_Init(); // Initialize Soft I2C communication
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear LCD display
Lcd_Cmd(_LCD_CURSOR_OFF); // Turn cursor off
}


void main() {
Delay_ms(1000);
Init_Main();
// Perform initialization // j=1;



Write_Rom();
delay_ms(500);
Read_Rom();
IntToStr(j,disp);
Lcd_Out(1,1,disp);
//j=2


}

---------- Post added at 06:27 ---------- Previous post was at 06:27 ----------

this is my code sir, i am using this....not success
 

Use adc to read the battery voltage. If voltage = 12V then stop charging. Why are you doing eeprom thing? post your circuit.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top