View previous topic :: View next topic |
Author |
Message |
francisco
Joined: 09 Feb 2007 Posts: 1
|
USB function and Serial function |
Posted: Fri Feb 09, 2007 10:28 am |
|
|
Hi,
I'm a new user; I have a problem.
My circuiti with 18f4550 have a compnent that comunicate with serial pin and the circuit comunicat with pc between USB port. My problem is , as I make to transfer data acquired of the serial prot of pic into pc?
I must use two funcition, one that acquire to serial data and another that put to usb?
Thanks
PS: Sorry for my english |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Fri Feb 09, 2007 11:46 am |
|
|
Greetings francisco,
If you search the CCS forum for FTDI, there are many postings for USB to serial conversion. The FTDI USB-serial chip has the ability to communicate directly with the UART of the PIC. All you do is hook up the chip, install the drivers on the PC side, and you can communicate to your PIC through USB . Other chip manufacturers which make similar chips include Silicon Labs and Maxim. The other alternative would be to use a PIC which supports USB communication.
Cheers,
JMA |
|
|
Ttelmah Guest
|
|
Posted: Fri Feb 09, 2007 3:23 pm |
|
|
He has a PIC with USB.
The answer is yes. You need to read the serial data, do any modification you want, and then write it to the USB.
However if all you want is serial to USB transfer, then you don't even need the PIC. The FTDI converters mentioned by the other poster, would do this.
Best Wishes |
|
|
Guest
|
Sorry I rectify information |
Posted: Fri Feb 09, 2007 3:35 pm |
|
|
Hi maybe I have write wrong information.
I have a hardware that it works correctly. I don't know as I make transfer data to rs232 on usb. Which funciton can transfer the data that acquire on pin rx and transfer this on usb? I use this code:
Code: |
char string[4];
//-----ohter code-------
get_string_usb(string,4);
printf(usb_cdc_putc, "%s\n\r", string);
|
this code is correctly compiled but not received nothing.
Thanks
Francisco |
|
|
Ttelmah Guest
|
|
Posted: Fri Feb 09, 2007 4:17 pm |
|
|
get_string_usb, gets the string _from_ the USB. Look at the source code for this. To get a string from the RX pin, use 'get_string' (included in input.c), which will fetch characters from the serial pin (if this is setup right), and then send the results of _this_ to the USB.
Best Wishes |
|
|
|