jboud
Newbie level 6
mfrc531
Hi all,
I am working with pic 18F452 to control the mfrc531.
The oscillator that i am working with is 4*13.56 Mhz (i use PLL)
I am using parallel interface type:separated read/write strobe: multiplexed adress bus.
I multiplex add/data on port D
I have a problem in the START UP PHASE.
It's explained below this code.
unsigned char read (unsigned char add)
{ unsigned char val;
TRISD=0x00;
LATD=add; // Send address
LATC=0x20; //output_high(ALE)
LATC=0x00; //output_low(ALE)
TRISD=0xFF;
LATE=0x00; //output_low(NRD)
val=PORTD; // receive data
LATE=0x04; //output_high(NRD);
delay_us(3);
return val;
}
void reset()
{
delay_ms(500);
LATC=0x00; //output_low(RSTPD)
delay_ms (100);
LATC=0x10; //output_high(RSTPD)
delay_us (100);
read(RegCommand);
}
the problem is that val takes the address value which i sent previsiouly.
so i read the address value 0x01
I am loosing a much of time and i can't find the problem.
I would really appreciate receiving your help.
Cordially
Hi all,
I am working with pic 18F452 to control the mfrc531.
The oscillator that i am working with is 4*13.56 Mhz (i use PLL)
I am using parallel interface type:separated read/write strobe: multiplexed adress bus.
I multiplex add/data on port D
I have a problem in the START UP PHASE.
It's explained below this code.
unsigned char read (unsigned char add)
{ unsigned char val;
TRISD=0x00;
LATD=add; // Send address
LATC=0x20; //output_high(ALE)
LATC=0x00; //output_low(ALE)
TRISD=0xFF;
LATE=0x00; //output_low(NRD)
val=PORTD; // receive data
LATE=0x04; //output_high(NRD);
delay_us(3);
return val;
}
void reset()
{
delay_ms(500);
LATC=0x00; //output_low(RSTPD)
delay_ms (100);
LATC=0x10; //output_high(RSTPD)
delay_us (100);
read(RegCommand);
}
the problem is that val takes the address value which i sent previsiouly.
so i read the address value 0x01
I am loosing a much of time and i can't find the problem.
I would really appreciate receiving your help.
Cordially