|
|
View previous topic :: View next topic |
Author |
Message |
jo Guest
|
intermittent connection |
Posted: Fri Jun 17, 2005 12:58 am |
|
|
hi,
i have 2 cct namely A and B. when A touches B thru a connector, A will power up B and B will start talking to A...
The touching part is like inserting a key into a lock and turning it, then terminate by pulling out. [est time A will be on contact with B ~ 4s ]
But the problem lies in that after the first initial 'talking' has complete, more 'talking' will be carried out again and again due to the 'turning' of the key which result in (i believe) many connect & disconnect.
My current solution is to delay ~5s after first 'talking' finishes so no other 'talking' can take place within that est 4sec of turning.
Is there any better solution than to plainly wait?? |
|
|
jo Guest
|
hmm |
Posted: Sun Jun 19, 2005 10:12 pm |
|
|
hmmm... they is no reply yet..
think is my language and phrasing problem...
basically, when two cct connects, there is a lot of on/off contact going on and all this trigger more than one action. What can i do?
currently, a waitout is implemented. |
|
|
bfemmel
Joined: 18 Jul 2004 Posts: 40 Location: San Carlos, CA.
|
|
Posted: Mon Jun 20, 2005 3:34 pm |
|
|
jo,
You have had, up to now, 75 reads of your problem according to the counter on the front page. I guess most of the problem is that we still don't know too much about the circuit and the problem. I'll make a few guesses but maybe you could explain the situation a little further.
Some questions I have are:
1) Does A actually provide the power to run B or does B have it's own power source and are we just looking a pin toggling?
2) If A does power B can I assume that B at least remains powered during the time that the "Key" is in the lock and if so that the power to B is not intermittant.
3) How do you know that communications are complete? Is it a set number of bytes or is there an acknowledgement sent back?
4) And I might be a little dense but I am not familiar with a cct? What does that stand for please?
If the power is actually applied to B then the problem is simple, set a variable on program entry to TRUE and clear it when you finish the communication. After that, you can let the PIC go to sleep or you can sit in a while loop if you have other things to do. You will need to insure adequate filtering on the power line to keep the B PIC powered up during the contact time. Look at the pseudo code below.
Code: | void main( void ) {
int1 needToTalk = TRUE; // Initialize talk variable to one
while(needToTalk) {
// handle all communications stuff
if (lastByteSent) needToTalk = FALSE;
}
while(TRUE);
} |
If B already has power but is looking at a pin toggling then the situation is just a little different. Set the needToTalk variable on seeing the pin change. Then when the pin contact is lost start a timer to record how long the interruption is taking. If it is over some minium time then reset your variable to TRUE and wait for the pin to toggle again.
I am sure all this sounds like a lot of rambling and that is the problem with your original post, no one knew what to say to you.
Good Luck,
Bruce |
|
|
Guest
|
|
Posted: Tue Jul 05, 2005 6:59 pm |
|
|
i guess your mechanical switch needs to be debounced |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|