CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

why Pic16f877a UART send unknown characters
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cse307



Joined: 03 Oct 2011
Posts: 25

View user's profile Send private message

why Pic16f877a UART send unknown characters
PostPosted: Tue Dec 27, 2011 4:23 pm     Reply with quote

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 Exclamation Question ) 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

View user's profile Send private message

PostPosted: Tue Dec 27, 2011 4:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 28, 2011 2:34 pm     Reply with quote

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

View user's profile Send private message

RS232 misbehaviour
PostPosted: Thu Dec 29, 2011 5:21 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 29, 2011 5:41 am     Reply with quote

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

View user's profile Send private message

Re: RS232 misbehaviour
PostPosted: Fri Dec 30, 2011 8:00 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 8:04 am     Reply with quote

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

View user's profile Send private message

Re: RS232 misbehaviour
PostPosted: Fri Dec 30, 2011 10:25 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 10:28 am     Reply with quote

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: 19384

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 10:51 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 3:50 pm     Reply with quote

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: 19384

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 4:03 pm     Reply with quote

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

View user's profile Send private message

Re: RS232 misbehaviour
PostPosted: Sat Dec 31, 2011 9:00 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Dec 31, 2011 9:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Dec 31, 2011 9:15 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group