tpyedef struct io
{
unsigned char IO_Num;
unsigned char IO_Mode;
unsigned char IO_Pins;
}IO
void IO_Setting(IO io)
{
unsigned char Temp_DataH = 0;
unsigned char Temp_DataL = 0;
unsigned char Temp_Pins = io.IO_Pins;
if(io.IO_Mode == IO_OUTPUT)
{
Temp_DataH = io.IO_Pins;
Temp_DataH = ~io.IO_Pins;
}
else if(io.IO_Mode == IO_INPUT)
{
Temp_DataH = ~io.IO_Pins;
Temp_DataH = o.IO_Pins;
}
else if(io.IO_Mode == IO_BD)
{
Temp_DataH = io.IO_Pins;
Temp_DataH = o.IO_Pins;
}
if(io.IO_Num == PORT0)
{PMOD0H = Temp_DataH;PMOD0L = Temp_DataL}
else if(io.IO_Num == PORT1)
{PMOD1H = Temp_DataH;PMOD1L = Temp_DataL}
}