View previous topic :: View next topic |
Author |
Message |
motts
Joined: 10 Jan 2011 Posts: 29
|
Pls help me for sending a simple msg using RS232(PIC4550) |
Posted: Mon Jan 10, 2011 2:46 pm |
|
|
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
|
|
Posted: Mon Jan 10, 2011 2:53 pm |
|
|
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
|
|
Posted: Mon Jan 10, 2011 3:16 pm |
|
|
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
|
|
Posted: Mon Jan 10, 2011 3:38 pm |
|
|
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
|
|
Posted: Mon Jan 10, 2011 3:41 pm |
|
|
thk for your advise ^^ god bless |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Jan 10, 2011 3:54 pm |
|
|
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
|
|
Posted: Mon Jan 10, 2011 5:47 pm |
|
|
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
|
|
Posted: Sun Jan 16, 2011 4:18 pm |
|
|
THk for helping . it work now ^^ |
|
|
|