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.

Writing to Internal memory of mcu

Status
Not open for further replies.
Joined
Apr 8, 2012
Messages
201
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Activity points
0
Hi!

I am using PIC18F4523 for my project.

Values of some integer variables are set using increment and decrement pushbuttons.

I want to know wheather and how i can store the variables in the internal memory of mcu and also external eeprom on power failure.

I want to read the variables on power up from internal eeprom and external eeprom.

I am using mikroC PRO and mikroBasic PRO.

Thanks

internetuser2k11
 
Last edited:

18F4523 Have internal EEPROM don't need to external EEPROM

See Mikroe EEPROM Library help it's easy to use.

"

program Eeprom

dim counter as byte ' loop variable

main:
ANSEL = 0 ' Configure AN pins as digital I/O
ANSELH = 0
C1ON_bit = 0 ' Disable comparators
C2ON_bit = 0

PORTB = 0
PORTC = 0
PORTD = 0

TRISB = 0
TRISC = 0
TRISD = 0

for counter = 0 to 31 ' Fill data buffer
EEPROM_Write(0x80+counter, counter) ' Write data to address 0x80+ii
next counter

EEPROM_Write(0x02,0xAA) ' Write some data at address 2
EEPROM_Write(0x50,0x55) ' Write some data at address 0150

Delay_ms(1000) ' Blink PORTB and PORTC diodes
PORTB = 0xFF ' to indicate reading start
PORTC = 0xFF
Delay_ms(1000)
PORTB = 0x00
PORTC = 0x00
Delay_ms(1000)

PORTB = EEPROM_Read(0x02) ' Read data from address 2 and display it on PORTB
PORTC = EEPROM_Read(0x50) ' Read data from address 0x50 and display it on PORTC

Delay_ms(1000)

for counter = 0 to 31 ' Read 32 bytes block from address 0x100
PORTD = EEPROM_Read(0x80+counter) ' and display data on PORTC
Delay_ms(100)
next counter
end.

"
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top