I don't think you have compiled this code because there are some errors. I have removed some errorsLike this should work
C:
#include <reg51.h>
#include <stdio.h>
sbit row1port = P1^0;
sbit row2port = P1^1;
sbit row3port = P1^2;
sbit row4port = P1^3;
sbit col1port = P1^4;
sbit col2port = P1^5;
sbit col3port = P1^6;
sbit col4port = P1^7; // a 4x4 keypad is used
char const keyPadMatrix[] =
{
'1','2','3','4',
'5','6','7','8',
'9','0','A','B',
'C','D','E','F',
0xFF
};
void ScanKeyMatrixInit()
{
// we scan the keypad by turning on the row outputs and
// reading the columns
row1port = 0;
row2port = 0;
row3port = 0;
row4port = 0;
col1port = 1;
col2port = 1;
col3port = 1;
col4port = 1;
}
char ScanKeyMatrix()
{
// This routine returns the first key found to be
// pressed during the scan.
char key = 0, row;
for( row = 0b00000001; row < 0b00010000; row <<= 1 )
{
{ // turn on row output
row1port = (row & 0x0001)>>0;
row2port = (row & 0x0002)>>1;
row3port = (row & 0x0004)>>2;
row4port = (row & 0x0008)>>3;
__delay_ms(1);
}
// read colums - break when key press detected
if( col1port )
break;
key++;
if( col2port )
break;
key++;
if( col3port )
break;
key++;
if( col4port )
break;
key++;
}
row1port = 0;
row2port = 0;
row3port = 0;
row4port = 0;
return keyPadMatrix[ key ];
}
code.c(38): error C251: illegal octal digit
code.c(38): error C251: illegal octal digit
code.c - 2 Error(s), 0 Warning(s).