MATLAB Answers

Deepak
0

Automotive problem - Counting and saving

Asked by Deepak
on 26 Nov 2015
Latest activity Answered by Torsten Knodt on 9 Sep 2016
Hi Everyone,
Back Ground: Currently working on a project, the goal is to control an automotive roof with state flow. As state flow allows for the use of simulink and matlab functions it can be very useful.
Before the roof can run its normal program it must initialise, this state allows for the counting of the steps to determine the size of the roof. The signals for the counting are provided by the hall sensor. The counting blocks have already been made, the counts however must be saved in the EEPROM.
Problem: Every time the subsystems counts, a value is written to the EEPROM. It is widely known the writing to an EEPROM must be limited. in this situation. 10 total counts equals to 10 x writing in the EEPROM.
Goal: I need to save the final value. Say i have 65 counts, I need to save the number 65 in the EEPROM and not 1,2,3,4,5...64, and finally overwrite all of those values with 65. I tried delays, and several array blocks but can't get it too work. Any ideas?

  0 Comments

Sign in to comment.

1 Answer

Answer by Torsten Knodt on 9 Sep 2016

This depends on your interface to write to the EEPROM. Normally you would count in your RAM and trigger writing to the EEPROM in a final state. If you have no final state, you could introduce one which is activated based on a counting timeout. Keep in mind that EEPROMs are organized in blocks. The block with this variable could contain also other data. Usually it makes more sense to coordinate writing back values to EEPROM with other software components or writing them back e.g. before power loss. Also you should have backup blocks for the case you loose power during erasing or writing the EEPROM block. To my knowledge this is often done in the OS.

  0 Comments

Sign in to comment.