C language Keypad 8051F330

Status
Not open for further replies.

Qrios

Newbie level 6
Joined
May 3, 2012
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,356
I am trying to write a C language program where I can receive a 5 bits signal ( 1 enable and 4 input bits from keypad encoder ). Due to my weak foundation in C language, I'm unable to complete the program and would appreciate any kind of help. My basic idea was to convert the code I get and convert them to one single number. Put the numbers into an array then put them in an unknown string. However, there were several error along the way like>
Code:
if (P1=10000000){allNum[i]= 1;}
=
Code:
warning 158: overflow in implicit constant conversion
.
This is the program I got so far:
Code:
#include <sms.h>
#include <f330lib.h>

void getNumber(void)
{
	int i;
    char allNum[8];

	for(i=0; i=7; i++)
	{
	if (P1=10000000){allNum[i]= 1;}
	if (P1=10001000){allNum[i]= 2;}
	if (P1=10010000){allNum[i]= 3;}
	if (P1=10100000){allNum[i]= 4;}
	if (P1=10101000){allNum[i]= 5;}				
	if (P1=10110000){allNum[i]= 6;}			
	if (P1=11000000){allNum[i]= 7;}				
	if (P1=11001000){allNum[i]= 8;}				
	if (P1=11010000){allNum[i]= 9;}
	if (P1=11100000){allNum[i]= 0;}
	}
	char handPhone[] = new allNum[0], allNum[1], allNum[2], allNum[3], allNum[4], allNum[5], allNum[6], allNum[7]


}
This is the error:
Code:
syntax error: token -> 'char' ; column 5
Am I doing it right? Am I supposed to do it like this? If not, how should I go about doing this? I did researched about the problem, but the more solution i try then more complicated the thing gets, I became even more confused.
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…