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

rs232 using 16f628

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








rs232 using 16f628
PostPosted: Mon Oct 18, 2004 8:32 am     Reply with quote

hello.
how can i connect my pic16f628 with pc?

Code:

#include <16f628.h>
#fuses XT,NOWDT,NOPROTECT, NOPUT, NOBROWNOUT
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, parity=N, bits=8)

#include <stdlib.h>

void main()
{
     while(1)
     {
      puts("Hallo");
      delay_ms(500);
     }
}


what did i do wrong? thnx..
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Oct 18, 2004 11:34 am     Reply with quote

Did ya use a RS232 transceiver chip? Did ya connect it via a Null modem cable (Tx(PIC)->Rx(PC) and Rx(PIC)->Tx(PC) and GND->GND)?
Guest








PostPosted: Mon Oct 18, 2004 2:15 pm     Reply with quote

Mark wrote:
Did ya use a RS232 transceiver chip? Did ya connect it via a Null modem cable (Tx(PIC)->Rx(PC) and Rx(PIC)->Tx(PC) and GND->GND)?


well i dont have a max232, im using a hex converter..
i have a null modem cable, but i just connect that (Tx(PIC)->Rx(PC) and GND-GND
Ttelmah
Guest







PostPosted: Mon Oct 18, 2004 3:55 pm     Reply with quote

Anonymous wrote:
Mark wrote:
Did ya use a RS232 transceiver chip? Did ya connect it via a Null modem cable (Tx(PIC)->Rx(PC) and Rx(PIC)->Tx(PC) and GND->GND)?


well i dont have a max232, im using a hex converter..
i have a null modem cable, but i just connect that (Tx(PIC)->Rx(PC) and GND-GND

A 'hex converter'?.
Do you mean a 'hex inverter'?. If so, this _may_ (sometimes) work, with some RS232 inputs, but is by no means guaranteed, and is well out of spec. RS232, really requires a -ve supply rail to be generated (the MAX232 does this for you). I'd suspect that your output, just does not get close enough to the RS232 requirements. Try with a MAX232...

Best Wishes
Guest








PostPosted: Tue Oct 19, 2004 9:21 am     Reply with quote

Ttelmah wrote:
Anonymous wrote:
Mark wrote:
Did ya use a RS232 transceiver chip? Did ya connect it via a Null modem cable (Tx(PIC)->Rx(PC) and Rx(PIC)->Tx(PC) and GND->GND)?


well i dont have a max232, im using a hex converter..
i have a null modem cable, but i just connect that (Tx(PIC)->Rx(PC) and GND-GND

A 'hex converter'?.
Do you mean a 'hex inverter'?. If so, this _may_ (sometimes) work, with some RS232 inputs, but is by no means guaranteed, and is well out of spec. RS232, really requires a -ve supply rail to be generated (the MAX232 does this for you). I'd suspect that your output, just does not get close enough to the RS232 requirements. Try with a MAX232...

Best Wishes


oh sry, yes i used a hex inverter.
but theres nothing wrong with the code?
thx
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue Oct 19, 2004 11:41 am     Reply with quote

Try this:

Code:


#include <16f628.h>
#fuses XT,NOWDT,NOPROTECT,PUT, NOBROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1)
       // Selected by default : parity=N, bits=8

//#include <stdlib.h>            // Not needed

void main()
{
  while(1)
       {
        printf("\r\nHallo");
        delay_ms(500);
       }
}


Best wishes

Humberto
Guest








PostPosted: Tue Oct 19, 2004 2:54 pm     Reply with quote

thanks 2 u all,
i'll try that on thursday.

thnx
dgjboy
Guest







Connect PIC <-> PC, easy option
PostPosted: Mon Oct 25, 2004 9:06 am     Reply with quote

Hi developers!

You can connect your PIC with a PC using next option (only for software UART and use INVERT directive):

PIC PC(RS232-9 pins)
*** ***************

TX ----4K7Resistor---- RX (2)

RX ----4K7Resistor---- TX (3)

And if you need a simple power supply for your circuit try it:

PC(RS232-9 pins)
***************

RST(4) ----1K------------------------------------ 5v
| |
GND(5) ----------Zener5v1----- ----
| ---- 100nF
| |
--------------------------------------- Gnd


Grettings
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