Go to Post This reminds me a lot of how millennials are regularly called out for simply being younger and having different perspectives. In the end it's the ones who are calling them out in unprofessional in ways that end up embarrassing themselves and looking uninformed. - Karthik [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-01-2004, 12:50
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
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
  #2   Spotlight this post!  
Unread 26-01-2004, 13:07
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: digital inputs not valid just after initialization?

I ran into the same problem.
I handled it a little differently in that rather than delay everything I ignore the inputs for a number of clock ticks after initialization.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 26-01-2004, 13:21
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
Re: digital inputs not valid just after initialization?

Quote:
Originally Posted by Mark McLeod
I ran into the same problem.
I handled it a little differently in that rather than delay everything I ignore the inputs for a number of clock ticks after initialization.
Glad to have confirmation, thanks.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 01:27.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi