|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
digital inputs not valid just after initialization?
I found that after running the initialization code some digital inputs have the wrong value for a short time (few tenths of a millisecond). In our case this caused a problem because one of the digital inputs was a trigger to store calibration data in EEPROM. Storing calibration data when not in the correct state was a problem.
I had set up pins 8, 10, 12, 14, 16 as digital inputs. There are supposed to be built-in pull-up resistors so these should read "1" with nothing connected. But in fact 8 and 10 are "1" and 12, 14, 16 are "0" for the first loop of the processing. Anyway, I found that putting a small delay in the initialization code solves the problem. You can't put a big delay or you get a blinking red "PROGRAM STATE" light and nothing works. I used a little spin loop and tried different values. The value below (5000) is more than the minimum needed and much less than what causes the red light, so maybe is safe. // allow digital inputs to settle after POR { long spin; for(spin=5000; spin>0; spin--); } Anybody have similar experience or know a more "elegant" fix? Bill |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Whacky C Complier behavior | Larry Barello | Programming | 12 | 26-01-2004 22:15 |
| Plez help me | Wacko324 | Control System | 8 | 26-01-2004 20:24 |
| How to access other Digital inputs on OI? | DougHogg | Electrical | 2 | 12-03-2003 13:57 |
| Serial Port and Custom Circuit | Ryan Meador | Programming | 40 | 06-02-2003 11:34 |
| Digital inputs, bandwith, errors? | Micah Brodsky | Programming | 7 | 20-01-2003 16:08 |