1wire eeprom (DS2431), mega8 and bascom

Status
Not open for further replies.

wing23

Newbie level 2
Joined
Jan 4, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,306
Hey all

I'm no engineer but I have to find a solution for my problem.
I tried to study the DS2431 datasheet to no satisfaction, I googled a lot, now I'm here hoping to find someone who could help me out for a min.

The problem shouldn't be too hard IMO, I bet it's something that could be done in less than 5 min.


I'm making a circuit that checks if a lamp is working/alive by measuring the current that its electronic ballast draws.
This part works already (current sense hall element, several opamps, finally fed into the ADC of a mega8).

Now I have to make a runtime hours counter by increasing a value that resembles minutes. After 8000 hrs a LED should light up.
I'm already this far that I use timer1 to increase a value and after 5 minutes (to save eeprom write cycles) I want to write it into a 1wire eeprom, a DS2431

now my 1st question is (and I googled a lot and somehow didn't find anything): if I use the ADC (I need 2 ADC ports), can I connect the 1wire eeprom to an unused ADC port without problems?

the 2nd problem I have is: I want to read and write the runtime counter's value into the eeprom.
I read the datasheet and googled a lot again, but I only found hints to read out ds18b20 temp. sensors.

I use bascom to make the code.
Would it be possible for you to write me 2 routines for reading the eeprom value (as on startup) and for writing it to the eeprom (like every 5 min)?
I only need the code for read and write!

additional info and ideas:
in the code I use these commands already:
config ADC = single (etc)
config timer1 = timer, Prescale = 256 , Compare A = Disconnect , Clear Timer = 1
Enable Compare1a
Enable Interrupts

I write this since I'm not sure what other ports I could use, because interrupts and compare ports are enabled and I also have to connect 4 LEDS and a switch
There's not that much room left for alternatives ...

another idea I had (depending on how easy this could be done): the eeprom should contain a branding string, for example "wing23".
on startup it reads the string at address x and compares.
If it finds "wing23" in the eeprom it continues to read the stored timer value at address y and if the lamps are alight, it starts increasing the just read value and every 5 min it stores it back into the eeprom.
Shouldn't be too hard, I guess D:


Thanks a lot for your help and time
Nik
 

there's nobody who could give me some hints? D:
 

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…