![]() | ![]() | ![]() |
| | |||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| I'm having problems trying to get serial communications working on a PIC16F88. The UART to serial level shifting is done using a MAX233. 1. Connecting TX to RX on the PC works (I get echo on the terminal) 2. Connecting TX and RX on the MAX233 works as well 3. Connecting TX and RX to the TX and RX of the PIC produces gibberish. 4. I've checked that my baud rates, parity and rate-control are correct. 5. Just in case I messed up my RX and TX connections, I tried swapping them in all permutations possible. I'm thinking its because I'm using the internal RC oscillator of the PIC, which isn't very stable. I also need help knowing how do I connect DTS and RTS if I don't want software /hardware rate control, and how would I do that if I want to use rate control. Finally, someone please tell me if there is a standard for RX and TX notations? Thanks! | |
| |
| | (permalink) |
| If you are getting an echo without DTS and CTS before you connect the PIC then you don't need those connections with the PIC. Pin 2 of the 9 pin RS232 connection is the transmit and connects to pin 4, 9, 18, 23 or 27 of the MAX233 Pin 5, 8, 19, 22 or 26 of the MAX233 connects to Pin 8 of the pic16F88. I would not use the internal oscillator for serial communication timing. You should use a crystal or a crystal oscillator. For testing I would suggest getting the PIC to light an LED when it recieves a byte. Also if you convert what is recieved to lower case, and send it back out, it proves that reception and transmission are working. | |
| |
| | (permalink) |
| Finally, someone please tell me if there is a standard for RX and TX notations? Hi, Google for 'RS232 standards' http://www.camiresearch.com/Data_Com..._standard.html http://en.wikipedia.org/wiki/RS232
__________________ Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ | |
| |
| | (permalink) |
| Hello all, thanks for the replies! Diver300, after wiring as you recommended, it still gave me gibberish, but at least I know the wiring is correct now. Alternating an LED for each character received did work, so I guess its a timing issue (the internal oscillator was that inaccurate?). ericgibbs, wow, it was right under my nose, I'm embarassed! :$ I haven't seen the first link beore though, but its really very clear (better than wikipedia's), thanks! | |
| |
| | (permalink) |
| You might have a look at my tutorials, the internal oscillator in a 16F628 is fine at 9600 baud, and probably higher as well. | |
| |
| | (permalink) |
| Hmm, sorry for the disappearance, but its working now. The problem seems to be a combination of a bad cable and a missing capacitor. My homemade serial cable made from an old serial mouse cable apparently has broken links within the cable which made things go crazy. Using the cable off another old mouse gave me more consistent results. Things were still not operating as they're supposed to though. After looking through the typical operating diagram for the MAX233, I remembered that I omitted the 1.0uF capacitor required between Vcc and GND. Things worked straight away after I added that capacitor. Then a question came to my head. The chip's specifications stated 0 external capacitors required, which is why I thought I could omit the 1.0uF capacitor. Did I forget to read some fine print regarding their capacitor count? And in the interest of learning, I have three questions. What is the purpose of that capacitor; is it for filtering purposes or as a "power reserve" during current draw peaks? If it is not there to act as a noise filter and since I already have an output capacitor attached to my voltage regulator's output, can I just "merge" the two capacitors (i.e. Remove both capacitors and replace with one with a value of the sum of the two capacitors removed)? They are (I think) in effect capacitors attached in parallel and should be equivalent to a single capacitor with a capacitance equal to the sum of the capacitance of the capacitors attached in parallel? What effect does this new capacitor added have on the time taken for the power supply to stabilise on power up? Sorry if my questions sound confusing, illogical, weird and/or stupid, I'm in the beginning stages of my learning and things are still shaky. Also, please look at this other thread that I have started for some questions on a project I'm working on: http://www.electro-tech-online.com/s...d.php?p=304514 Very much appreciated! | |
| |
| | (permalink) | |
| Quote:
It's a critical part, and should ALWAYS be fitted in any electronic circuit. PIC's are probably one of the most 'forgiving' parts, and sometimes will work quite happily with out it - but it should still be fitted!. | ||
| |
| | (permalink) |
| 'decoupling' capacitors are required between supply and ground, one for every one or two ic's in the circuit. they should be as close as possible to the ic. i think 0.1uf ceramic is usual. Nigel replied while i was typing. Last edited by monkeybiter; 19th April 2008 at 11:39 AM. | |
| |
| | (permalink) | |
| Quote:
In the real world, things are a lot more complicated. The biggest problem is that ICs like the MAX233 take current peaks that start and stop very quickly. The inductance of the wires or tracks going to the IC have significant inductance. As a result, keeping the power supply stable in one place on the board is not good enough, as the voltage will not be stable in other places. To deal with this it is a good idea to add small capacitors at each IC. Small capacitors are better for this because they have small inductance. The large capacitors that are needed for the power supply are much larger, and they have more inductance. The extra little capacitors do not slow down the time to stabilise the power supply, because they are so much smaller. | ||
| |
| | (permalink) | ||
| Thank you all for the prompt reply! Quote:
Quote:
To Diver300: Wow, thanks for the elaborate explanation! Thank you all again, I've learnt a lot from this forum. | |||
| |
| | (permalink) | |
| Quote:
From an AC point of view a circuit is completely different from a DC one. | ||
| |
| | (permalink) | |
| In case anyone reads this in the future, Quote:
| ||
| |
| | (permalink) |
| Greetings, What about the MAX233 capacitors? check the datasheet and put those as is recommended on it | |
| |
| | (permalink) | ||
| Quote:
Quote:
| |||
| |
| | (permalink) | ||
| Quote:
Quote:
| |||
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| still the same pic problems | kutalinelucas | Micro Controllers | 12 | 16th February 2008 06:07 PM |
| how send serial data with PIC | HCT-Pirate | Micro Controllers | 7 | 3rd February 2008 05:27 PM |
| Problems switchin relay with PIC | Andy1845c | General Electronics Chat | 5 | 17th November 2007 07:14 PM |
| Need help badly on Inchworm and MPLAB | thushy | Micro Controllers | 14 | 11th March 2007 07:05 PM |
| USB to Serial problems | spondootre | Micro Controllers | 12 | 28th November 2006 09:09 AM |