jboud
Newbie level 6
input_d
Hi all,
I use port D to multiplex add/data to control a modem (mfrc531)
and here is my read function:
unsigned char read (unsigned char add)
{ unsigned char val;
SET_TRIS_D( 0x00 );
output_d(add); // Send address
delay_cycles(1);
output_high(ALE);
delay_cycles(1);
output_low(ALE);
delay_us(3);
output_low(NRD);
SET_TRIS_D( 0xFF );
delay_us(3);
val=input_d(); // receive data
delay_cycles(1);
output_high(NRD);
delay_cycles(1);
return val;
}
the problem is that val takes the address value which i sent previsiouly.
I can't find the problem.
I would really appreciate receiving your help.
Cordially
Hi all,
I use port D to multiplex add/data to control a modem (mfrc531)
and here is my read function:
unsigned char read (unsigned char add)
{ unsigned char val;
SET_TRIS_D( 0x00 );
output_d(add); // Send address
delay_cycles(1);
output_high(ALE);
delay_cycles(1);
output_low(ALE);
delay_us(3);
output_low(NRD);
SET_TRIS_D( 0xFF );
delay_us(3);
val=input_d(); // receive data
delay_cycles(1);
output_high(NRD);
delay_cycles(1);
return val;
}
the problem is that val takes the address value which i sent previsiouly.
I can't find the problem.
I would really appreciate receiving your help.
Cordially