![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
AcquaVx
Joined: 02 Jun 2006 Posts: 6
|
Sending hexa messages |
Posted: Mon Jun 12, 2006 10:41 am |
|
|
Hi all !
My question is certainly pretty stupid.
I'm using CCS 3.242 and a PIC18F2520.
The microcontroller is communicating with a WiFi device and a RFID device. The WiFi works fine.
Regarding the RFID, I have to send a particular message to tell him "Send me the ID on any tags you may find".
The request packet sent to the RFID device is composed of 1 even parity bit, 1 stop bit, 8 bits of data at 9600 bps. Therefore :
Code: | #use rs232(baud=9600,parity=E,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=RFID) //UART PIC à RFID |
The request packet I'd like to send is :
0x05+0xFF+0xAC+0x80+0xD6
I'm trying to send it to the RFID device. How should I do it ? I've tried :
Code: | enum trame_type
{
autoanswer = 0x05+0xFF+0xAC+0x80+0xD6, // Réponse automatique du lecteur RFID vers le microcontrôleur
period = 0x06+0xFF+0xAD+0x01+0x00+0x55, // Période d'activation du lecteur RFID
a=0x05,
b=0xFF,
c=0xAC,
d=0x80,
e=0xD6,
};
|
and :
:: puts("0x05+0xFF+0xAC+0x80+0xD6",RFID);
:: fputs(autoanswer,RFID);
:: fprintf (RFID, "0x05+0xFF+0xAC+0x80+0xD6");
:: fprintf (RFID, autoanswer);
and finally :
Code: | char temp_TTL[]="";
strcpy(temp_TTL,a);
strcat(temp_TTL,b);
strcat(temp_TTL,c);
strcat(temp_TTL,d);
strcat(temp_TTL,e);
fputs(temp_TTL,RFID);
|
None of this works.
Thank you for your suggestions, if any : )
Bye ![Very Happy](images/smiles/icon_biggrin.gif) |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Mon Jun 12, 2006 10:52 am |
|
|
I'm about 99% sure about this:
Code: | putc(0x05);
putc(0xff);
putc(0xac);
putc(0x80);
putc(0xd6); |
The 1% unsure being that I can't remember using putc() before. Something to try anyway. |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Jun 12, 2006 11:53 am |
|
|
fprintf (RFID, "%x%x%x%x%x",0x05,0xFF,0xAC,0x80,0xD6);
fprintf (RFID, "%x%x%x%x%x%x",0x06,0xFF,0xAD,0x01,0x00,0x55);
or if the '+' is needed:
fprintf (RFID, "%x+%x+%x+%x+%x",0x05,0xFF,0xAC,0x80,0xD6);
fprintf (RFID, "%x+%x+%x+%x+%x+%x",0x06,0xFF,0xAD,0x01,0x00,0x55);
or
fputc(0x05, RFID); fputc('+', RFID);
fputc(0xFF, RFID); fputc('+', RFID);
fputc(0xAC, RFID); fputc('+', RFID);
..........................
Humberto |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon Jun 12, 2006 12:36 pm |
|
|
I thought he might need to send the hex
fprintf (RFID, "%c%c%c%c%c",0x05,0xFF,0xAC,0x80,0xD6);
or the putc will work |
|
![](templates/subSilver/images/spacer.gif) |
AcquaVx
Joined: 02 Jun 2006 Posts: 6
|
|
Posted: Wed Jun 14, 2006 12:56 am |
|
|
Thank you guys. I'm getting results.
Enjoy the day : ) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|