Hi all,
I have built a stepper motor contoller using 16F628. It worked fine for last few months until I decided to change from the internal oscilator to a 20Mhz external. My problem is that the pic is not properly initialized on startup. MCLR is pulled up using a 10k resistor and a momentary switch connects it to ground and allows me to perform a reset. If I press the button, then the pic is properly initialized and works as it is supposed to work. If I just power on my board and dont press the push button to reset, then there is a 50% chance that i will not work as expected. Basically I have tied some dip switches to the pic pins (properly pulled down to gnd) but unless I press the reset button, the μc half of the time reads wrong values (0 when it should be 1).
This only happens on 20Mhz. If i switch to 4Mhz there is no problem at all.
Any suggestions?
These are my configuration bits : __config _HS_OSC & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BOREN_ON & _BODEN_OFF & _MCLRE_ON
I have built a stepper motor contoller using 16F628. It worked fine for last few months until I decided to change from the internal oscilator to a 20Mhz external. My problem is that the pic is not properly initialized on startup. MCLR is pulled up using a 10k resistor and a momentary switch connects it to ground and allows me to perform a reset. If I press the button, then the pic is properly initialized and works as it is supposed to work. If I just power on my board and dont press the push button to reset, then there is a 50% chance that i will not work as expected. Basically I have tied some dip switches to the pic pins (properly pulled down to gnd) but unless I press the reset button, the μc half of the time reads wrong values (0 when it should be 1).
This only happens on 20Mhz. If i switch to 4Mhz there is no problem at all.
Any suggestions?
These are my configuration bits : __config _HS_OSC & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BOREN_ON & _BODEN_OFF & _MCLRE_ON