![]() | ![]() | ![]() |
| | #31 |
|
Haven't looked at the menu code, but aren't the diodes backwards in the schematic. Ra6 wouldn't be able to tell which button is pushed, unless it's analog input with associated button resistors or'd together.
Last edited by nickelflippr; 27th September 2009 at 05:23 PM. | |
| |
| | #32 |
|
Try changing the diodes for 10k resistors. Got to go to bed now but let me know how it goes. Mike. | |
| |
| | #33 |
|
ok sure will..
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #34 |
|
Tried this and no good. I wish i understood your method heh From what i can see... you are using a XOR to check the PORTB bits. I assume you are using this to check the current value and test it against a users press. How do you know when a user presses a button. What happens when the user holds the button down then it will create a flag with the same bits to XOR and you will get no result. I dont know lol can someone explain the way it works or supposed to in this case (my Proteus side)
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 27th September 2009 at 05:44 PM. | |
| |
| | #35 |
|
I have to go to bed now, 2:45AM here. We'll pick this up tomorrow. Thanks for your patience. Mike. | |
| |
| | #36 |
|
Ok no problem. Ill see ya tommorrow heh
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #37 |
|
heh just though id post a AVI of a UART MENU i made as a test... http://atomsofttech.info/code/UartMenu.avi Its best to RIGHT CLICK the link and save the video then view it
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 28th September 2009 at 12:43 AM. | |
| |
| | #38 |
|
I must have been tired last night. Changing the resistors to 10k was silly, they should be 1k. I see what you mean now about leaving A6 as output. I've changed the code and commented it. Code: #define KeyEn porta.6
#define KeyEnTris trisa.6
#define KeyTris trisb
#define KeyDelay 30
#define KeyRepeat 10
#define key_none 0
#define key_back 1
#define key_up 2
#define key_dw 3
#define key_enter 4
unsigned char keys=0,previous,edges,KeyCount;
char ReadKeyPad(){
char i;
previous=keys; //keep copy of previous state
option_reg.7=0; //WPUs on
KeyTris|=0x3c; //B2-B6 input
KeyEnTris=0; //A6 output
KeyEn=0; //and low
delay_us(10); //see text below
keys=(portb>>2)&0x0f; //read keys
keys^=0x0f; //invert them so 1=pressed
KeyEnTris=1; //switch en back to input
KeyTris&=0xc3; //switch b2-b6 back to output
if(keys==0) //if no key pressed
return(0); //return zero
//now do key repeat and delay stuff
//keys xor previous gives us a 1 if a key has changed
//ANDing this value with the new keys pressed gives
//keys that were 0 last time and 1 now = new presses
if(((keys^previous)&keys)==0){ //if no new presses
//must be repeating key
if(--KeyCount!=0) //decrement key count and
return(0); //return zero as time not up
KeyCount=KeyRepeat; //reset key timer
}else{
//must be new key press
KeyCount=KeyDelay; //set initial delay
edges=((keys^previous)&keys);//see above
}
i=0;
while((edges&(1<<i))==0){ //change bit pattern into 1 to 3
i++;
}
return (++i); //and return it
}
edit, maybe Proteus is taking pin capacitance into account. Try adding the line in red to see if it fixes it. Mike. Last edited by Pommie; 28th September 2009 at 04:24 AM. | |
| |
| | #39 |
|
no luck. The lines are all high but getting a 0x00 in keys. how about moving the resistors to the LCD lines instead of buttons?
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #40 |
|
Yes it works with it on LCD lines!! nice menu dude! ill record it now
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #41 |
|
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #42 |
|
Thanks Jason, The video looks good. I may have to buy a copy of Proteus. It looks really useful. I guess you can remove the resistors all together. However, on the actual hardware the diodes or 1K resistors are needed (in the original position) otherwise, when two buttons are pressed at the same time it shorts two of the LCD data lines. Not good. Mike. | |
| |
| | #43 | |
| Quote:
The way the keys are read is by pulling A6 low and reading the data pins therefore reading them all at once. Mike. | ||
| |
| | #44 |
|
Mike quick fix for me would be to use RB0:RB4 for Buttons and RB5:RB7 for LCD. i would just have to use diodes or resistor for RB6-7 or better yet use a Shift register with Latch 595 perhaps, since you wanted to save all INTx and ANx
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 28th September 2009 at 02:10 PM. | |
| |
| | #45 |
|
I did it the way it is to use the minimum number of pins and keep as much of the other hardware free. Don't know why it didn't work on the simulator. Anyway, next step is to get some kinda boost converter working. Guess I should post a thread in the general section and see if one of the analogue guys can help. Mike. | |
| |
|
| Tags |
| based, charge, controller, pic |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Pic Based Servo Controller and Free Control Software! | hvlabsdotcom | Robotics Chat | 12 | 27th December 2008 07:10 PM |
| PIC based PID controller | Shohadawy | Micro Controllers | 1 | 24th September 2008 09:59 AM |
| Really Simple PIC Based IR (InfraRed) Controller | deanbayley | Electronic Projects Design/Ideas/Reviews | 1 | 12th November 2007 03:00 PM |
| PIC based Intelligent Garden Light Controller | dragonaga | Electronic Projects Design/Ideas/Reviews | 6 | 28th September 2005 10:28 AM |
| Project needed, Stepper motor controller PIC based | lompa | Electronic Projects Design/Ideas/Reviews | 1 | 11th October 2004 07:57 PM |