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 port read

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



Joined: 18 Jan 2013
Posts: 6

View user's profile Send private message

serial port read
PostPosted: Tue Feb 05, 2013 3:24 am     Reply with quote

i would like to scan a card, read this data in through 1 serial port of the PIC and print it out to the PC from another serial port.

When the card is scanned it displays the following number on the computer serial port: A32374DA8EFERC7B03049250 it is being printed in HEX, has a start bit of 02 and a stop bit of 0A, any ideas or help on how i could read in this data to the PIC?

This number is seen when the card scanning device is connected directly to the PC, However i do not want this, as i need to do some processing with this data on the PIC.

Thanks in advance
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Tue Feb 05, 2013 5:20 am     Reply with quote

I'm confused about what you have actually tried and what you want.

Please draw me a picture.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Tue Feb 05, 2013 5:27 am     Reply with quote

I think he just wants to convert ASCII hex to a numeric format. Has been answered thousands of times here. However (obviously), no he is not going to be able to do any numeric processing on the whole number, but even worse what he posts is not hex. The 'R' just left of centre.....

Best Wishes
paul_dean



Joined: 18 Jan 2013
Posts: 6

View user's profile Send private message

PostPosted: Tue Feb 05, 2013 6:12 am     Reply with quote

i have a contact less card reader, when the device is connected to the USB port of the PC directly, the serial monitor shows the number as above. I do not want to connect this device to the PC, i would like to connect it to the serial port of the PIC and store this number...sorry the 'R' was meant to be a 'B'.

Thanks in advance.
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Tue Feb 05, 2013 6:16 am     Reply with quote

Every pair of hex digits, represents a single byte. Just read the pairs, and convert these to bytes, then write these to an array.
The bootloader code, contains a routine to do this (the ROM data is normally sent as hex....).
Several other examples have similar routines.

Best Wishes
temtronic



Joined: 01 Jul 2010
Posts: 9240
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Feb 05, 2013 6:43 am     Reply with quote

His second response says he has a USB device so we now know another piece of the puzzle!
The 'reading data....sending to PC' just got a lot more complicated !
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