Author |
Message |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Thu Apr 05, 2012 6:50 am Subject: Debounce routine not working |
A lot to think about...That is some great stuff for me consider. With a lot of hard work and dedication to this stuff, I will eventually understand and appreciate everything you wrote.
I will kee ... |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Wed Apr 04, 2012 7:46 am Subject: Debounce routine not working |
I have a very bouncy switch. It is homeade and literally has a ball within a cage that has 6 possible positions to be in. I need to debounce each of those positions. When the ball is in position, an ... |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Wed Apr 04, 2012 6:56 am Subject: Debounce routine not working |
Okay, Great...I get it...So no wonder it isn't working...So it would just start "scanfaces" again and go back to the "keypress" function. Just a big loop.
Maybe I should have the ... |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Wed Apr 04, 2012 6:32 am Subject: Debounce routine not working |
It still doesn't work. I am concerned it may be due to how I think the "break;" will perform. Will it break to where I think?
void wait_for_keypress_1(void)
{
char count=0;
... |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Tue Apr 03, 2012 10:52 pm Subject: Debounce routine not working |
I appreciate the advice.
I have my debounce to where I think it really should be working but it isn't.
Does anyone have any thoughts or suggestions. The following is an excerpt from my code.
... |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Sun Apr 01, 2012 6:49 am Subject: Debounce routine not working |
I can't believe I forgot my exclamation mark
"if(!input(pin_B2)==1)"
I know the code is probably needlessly complex. I don't know enough to make it simple. I figured I didn't need the ... |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Sat Mar 31, 2012 9:04 pm Subject: Debounce routine not working |
You are absolutely correct. I copied the wrong code out. The following is what I use and does in fact compile with no errors. I added a bitset to it.
int8 wait_for_keypress_1(void)
... |
Topic: Debounce routine not working |
rems
Replies: 14
Views: 18235
|
Forum: General CCS C Discussion Posted: Sat Mar 31, 2012 7:54 pm Subject: Debounce routine not working |
PIC16F887 //EDIT--The code I am trying is actually in the 3rd post. The following will not return a value as it is marked as "void" my mistake
I have a very bouncy switch in dire need of d ... |
Topic: State machine problem |
rems
Replies: 27
Views: 23215
|
Forum: General CCS C Discussion Posted: Thu Mar 29, 2012 10:47 am Subject: State machine problem |
That's great..everything has been a great help |
Topic: State machine problem |
rems
Replies: 27
Views: 23215
|
Forum: General CCS C Discussion Posted: Thu Mar 29, 2012 10:33 am Subject: State machine problem |
I appreciate all the suggestions and insight. I am now trying to do something with all his information.
Thanks to both of you |
Topic: State machine problem |
rems
Replies: 27
Views: 23215
|
Forum: General CCS C Discussion Posted: Thu Mar 29, 2012 9:20 am Subject: State machine problem |
I am having trouble understanding one part of the function
#use fast_io(b)
int8 scanfaces(void) {
int8 port_val;
//Used so I/O operations don't change other pins.
... |
Topic: State machine problem |
rems
Replies: 27
Views: 23215
|
Forum: General CCS C Discussion Posted: Thu Mar 29, 2012 6:57 am Subject: State machine problem |
I see the beauty in this line " port_val=(input_b()>>1)|0b11111000;"
setting port_val to = whatever port b is = to.
port b will = what ever button is pressed because the ">&g ... |
Topic: State machine problem |
rems
Replies: 27
Views: 23215
|
Forum: General CCS C Discussion Posted: Wed Mar 28, 2012 3:46 pm Subject: State machine problem |
OK.
Tell us what the six connection patterns are. Call the 4 connections A,B,C,D. Then for the six positions tell us what combinations are connected.
A nice little table....
Realistically it sounds ... |
Topic: State machine problem |
rems
Replies: 27
Views: 23215
|
Forum: General CCS C Discussion Posted: Wed Mar 28, 2012 10:46 am Subject: State machine problem |
Here's what I think the schematic should be:
http://dl.dropbox.com/u/28291527/sws.jpg
First you would set all 4 outputs low, with the TRIS bits set high (pins hi-Z) and the pullups turned on.
... |
Topic: State machine problem |
rems
Replies: 27
Views: 23215
|
Forum: General CCS C Discussion Posted: Wed Mar 28, 2012 9:51 am Subject: State machine problem |
This is where {} brackets come in.
Everything inside a pair of these, is (logically) treated as a single statement. So:
if (fred)
this;
that;
//executes 'this' if fred is true, b ... |
|