I'm seeing some strange behaviour with my EEPROM variable - the first time the chip is powered up it seems like the linked variable isn't being set to the default as in this code:
Code:
MotorRPM VAR BYTE : @ EE_var _MotorRPM, BYTE, 150
I know this because this loop is meant to spin up two motors connected to CCP1 & CCP2 on a PIC16F1825; rather than increase the duty to the mid-range RPM as in the default (150), it spins up to the max (255):
[CODE
IF MotorRPM > 66 THEN
FOR I = 65 to MotorRPM
pause 30
HPWM 1, I, 20000 ' Stbd engine (CCP1)
HPWM 2, I, 20000 ' Port engine (CCP2)
NEXT I
EndIf
[/CODE]
This only happens the first time the chip is powered up after re-programming. If I unplug the breadboard power and turn it back on again, the motors spin up to the expected default.
Full code attached. Any ideas? Should I put an EE_READ in even though it shouldn't be needed?
Nacelle_Motors_16F1825_32Mhz_Int_SN754410.txt
Bookmarks