That would be a start even if it don't work it will help to see what you want to do pressing “2” Increasing brightness pressing 8 decreasing brightness
That would be a start even if it don't work it will help to see what you want to do pressing “2” Increasing brightness pressing 8 decreasing brightness
Last edited by be80be; 11th March 2009 at 03:42 AM.
Burt
Also do I need this part of the code since the telephone keypad has no letter buttons
Can I remove that?Code:RETLW 0x43 ;C RETLW 0x44 ;D RETLW 0x45 ;E RETLW 0x46 ;F
Last edited by Mr.K; 11th March 2009 at 03:47 AM.
You can don't need it if your going to use a telephone keypad
Burt
Firstly you have create a sub-routine called Keyscan that looks at all the keys and if it finds a ket, the key value is placed in a file such as 22h and a flag is set that says a key has been pressed. This flag is looked at the beginning of the scan routine. The next time the scan routine is run (only a few milliseconds later) it is looking for NO KEY pressed.
This is called debounce.
No resistors are needed on the keypad, just turn on the internal 47k pull-up resistors.
Then create an answer for the keyboard. You can simply increment a register (50 bytes of program at least) while you are scanning or do some fancy Boolean work (about 11 bytes of program).
I prefer to do simple things as I am a teacher and students will get completely lost unless it is absolutely understandable. Output a register that has been incremented and this will identify each key.
That's the KeyScan finished. More needed later.
Last edited by colin55; 11th March 2009 at 06:25 AM.
Wouldn't that be this partCode:;Keypad subroutines Chk_Keys movlw 0x00 ;wait until no key pressed movwf KEY_PORT ;set all output pins low movf KEY_PORT, W andlw 0x0F ;mask off high byte sublw 0x0F btfsc STATUS, Z ;test if any key pressed goto Keys ;if none, read keys call Delay20 goto Chk_Keys ;else try again Keys call Scan_Keys movlw 0x10 ;check for no key pressed subwf key, w btfss STATUS, Z goto Key_Found call Delay20 goto Keys
Burt
Producing vague code like that above is all "very well". But you need to have the cirucit diagram with the pins identified and the registers allocated, to be able to produce real instructions. You don't really need any delays as the "flags" create the debounce.
The sub-routine must be called on a regular basis and take up no time. You must also work out how you are going to generate a key value. Obviously input a byte and check three of four bits for a value. After each bit is checked, a register is incremented.
I can't do any more until the circuit is generated.
Last edited by colin55; 11th March 2009 at 06:05 PM.
colin55I think you missed this part http://www.electro-tech-online.com/a...ads-dimmer.pngI can't do any more until the circuit is generated.
Last edited by be80be; 11th March 2009 at 09:13 PM.
Burt
Identify the switches. Add a 10th sw. Remove the resistors. Allocate files.
colins55 You have a good website I liked all the circuit's you have on it
Burt
Now I know Bill and and I know you can short the output when scanning more them 1 button at a time . It is to easy to turn off a pullups. So she will stay as is.Put some pullups on a keyboard row. Keeps you from shorting outputs when you're scanning and someone presses more than one button at a time.
__________________
Bill
Smart Kits build Smart People
blueroomelectronics - Smart Kits Build Smart People
Burt
How does a short occur when you are scanning? You must be scanning incorrectly.
All that happens when 2 keys are pressed is this: The program picks up the first key in the sequence.
Are you having a bad day or what. You just said don't use pullups. Set the pins to useThen you sayinternal 47k pull-up resistorsnow it is a lot easier to use a pullups then to turn it on internally.I am a teacher and students will get completely lost unless it is absolutely understandable
Burt
I meant external pull-ups.
I posted the wrong 1 here the right 1 I didn't put pullups in it at first and when I posted it here what you need to go with but I still need to added 1 more row of keys.
Last edited by be80be; 11th March 2009 at 09:50 PM.
Burt