|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
rs232 using 16f628 |
Posted: Mon Oct 18, 2004 8:32 am |
|
|
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
|
|
Posted: Mon Oct 18, 2004 11:34 am |
|
|
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
|
|
Posted: Mon Oct 18, 2004 2:15 pm |
|
|
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
|
|
Posted: Mon Oct 18, 2004 3:55 pm |
|
|
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
|
|
Posted: Tue Oct 19, 2004 9:21 am |
|
|
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
|
|
Posted: Tue Oct 19, 2004 11:41 am |
|
|
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
|
|
Posted: Tue Oct 19, 2004 2:54 pm |
|
|
thanks 2 u all,
i'll try that on thursday.
thnx |
|
|
dgjboy Guest
|
Connect PIC <-> PC, easy option |
Posted: Mon Oct 25, 2004 9:06 am |
|
|
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 |
|
|
|
|
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
|