CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

serial command to an HCR330 reader

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
David



Joined: 20 Jul 2005
Posts: 1
Location: BANGKOK, THAILAND

View user's profile Send private message

serial command to an HCR330 reader
PostPosted: Wed Aug 10, 2005 9:04 pm     Reply with quote

Hello

My name's David and I begin to use CCS compiler with MPLAB.

I have a problem to send a serial command to a HCR330 smartcard reader.
The reader specifications are :
- 9600 baud rate
- 8 bits data length
- parity none
- 1 stop bit

I want to send the command "<ESC>E" and I made this little program ->


#if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 1

#elif defined(__PCB__)
#include <16c56.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_A3, rcv=PIN_A2) // Jumpers: 11 to 17, 12 to 18

#elif defined(__PCH__)
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12
#endif


void main() {

int a, b;

a = 0x1b
b = 0x45

printf(a, b)

}

I tried to set a and b in Dec like this a = 27 and b = 69 but It doesn't working too and I don't know why.

Have you an idea about that and can you help me ?

Thank you

Best regards

David
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Aug 10, 2005 9:23 pm     Reply with quote

Code:


void main() {

printf("\x1bE");

}

_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 10, 2005 11:13 pm     Reply with quote

Also you can do it this way:
Code:

main()
{
int8 a;
int8 b;

a = 0x1b;
b = 0x45;

putc(a);
putc(b);

while(1);
}


or this way:
Code:

main()
{
putc(0x1b);
putc(0x45);

while(1);
}


or this way:
Code:

#define ESCAPE_CHAR  0x1b

main()
{
putc(ESCAPE_CHAR);
putc('E');    //  The 'E' character must be in single quotes

while(1);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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