is the progamme is write for running of internal EEPROM of PIC16F877A microcontroller

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
Plz help me.

i have written one programme of internal EEPROM with PIC microcontrollers. Is the programme is right to run. plz tell me the connection diagram. the compliler is microc.


// 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
char *txt1="current";
int I,V;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
void main()
{

while(1)
{
current_read();
}

txt1= " current";
Lcd_out(1,1,txt1);
Delay_ms(2000);
ADCON1=0x22; // A/D Conversions of input voltage
TRISA= 0xFF; // All input Pins of A are connected as inputs
}
void current_read()
{
V= ADC_Read(2)* 5000/1024;
I = V - 2.5;
FloatToString(I,str)
Lcd_Out(1,8,str)
Delay_ms(10);
}
 

Why are you asking for connections again? I have answered you in this post:

https://www.edaboard.com/threads/252004/#post1078380

Why don't you try actually wiring it up, then see if your code runs?

Also, please remember to use the code or syntax tags for your code, as I mentioned.
 
i am trying more than 10 times but the problem where is occurring i am unable to find. After burning to that programme in microcontroller directly is it connected with LCD. as per the the LCD programme. or when i will give ANALOG input in pinAN2 that will store and after then it will display. Plz help me.
 

# 1

Is this progrmme is for pic16f877a microcontroller for internal memory .
whether is my false, that it is not displayed.


// 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 port_confg();
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

void main()
{
char WriteEEPROM(char Addr, char Data);
char ReadEEPROM(char addr);

port_confg();
Delay_ms(2000);

while(1)
{
}
}

void port_confg()
{
PORTB = 0;
PORTA = 0;
TRISB = 0b00001111;
TRISA = 0b00100000;
}


char WriteEEPROM(char Addr, char Data)
{
while(EECON1.WR == 1);
EEADR = Addr;
EEDATA = Data;
EECON1.EEPGD = 0; // 0 = Access data EEPROM memory
EECON1.WREN = 1; // enable writes to internal EEPROM
EECON2 = 0x55; // Required sequence for write to internal EEPROM
EECON2 = 0xAA; // Required sequence for write to internal EEPROM
EECON1.WR = 1; // begin write to internal EEPROM
EECON1.WREN = 0;

}
char ReadEEPROM(char addr)
{
EEADR = addr;
EECON1.EEPGD = 0;
EECON1.RD = 1;
asm nop; asm nop;
return EEDATA;
}
high plz help me
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…