News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

EEPROM inquiry

Started by JackB, May 01, 2026, 03:39 PM

Previous topic - Next topic

JackB

Quote from: trastikata on May 02, 2026, 10:16 PMHi JackB,

Plese let us know if the latest procedure modification helped to solve your question.

The modification seem to work fine as for reading and saving.

Thanks Trastikata, JonW


JackB

Good thinking

the only time the uC has to register and save the parameters are during calibration procedure and this is done
only when the sensor is installed or when the equipment is moved or a defective stepper motor is replace.

the time the metal detection is in effect it's only to stop the stepper motors, it does not use the calibration during normal operation



JackB

I will certaintly use this code.

many thanks Trastikata, and JonW


JonW

Jack, this is the same as we did, cal stored at the factory, so the 10F can definitely do this and there should be plenty of code space in the MCU.  One thing we added was a second store and check, just in case the cal value was corrupted in EEPROM.  Once you have the code completed, if you have space, it's prudent to have a couple of E2 locations on different erase pages as a backup. Although we built over 200k products with the 10F and have never had an issue, even after extensive ALT testing.

JackB

Hello Jon, nice of you to share your experiences about this topic, mainly I started this project for my own CNC
and of course in the past years I have purchased proximity sensor from chinese company as the common SN-04 and some of theses fail after 6 months or so, due to magnetic noise from the spindle unsheilded AC power supply.
then I decided to upgrade with an sheilded DC supply, since that time 2 years ago none of the remaining SN-04 failed.

In that process I was curious about making my own with what I had on hand and sure enough I had to learn and build inductor coil and all the rest.

In the process of making the sensor I decided to add more functionality as 'on the spot' calibration and keeping a low PCB foot print this is where the PIC10F322 came handy, otherwise I had a backup plan with an 12F1840 that have EEPROM, but with a larger foot print.

Good day until next time.













JonW

Nice, so you can add in a feature that locks the senso when no cal or e2 corruption to stop the cnc crashing.

JackB

#26
You're right !

the calibration switch is there only for test purpose and will be remove, instead the calibration will be done when a metal probe is against the sensor and the power is turn on at that point the OSC frequency is at the lowest.

After the calibration is done, the normal operation consist of 3 main state zones where the OSC frequency is higher than the 'CAL'.
at normal operation when the uC is turn on, a delay is place in the code that let the OSC time to reach the IDLE frequency to be stable.
the trigger 'ON', release 'OFF' and the idle zone.