??? 07/17/09 07:40 Read: times |
#167463 - Keypad interface problem: My code not working.. |
Hello...
Am interfacing the matrix keypad 4 * 4 to 8052, i have to taken three ports two ports for row n col and last one to display in seven segment but am not getting any thing on seven segment and i checked the signal at the Last port ( i.e one which has given to seven seg ) but there is no signal coming..i don't know wats wrong in my code..plz see my code and tel me wat r my mistakes.. ****************************************************************************************** This is my code : ****************************************************************************************** # include <reg51.h> # include <stdio.h> # define ROW P1 # define COL P2 # define SEVEN_SEG P3 char keypad [4][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; char seven_seg [ ] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x69, 0x6f, 0x79, 0x63, 0xc7, 0x77, 0x63 }; void main ( ) { char temp, row, col, count; ROW = 0x0F; COL = 0x00; SEVEN_SEG = 0x00; while ( 1 ) { COL = 0x0F; ROW = 0x00; while ( !( ROW & 0x0F ) ); for ( temp = 0x01, count = 0; temp <= 0x08; temp <<= 1, count++ ) if ( temp & ROW ) { row = count ; break; } /*for ( temp = 0x01, count = 0; count < 4; temp <<=1, count++ ) if ( temp & COL ) { col = count; break; } */ for ( COL = 0x01, temp = 0x01, col = count = 0; temp <= 0x08; COL = (temp <<= 1), count++ ) if ( row & ROW ) { col = count; break; } temp = keypad [row][col]; SEVEN_SEG = seven_seg [temp]; } } |
Topic | Author | Date |
Keypad interface problem: My code not working.. | 01/01/70 00:00 | |
Check in a simulator | 01/01/70 00:00 | |
RE: | 01/01/70 00:00 | |
Care for details | 01/01/70 00:00 | |
Formatted code | 01/01/70 00:00 | |
RE: i dint check the bounce | 01/01/70 00:00 | |
Bounce vital to think about | 01/01/70 00:00 | |
Do document | 01/01/70 00:00 | |
re: documentation prob | 01/01/70 00:00 | |
Fixing prob: | 01/01/70 00:00 | |
Did you search? | 01/01/70 00:00 | |
RE: the search tool here is not the most powerful | 01/01/70 00:00 | |
Karas's Keypad Scanner Code In C - detabbed | 01/01/70 00:00 | |
Properly documented code | 01/01/70 00:00 | |
Reasons and assumptions | 01/01/70 00:00 | |
Per, you implied, but did not say | 01/01/70 00:00 | |
dangerous loops | 01/01/70 00:00 | |
code??? | 01/01/70 00:00 | |
RE: now am modified my code | 01/01/70 00:00 | |
How to post legible source code | 01/01/70 00:00 | |
unfortunately, that does not add comments | 01/01/70 00:00 | |
re: thanks now i got how to insert code | 01/01/70 00:00 | |
Scanning Keypad | 01/01/70 00:00 | |
How to scan Keypad![]() | 01/01/70 00:00 |