send command (0x52 0x01 0x00) using usart
时间:03-26
整理:3721RD
点击:
actually i want to send this command from pic 16f877A to RFID IC to
READ BLOCK 1 using KEY 0 as KEYA (0x52 0x01 0x00)
is that possible i can send single command like this
command=0x52 0x01 0x00;
Usart_Write(command);
or need to change 0x52 0x01 0x00 to ascii?
sorry because i am newbies
thank
this is my program
#define CTS PORTA.F2
unsigned int command;
void main()
{
trisa=0xFF;
trisb=0x00;
porta=0x00;
portb=0x00;
while(1)
{
Usart_Init(9600);
if (CTS = 0)
{
command=0x52 0x01 0x00;
Usart_Write(command);
}
}
}
READ BLOCK 1 using KEY 0 as KEYA (0x52 0x01 0x00)
is that possible i can send single command like this
command=0x52 0x01 0x00;
Usart_Write(command);
or need to change 0x52 0x01 0x00 to ascii?
sorry because i am newbies
thank
this is my program
#define CTS PORTA.F2
unsigned int command;
void main()
{
trisa=0xFF;
trisb=0x00;
porta=0x00;
portb=0x00;
while(1)
{
Usart_Init(9600);
if (CTS = 0)
{
command=0x52 0x01 0x00;
Usart_Write(command);
}
}
}
No,
Must use PRINTF or PUTC inside a loop.
What compiler are you using ?
+++
Does usart_write takes array as parameter or only one byte?
If one byte than you should use:
char command[]={0x52,0x01,0x00};
for(int i=0; i< 3; i++){
Usart_write(command[i];
}
first thank for all reply.
Can i ask ScOe how about takes array as parameter
It can only be done if function takes pointer to that array and number of data in array.
And i think that this Usart_Write takes only one char as parameter, so the solution to your problem is as i wrote before...