Function Question.
Posted: 23 Nov 2010 08:01
How would you pass a port into a function so that you can read or write to a givin pin? Code example below
int SampleCode(unsigned short MyPort, unsigned int PortPin)
{
if(MyPort.PortPin == 1)
{
return 100;
}
else
{
return 10;
}
}
void DoSomething()
{
PORTB = SampleCode(PORTC,3);
}
int SampleCode(unsigned short MyPort, unsigned int PortPin)
{
if(MyPort.PortPin == 1)
{
return 100;
}
else
{
return 10;
}
}
void DoSomething()
{
PORTB = SampleCode(PORTC,3);
}