Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem "persist" arduino mega #82

Closed
lucianod6 opened this issue May 8, 2018 · 2 comments
Closed

problem "persist" arduino mega #82

lucianod6 opened this issue May 8, 2018 · 2 comments

Comments

@lucianod6
Copy link

I have been programming PLC for over 20 years and I can say that LDmicro is
a program at the highest professional level, really fantastic!
i using arduino mega 2560 ..I want to report the following problem :
Persist does not work ..I have identified the problem , the generate code from ldmicro is:
if(Read_Ib_rung_top()) {
if(!Read_Ib_once_4_PERSIST_variabile_sp_minuti()) {
Write_Ib_scratch(0);
Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Write_Ib_once_4_PERSIST_variabile_sp_minuti(1);
Ui_variabile_sp_minuti = EEPROM_read(0) + (EEPROM_read(1) << 8);
}
} else {
Write_Ib_scratch(0);
Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Ii_tmpVar24bit = EEPROM_read(0) + (EEPROM_read(1) << 8);
if(Ii_tmpVar24bit == Ui_variabile_sp_minuti) {
} else {
EEPROM_write(0, Ui_variabile_sp_minuti & 0xFF);
EEPROM_write(1, Ui_variabile_sp_minuti >> 8);
}
}
}
}
it does not work

I modified it as follows
if(Read_Ib_rung_top()) {
if(!Read_Ib_once_4_PERSIST_variabile_sp_minuti()) {
Write_Ib_scratch(0);
// Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Write_Ib_once_4_PERSIST_variabile_sp_minuti(1);
Ui_variabile_sp_minuti = EEPROM_read(0) + (EEPROM_read(1) << 8);
}
} else {
Write_Ib_scratch(0);
// Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Ii_tmpVar24bit = EEPROM_read(0) + (EEPROM_read(1) << 8);
if(Ii_tmpVar24bit == Ui_variabile_sp_minuti) {
} else {
EEPROM_write(0, Ui_variabile_sp_minuti & 0xFF);
EEPROM_write(1, Ui_variabile_sp_minuti >> 8);
}
}
}
}
it works properly
Release 4.3.9.0

ghost pushed a commit that referenced this issue May 11, 2018
@ghost
Copy link

ghost commented May 11, 2018

Fixed in 4.3.9.2

@ghost ghost closed this as completed May 11, 2018
@ghost
Copy link

ghost commented May 12, 2018

Please test with release 4.3.9.2 and reopen the issue if it is not fixed.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant