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

Pls help me for sending a simple msg using RS232(PIC4550)

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



Joined: 10 Jan 2011
Posts: 29

View user's profile Send private message

Pls help me for sending a simple msg using RS232(PIC4550)
PostPosted: Mon Jan 10, 2011 2:46 pm     Reply with quote

I am newbie, can anyone give me a simple ccsc code for sending a simple text to show in pc through RS232 with PIC 18f4550.... Pls help me. Thk for your kindness ... god bless
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 10, 2011 2:53 pm     Reply with quote

Try this program:
Code:

#include <18F4550.h>         
#fuses INTRC_IO, NOWDT, PUT, BROWNOUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//====================================
void main()
{
printf("Hello World\n\r");

while(1);
}
motts



Joined: 10 Jan 2011
Posts: 29

View user's profile Send private message

PostPosted: Mon Jan 10, 2011 3:16 pm     Reply with quote

thk for helping me ... this code will send the msg when i connect my circuit with the pc?? or need trigger any thing? cause i cant get any msg in my pc (hyperterminal). THk for reply . good bless
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 10, 2011 3:38 pm     Reply with quote

Buy a PIC development board with a Max232-type chip on it for the RS232
interface. Put the 18F4550 in the board. Connect the board to your PC
with a factory-built cable. Then it should work.
motts



Joined: 10 Jan 2011
Posts: 29

View user's profile Send private message

PostPosted: Mon Jan 10, 2011 3:41 pm     Reply with quote

thk for your advise ^^ god bless
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Mon Jan 10, 2011 3:54 pm     Reply with quote

motts wrote:
thk for helping me ... this code will send the msg when i connect my circuit with the pc?? or need trigger any thing? cause i cant get any msg in my pc (hyperterminal). THk for reply . good bless


It will send the message, when it is turned on, or reset. You need to have the connection to the PC 'made' _before_ you apply power to the unit. The act of attaching it to the PC, won't make it send the message.

If it still doesn't work, then as PCM programmer says, get a board that is known to work....

Best Wishes
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Jan 10, 2011 5:47 pm     Reply with quote

That program assumes a 4MHz clock to get 9600 baud. If the clock or baud rate is wrong you may get garbage. But you should get SOMETHING every time the board is power up.
_________________
The search for better is endless. Instead simply find very good and get the job done.
motts



Joined: 10 Jan 2011
Posts: 29

View user's profile Send private message

PostPosted: Sun Jan 16, 2011 4:18 pm     Reply with quote

THk for helping . it work now ^^
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