Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Writing 2 bytes to EEPROM

Status
Not open for further replies.

wuchy143

Member
Hi,

I need to write a 2 byte number to Esquared. For example I'm able to write the first 8 bits but am confused on how to write the first 8 bits and also tell the microcontroller to write the more significant byte as well. I"m using the PIC12F675 using HIgh Tech C lite. Any thoughts?

Thanks

-mike
 
birdman,

I got this to work fine. Though, when I try and read it back from the EEPROM I do it the same way that I wrote it but this is what happens. So I read in the most significant byte. Shift it over 8 times in my 16 bit variable "hour". Then i read the lower byte from EEPROM set that equal to hour but that clears hour to just the lower byte and blows away the upper byte. hmmmm
 
Figured it out. I just add what's in the EEDATA register and what's already in hour after I read the least significant byte. Works great now :)
 
Thx.

I checked out your webpage. you got some pretty cool projects up there. Do you do everything in assembly?
 
Yes, I do love my op codes ever so much! I've learned C and Java at school and C# on my own as well as assembly. Assembly is what I started with, but I love it's simplicity and it's always a challenge so I always code with it :)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top