Use NAT72010 chip as listener and Speaker, the initialization program for XBYTE commands oepration with 51 SCM as below:
XBYTE[reg5]=0x02; //Chip reset
XBYTE[reg3]=0x99; //Set 7210 mode
XBYTE[reg5]=0x50; //page in
XBYTE[reg3]=0x81; //ICR2,Enable MICR bit, to set chip clock
XBYTE[reg5]=0x02; /set clock 2M
XBYTE[reg5]=0x9c; //Clear PAGE IN
XBYTE[reg1]=0x13; //Open DJ to receive interruption
XBYTE[reg0]=0x00;
XBYTE[reg3]=0xaa; //Auto response the serial inquire
XBYTE[reg4]=0x31; //ADMR, double address mode
gpddr=0x0f; //Address is 15
XBYTE[reg6]=gpddr;
XBYTE[reg6]=0xe0;
XBYTE[reg7]=0x0a;
XBYTE[reg5]=0xac;
XBYTE[reg5]=0xe8;
XBYTE[reg5]=0x88;
XBYTE[reg5]=0;
To process by inquire mode. When detect that the falling edge of NAT7210 chip INT leg enter into the receive processing, after receiving to check whether return data according to commands, the return program is as below:
for(i=0;i<10000;i++)
{
tem88=XBYTE[reg1];
while((tem88&0x02)!=0x02)
tem88=XBYTE[reg1];
XBYTE[reg0]=pdtem[i%10];
}
tem88=XBYTE[reg1];
while((tem88&0x02)!=0x02)
tem88=XBYTE[reg1];
XBYTE[reg0]=0x2c;
tem88=XBYTE[reg1];
while((tem88&0x02)!=0x02)
tem88=XBYTE[reg1];
XBYTE[reg5]=0x06; //Send EDI before the last byte
XBYTE[reg0]=0x0a; //Send stop character
Received data as above progrm is not full, only 9992 characters, which should be 10002 characters, the character strings should be 01234567890123456789...... that from 0 to 9 as one group, totally 1000 groups.
But the 1011th group is 012356789, the 2031th group is 012345678, the 3041th group is 012356789, the 4061th group is 012345678, which lost 4 and 9 every 1010 groups and 1020 groups by turns regular.
Could you help me to find the problem? Or tell me the right processed method, or show me the initialization and receive program? Thank you very much!