Page 1 of 2

EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 3:14 am
by ELECTRONICA67
Hello, I would appreciate some help;

I have had some free time and I have been playing with Flowcode 10 and its components, which I see have added features that they did not have in previous versions, some features such as the 16x2 display, EEPROM, which added writing and reading in float, long, INT I made a small flowchart that reads a FLOAT number and then writes it to the EEPROM memory and reads it when required; add 2 switches, one reads a number with 6 decimal places and the second switch reads another number with 6 decimal places also but negative; I have a GPS that I want to improve and record locations at different times, to later check the places visited, but after recording the numbers in the EEPROM to later read them, one reads the recorded number, but the second changes to a different number; I send the flowchart. I would appreciate if you can see it and help me; I assume that using variables in FLOAT the number is read directly and with that same variable it is recorded in the EEPROM, I looked for an example, but in FLOAT I found nothing.

I appreciate any help in advance.

Enrique
Thanks

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 7:48 am
by chipfryer27
Hi

I can only run in simulation, and after storing variables Lat / Long in EEPROM I set them to zero before reading back to check what was being returned.

Simulation debugger displayed as expected.

When switch A0 is active the Lat is displayed at position 0/1 of your display. When switch A1 is active Long is displayed at position 0/1 of your display thereby overwriting the previously displayed Lat value.

Perhaps change the position of Lat to 0/0 ?

Regards

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 4:51 pm
by ELECTRONICA67
Hello Chipfryer27,

in the simulation it also sends numbers different from those recorded in the EEPROM, it sends images of the numbers recorded in the EEPROM and later read; The number recorded in address 0 changed the value when it was read, the number recorded in address 1 remained the same.

Enrique

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 4:52 pm
by ELECTRONICA67
imagen

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 5:28 pm
by chipfryer27
Hi

Hmm.... Using a different machine I'm now getting the same results as you. I may have not noticed it earlier though........

Everything is fine until you read from eeprom in your branch (if Inicio = 1).

I'll see what I get in hardware when I get a chance.

Regards

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 6:32 pm
by medelec35
Hello.
You will need to remember that a float is 4 bytes.
If each address of EEPROM can only hold a byte, then you need to allow 4 addresses for each float variable.
It seems like you are corrupting EEPROM addresses reserved for LAT with values of LONG

Try setting LAT to address 0 and LONG to Address 4

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 6:37 pm
by ELECTRONICA67
Hi,

Yesterday I did that test, I recorded at address 0, 3, 7, 11; But it does not work

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 6:39 pm
by medelec35
Try again 0, 4 etc not 0, 3

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 6:43 pm
by ELECTRONICA67
Hi Martin,

Maybe I'm missing one more direction; 0, 4, 8, 12... . I will do another test with those addresses; A problem that continues to persist is that the GPS takes too long to connect to a satellite; Now I have had it connected for 1 hour and 40 minutes and it still cannot connect.

Re: EEPROM_FLOAT PIC16F1939

Posted: Sun Mar 24, 2024 6:46 pm
by ELECTRONICA67
I'm just waiting for the GPS to connect so it can show me the coordinates and do the tests. Flowchart shipping.