我用STM32F103C8T6写SIM卡的电话薄,老是收到67 00,P3长度错误。
程序如下:
const uint8_t DF[2] = {0X7F,0X10};
const uint8_t DF1[2] = {0x6f,0x3A};
。。。。。。。。。。。。。。。。。。。。。。。。。。。。
if(((SC_Responce.SW1 << 8) | (SC_Responce.SW2)) == SC_OP_TERMINATED) //9000
{
// USART_SendData(USART1,0x13);
// delay1(2);
SC_ADPU.Header.CLA = SC_CLA_GSM11; //A0
SC_ADPU.Header.INS = SC_SELECT_FILE; //A4
SC_ADPU.Header.P1 = 0x00;
SC_ADPU.Header.P2 = 0x00;
SC_ADPU.Body.LC = 0x02;
for(i = 0; i < SC_ADPU.Body.LC; i++)
{
SC_ADPU.Body.Data[i] = DF[i];
}
SC_ADPU.Body.LE = 0;
SC_Handler(&SCState, &SC_ADPU, &SC_Responce);
}
// USART_SendData(USART1,SC_Responce.SW1);
// delay1(2);
if(SC_Responce.SW1 == SC_EF_SELECTED) //9F
{
// USART_SendData(USART1,0X14);
// delay1(2);
SC_ADPU.Header.CLA = SC_CLA_GSM11; //A0
SC_ADPU.Header.INS = SC_SELECT_FILE; //A4
SC_ADPU.Header.P1 = 0x00;
SC_ADPU.Header.P2 = 0x00;
SC_ADPU.Body.LC = 0x02;
for(i = 0; i < SC_ADPU.Body.LC; i++)
{
SC_ADPU.Body.Data[i] = DF1[i];
}
SC_ADPU.Body.LE = 0;
SC_Handler(&SCState, &SC_ADPU, &SC_Responce);
}
if(SC_Responce.SW1 == SC_EF_SELECTED) //9F
{
// USART_SendData(USART1,0X24);
// delay1(2);
SC_ADPU.Header.CLA = SC_CLA_GSM11; //A0
SC_ADPU.Header.INS = SC_UPDATE_RECORD; //DC
SC_ADPU.Header.P1 = 0x00;
SC_ADPU.Header.P2 = 0x04;
SC_ADPU.Body.LC = 0x2f; //40ÒÔÄÚ²»¶Ô 0x1c(94 02)
SC_ADPU.Body.Data[0]=0x55;
SC_ADPU.Body.Data[1]=0xaa;
SC_ADPU.Body.LE = 00;
SC_Handler(&SCState, &SC_ADPU, &SC_Responce);
}
长度要大于14个字节,我从14试到47都不对,试到什么时候是个头啊?
大神指教,谢谢!
|