View previous topic :: View next topic |
Author |
Message |
wiss1990
Joined: 17 Jun 2013 Posts: 9
|
Rs232 -> USB with pic16f628a |
Posted: Wed Jul 03, 2013 3:52 am |
|
|
hello people
i have the converter rs232 to usb (5v) , and when i send a character from pic to the cable i got it wrong , do i have to use level shifter or what because i thought pic have 5v and the cable as well
thnx |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Wed Jul 03, 2013 5:12 am |
|
|
Yes , you will need a level converter( like a MAX232 chip) between the PIC and the RS232<>USB module.
The PIC is a 'TTL' type device,so you can use a 'TTL<>USB' module and NOT require the MAX232 device. I use this configuration all the time as the TTL<>USB modules are now only $2.50 each.The ones I use also have 3volts available allowing LF series PIC to be simply powered from the USB connection.
hth
jay |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Wed Jul 03, 2013 11:45 am |
|
|
Quote: |
the converter rs232 to usb (5v) |
THE converter you want w/o RS-232 conversion needed is the
FTDI FT232 ( and other related parts from FTDI)
- which will TTL interface to the pic very nicely.
have used if for years now - no problems |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Jul 03, 2013 11:51 am |
|
|
Hi,
Because you didn't tell us specifically which 'converter' you have (is it an IC?, is it a cable?, etc.), we have to make a number of assumptions in
order to answer your question! Whenever you have a hardware interface question, always post a link to the hardware you are dealing with so that
we can better assist you!
In your first ever post on the forum, you did the same thing. You asked for help with a '9g Servomotor' ...... Nobody know what that is unless
you tell us!!
We should not have to speculate about hardware issues - we won't have to if you just post the link!!
John |
|
|
wiss1990
Joined: 17 Jun 2013 Posts: 9
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu Jul 04, 2013 3:02 am |
|
|
You add a MAX232. |
|
|
wiss1990
Joined: 17 Jun 2013 Posts: 9
|
|
Posted: Thu Jul 04, 2013 3:04 am |
|
|
but max232 is not for +/-12v level ? here i need 5v level |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Jul 04, 2013 5:29 am |
|
|
The MAX232 actually does TWO operations for you...and you need them both!
The 'MAX232' type devices convert TTL logic levels(0, +5) to RS232 logic levels(+12,-12) AND at the same time inverts the data(0>1,1>0).That means that when the PIC sends a logic '0' out serially, the MAX232 will invert it to a logic '1'. This is why your data appears as 'garbage'.When the PIC sends out for example the letter 'A'( 0x41), it sends out in binary 01000001. When is passes through the MAX232, it is inverted to 10111110.The receiving device's MAX232 inverts this back to 01000001 and the letter 'A' appears on the PC screen.
Your USB adapter requires 'RS232', and not 'TTL', so you will need a MAX232 between yout PIC and the adapter.
hth
jay |
|
|
wiss1990
Joined: 17 Jun 2013 Posts: 9
|
|
Posted: Thu Jul 04, 2013 6:53 am |
|
|
thank you very much do you have a schematic with exact values of the capacitors for the max232 ? |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Thu Jul 04, 2013 7:14 am |
|
|
read the datasheet... _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Jul 04, 2013 11:56 am |
|
|
I've used 1uf, 10 uf and 22uf whatever's in the junk box.....
You should read the datasheet though, as value depends upon your use.
hth
jay |
|
|
wiss1990
Joined: 17 Jun 2013 Posts: 9
|
|
Posted: Thu Jul 04, 2013 2:24 pm |
|
|
okay thank you all |
|
|
|