View previous topic :: View next topic |
Author |
Message |
cse307
Joined: 03 Oct 2011 Posts: 25
|
why Pic16f877a UART send unknown characters |
Posted: Tue Dec 27, 2011 4:23 pm |
|
|
Q1:
I programed my pic16f877a to send a serial data (information about my project ) to my PC but the Hyper terminal receives unknown symbols -infinitely - and when I touch it it changes the symbols.(weird ) There is no short circuit. I tested the board on another PIC16f with different code and using DMM.
Baud rate:9600 on PC and PIC16f(4MHz)
----------------------------------------------------------------------------
Q2:
I connected a cellphone which supports AT commands to PC and tried "AT" and i received"OK", its working good. But when I use it with PIC16 (send "AT"), the PIC16 does not receive anything from the cellphone. I tried to send "AT" using PIC16 and receive it using PC. I received "OK". The code on the PIC16 to send "AT" and receive "OK" is tested using Bluetooth and it works.
I put an LED on the cellphone (Rx) so when PIC16 send "AT" the LED blinks. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Dec 27, 2011 4:28 pm |
|
|
If the circuit behavior changes when you touch it, the first place I would look is for a bad GROUND connection. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Wed Dec 28, 2011 2:34 pm |
|
|
SherpaDoug wrote: | If the circuit behavior changes when you touch it, the first place I would look is for a bad GROUND connection. |
But I checked the circuit on the board on another pic with different code that also uses the rs232 and it worked good with no problem. And I reprogrammed the PIC (that worked) with the same code in previous PIC(have problem) but the problem still existed. |
|
|
ALPL
Joined: 29 Mar 2009 Posts: 30
|
RS232 misbehaviour |
Posted: Thu Dec 29, 2011 5:21 am |
|
|
Next to a possible GND-problem you may not have put a 0.1µF capacitor between Vdd and Vss or the MCLR-pin is not connected/set properly. |
|
|
ALPL
Joined: 29 Mar 2009 Posts: 30
|
|
Posted: Thu Dec 29, 2011 5:41 am |
|
|
Q2: which cellphone do you use? Did you check the cell-phone serial communication parameters/protocol, esp the electrical levels of the comm-lines and the hand-shake protocols? |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
Re: RS232 misbehaviour |
Posted: Fri Dec 30, 2011 8:00 am |
|
|
ALPL wrote: | Next to a possible GND-problem you may not have put a 0.1µF capacitor between Vdd and Vss or the MCLR-pin is not connected/set properly. |
the MCLR-pin connected correctly i test it But i did not put a 0.1uF cap is it important?? |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Fri Dec 30, 2011 8:04 am |
|
|
ALPL wrote: | Q2: which cellphone do you use? Did you check the cell-phone serial communication parameters/protocol, esp the electrical levels of the comm-lines and the hand-shake protocols? |
the Cell phone is T68i Sony Ericsson and i don't think that there is any protocols becauunication and it works on computer RS232 and it respond to PIC commands But PIC cannot receive reply's while computer can |
|
|
ALPL
Joined: 29 Mar 2009 Posts: 30
|
Re: RS232 misbehaviour |
Posted: Fri Dec 30, 2011 10:25 am |
|
|
cse307 wrote: | ALPL wrote: | Next to a possible GND-problem you may not have put a 0.1µF capacitor between Vdd and Vss or the MCLR-pin is not connected/set properly. |
the MCLR-pin connected correctly i test it But i did not put a 0.1uF cap is it important?? |
Better try with the 0.1µF capacitor. |
|
|
ALPL
Joined: 29 Mar 2009 Posts: 30
|
|
Posted: Fri Dec 30, 2011 10:28 am |
|
|
cse307 wrote: | ALPL wrote: | Q2: which cellphone do you use? Did you check the cell-phone serial communication parameters/protocol, esp the electrical levels of the comm-lines and the hand-shake protocols? |
the Cell phone is T68i Sony Ericsson and i don't think that there is any protocols becauunication and it works on computer RS232 and it respond to PIC commands But PIC cannot receive reply's while computer can |
If you have an oscilloscope you may trace the response of the cell-phone to see if anything is coming back and how it looks like. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Fri Dec 30, 2011 10:51 am |
|
|
So you are able to connect the phone to a PC directly?.
So, how are you connecting to the PIC?. You are aware that you _need_ an inverting RS232 buffer between the PIC and the phone, if the phone can talk directly to a PC?....
Best Wishes |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Fri Dec 30, 2011 3:50 pm |
|
|
Ttelmah wrote: | So you are able to connect the phone to a PC directly?.
So, how are you connecting to the PIC?. You are aware that you _need_ an inverting RS232 buffer between the PIC and the phone, if the phone can talk directly to a PC?.... |
Not directly, I used Max232 between computer and cellphone. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Fri Dec 30, 2011 4:03 pm |
|
|
OK. Good.
Now, have you tested that this is working correctly?.
There was a several entry thread only a few days ago, where one pin of the MAX232, was not correctly connected, and the poster was having problems with corrupted characters.
Best Wishes |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
Re: RS232 misbehaviour |
Posted: Sat Dec 31, 2011 9:00 am |
|
|
ALPL wrote: | cse307 wrote: | ALPL wrote: | Next to a possible GND-problem you may not have put a 0.1µF capacitor between Vdd and Vss or the MCLR-pin is not connected/set properly. |
the MCLR-pin connected correctly i test it But i did not put a 0.1uF cap is it important?? |
Better try with the 0.1µF capacitor. |
i put the Cap between Vcc and Ground?
i will try it when i have one.
thanks for helping me |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Sat Dec 31, 2011 9:09 am |
|
|
ALPL wrote: | cse307 wrote: | ALPL wrote: | Q2: which cellphone do you use? Did you check the cell-phone serial communication parameters/protocol, esp the electrical levels of the comm-lines and the hand-shake protocols? |
the Cell phone is T68i Sony Ericsson and i don't think that there is any protocols becauunication and it works on computer RS232 and it respond to PIC commands But PIC cannot receive reply's while computer can |
If you have an oscilloscope you may trace the response of the cell-phone to see if anything is coming back and how it looks like. |
no i don't have one but if the computer can get the response the PIC16f877a should can i even put a Max232 between the PIC16 and the cellphone but nothing happened.
--for cellphone connected to Max232 on (Tx>pin11(not working) ,Rx directly connected to Tx of PIC(works))
--for PIC (Rx>pin14 of Max232) |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Sat Dec 31, 2011 9:15 am |
|
|
Ttelmah wrote: | OK. Good.
Now, have you tested that this is working correctly?.
There was a several entry thread only a few days ago, where one pin of the MAX232, was not correctly connected, and the poster was having problems with corrupted characters.
Best Wishes |
onnected correctly.and works correctly when the cellphone connected to computer via MAX.
what is the Pin number that was not connected correctly?Do you Have a link of that thread?.
thanks for helping me |
|
|
|