Hello, forum!
I'm currently making a very simple Tic-Tac-Toe game with an AT89C51RC2 and I am having issues getting the button input right.
Basically, the input is a 3x3 Button Matrix which I want to utilize by scanning through the rows with a pulse while checking the columns for a connection; pretty basic. However, the way I wanted to do this was by making a unique scroll method that received the row parameter and set it to HIGH accordingly.
I already have
sbit R1 = P0^0;
all through the needed inputs, but I'm not sure if this is correct.
Then, on my main method, I run somehthing like
while(TRUE)
{
scroll(R1);
}
which is named scroll, I have this
void scroll (bit P)
{
P = HIGH; //Sets the row being checked to HIGH (HIGH is already defined as a 1)
....
}
So, this is not working. I know I'm not doing this right, but I had to start somewhere. Is what I am attempting to do possible? Sending a single Pin adress as an overload for a method? If so, what datatype should it be? I was juggling between char and bit but I can't settle.
I hope my question is understandable! If not, I will gladly elaborate and maybe post all the code (although it is quite messy). Thanks, everyone, in advance!
I'm currently making a very simple Tic-Tac-Toe game with an AT89C51RC2 and I am having issues getting the button input right.
Basically, the input is a 3x3 Button Matrix which I want to utilize by scanning through the rows with a pulse while checking the columns for a connection; pretty basic. However, the way I wanted to do this was by making a unique scroll method that received the row parameter and set it to HIGH accordingly.
I already have
sbit R1 = P0^0;
all through the needed inputs, but I'm not sure if this is correct.
Then, on my main method, I run somehthing like
while(TRUE)
{
scroll(R1);
}
which is named scroll, I have this
void scroll (bit P)
{
P = HIGH; //Sets the row being checked to HIGH (HIGH is already defined as a 1)
....
}
So, this is not working. I know I'm not doing this right, but I had to start somewhere. Is what I am attempting to do possible? Sending a single Pin adress as an overload for a method? If so, what datatype should it be? I was juggling between char and bit but I can't settle.
I hope my question is understandable! If not, I will gladly elaborate and maybe post all the code (although it is quite messy). Thanks, everyone, in advance!