View previous topic :: View next topic |
Author |
Message |
paul_dean
Joined: 18 Jan 2013 Posts: 6
|
serial port read |
Posted: Tue Feb 05, 2013 3:24 am |
|
|
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
|
|
Posted: Tue Feb 05, 2013 5:20 am |
|
|
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: 19515
|
|
Posted: Tue Feb 05, 2013 5:27 am |
|
|
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
|
|
Posted: Tue Feb 05, 2013 6:12 am |
|
|
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: 19515
|
|
Posted: Tue Feb 05, 2013 6:16 am |
|
|
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: 9226 Location: Greensville,Ontario
|
|
Posted: Tue Feb 05, 2013 6:43 am |
|
|
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 ! |
|
|
|