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 CCS Technical Support

serial communication RS232?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lucas



Joined: 17 May 2011
Posts: 5

View user's profile Send private message

serial communication RS232?
PostPosted: Tue May 17, 2011 12:27 pm     Reply with quote

Can someone help me for serial communication between a PIC16F628 and a ultrasonic sensor (SFR02)? The project is to build an ultrasonic meter, but I don't know exactly what I have to do for the serial communication because I never used. The serial interface is a standard TTL level UART format at 9600 baud, 1 start, 2 stop and no parity bits. I often used assembly and I'm not expert to use CCS.


(sorry for any errors. I'm learning english)
ps: If someone want to contact me in private, this is my emailaddr: lucadinamo@hotmail.it
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 17, 2011 6:04 pm     Reply with quote

The following website..
http://www.robot-electronics.co.uk/htm/srf02techSer.htm

has all the info you need to interface the module to a PIC.

Be sure to try their PC interface program to get familiar with the product.
lucas



Joined: 17 May 2011
Posts: 5

View user's profile Send private message

PostPosted: Thu May 19, 2011 8:39 am     Reply with quote

temtronic wrote:
The following website..
http://www.robot-electronics.co.uk/htm/srf02techSer.htm

has all the info you need to interface the module to a PIC.

Be sure to try their PC interface program to get familiar with the product.


ok..i saw it but i'm not sure that the program will be ok..i have to programming a PIC with CCS but i'm not a good programmer yet beacuse i'm studing it since march..so i'll try it..can you give me other suggestions?
thank you for the help Smile
vladtess



Joined: 14 May 2011
Posts: 26

View user's profile Send private message

PostPosted: Thu May 19, 2011 9:09 am     Reply with quote

Lucas, it's pretty simple.

First off, make sure #use delay (clock = x) command is in the code.
Then, make sure to include #use rs232 directive. (SEE THE MANUAL< IT EXPLAINS VERY WELL WHAT OPTIONS TO ADD TO THE DIRECTIVE).

Such as:

Code:
#use delay (clock = 4000000)
#use rs232 xmit=A0, rcv=A1, invert


This makes PortA pin 0 transmit pin, and PortA pin 1 receive pin, and the outputs will be inverted (as needed I believe; you can always remove invert option and see if it works).

Then simply use the "putc(var)" function to send commands to the module, where var is a variable that contains a command to send. Refer to the site posted earlier by temtronic to understand what commands to send. Make sure NOT to use MAX232 chip.

Very simple once you get it. Smile

PS> If you have two PICs, I suggest establishing communication between them first to understands how it all works.

I hope this somewhat helps!

VT
Code:
lucas



Joined: 17 May 2011
Posts: 5

View user's profile Send private message

PostPosted: Fri May 20, 2011 8:15 am     Reply with quote

oh..thank you so much..i finished it last day and now i'm working on the program ;) it's my exam's project and i hope that will be ok ;) thank you a lot..if there is something wrong could i post here the program? Very Happy
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Fri May 20, 2011 7:50 pm     Reply with quote

lucas wrote:
oh..thank you so much..i finished it last day and now i'm working on the program ;) it's my exam's project and i hope that will be ok ;) thank you a lot..if there is something wrong could i post here the program? Very Happy


If you have a complete sample that isn't super long that displays they problem you are having, feel free to post it here for us to look at it.

Again, it needs to be complete. It needs to display the problem and most important, it can't be pages and pages of code. Make your example show just the problem you are having.

Make sure to include what PIC device you are using and the version of CCS's compiler.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
lucas



Joined: 17 May 2011
Posts: 5

View user's profile Send private message

PostPosted: Mon May 23, 2011 8:02 am     Reply with quote

bkamen wrote:
lucas wrote:
oh..thank you so much..i finished it last day and now i'm working on the program ;) it's my exam's project and i hope that will be ok ;) thank you a lot..if there is something wrong could i post here the program? Very Happy


If you have a complete sample that isn't super long that displays they problem you are having, feel free to post it here for us to look at it.

Again, it needs to be complete. It needs to display the problem and most important, it can't be pages and pages of code. Make your example show just the problem you are having.

Make sure to include what PIC device you are using and the version of CCS's compiler.


mm ok Smile i'll tell you something if it doesn't work.. PIC: 16F628
CCS's version...mmm i'm not sure....so i'll check it.
thank'u for all..see you soon!
ps: if some1 wants schematic or pcb, i can share it.[/img]
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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