Black & Decker RC880 Manuel d'utilisateur Page 22

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 49
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 21
Persistent Data
So you don't have to hard-code the tuning parameters or enter them every time you use the
controller, we save them in the Arduino's EEPROM. This makes the code a little more elegant
as you can program the controller once, then re-tune if you ever change cookers but
whenever you turn on your controller, it will remember the settings from the last time you
used it.
SInce EEPROM can only be written a finite number of times (typically 100,000), we compare
the contents before writing and only write if something has changed. This functionality is
implemented in the following helper functions:
// ************************************************
// Save any parameter changes to EEPROM
// ************************************************
void SaveParameters()
{
if (Setpoint != EEPROM_readDouble(SpAddress))
{
EEPROM_writeDouble(SpAddress, Setpoint);
}
if (Kp != EEPROM_readDouble(KpAddress))
{
EEPROM_writeDouble(KpAddress, Kp);
}
if (Ki != EEPROM_readDouble(KiAddress))
{
EEPROM_writeDouble(KiAddress, Ki);
}
if (Kd != EEPROM_readDouble(KdAddress))
{
EEPROM_writeDouble(KdAddress, Kd);
}
}
// ************************************************
// Load parameters from EEPROM
// ************************************************
void LoadParameters()
{
// Load from EEPROM
Setpoint = EEPROM_readDouble(SpAddress);
Kp = EEPROM_readDouble(KpAddress);
Ki = EEPROM_readDouble(KiAddress);
Kd = EEPROM_readDouble(KdAddress);
// Use defaults if EEPROM values are invalid
if (isnan(Setpoint))
{
Setpoint = 60;
}
if (isnan(Kp))
© Adafruit Industries
https://learn.adafruit.com/sous-vide-powered-by-arduino-the-sous-
viduino
Page 22 of 49
Vue de la page 21
1 2 ... 17 18 19 20 21 22 23 24 25 26 27 ... 48 49

Commentaires sur ces manuels

Pas de commentaire