Searching \ for ' [PIC} Serial Probs - again' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=serial
Search entire site for: 'Serial Probs - again'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] [PIC} Serial Probs - again'
2002\07\07@172320 by Rex Byrns

flavicon
face
Does anyone know where I can find a good web based resource on PIC to PC
rs232?

I have tried 5 different routines for bit banging a 16f84a @ 20mhz

I have not gotten a max232 but am using a transistor circuit that is
reported to work.

I have too many variables here, how to set up hyperterminal, timing etc.

I need to know how to calculate the timing routines and get this inversion
for rs232 more clearly understood.

Thanks

   Rex

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@174004 by Sid Weaver

picon face
For Rex

Do you need to use an RS232.  Why not exchange information with a serout
-serin or am I missing simething ?

Sid

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@174839 by Byron A Jeff

face picon face
On Sun, Jul 07, 2002 at 04:14:25PM -0500, Rex Byrns wrote:
> Does anyone know where I can find a good web based resource on PIC to PC
> rs232?
>
> I have tried 5 different routines for bit banging a 16f84a @ 20mhz

Well let me help you there. Kick the 16F86A to the curb and switch to a
16F628. With its hardware USART, many of the issues you describe will
disappear.

It's one of the reasons on my 16F628 over the 16F84 list:

http://www.finitesite.com/d3jsys/16F628.html

>
> I have not gotten a max232 but am using a transistor circuit that is
> reported to work.
>
> I have too many variables here, how to set up hyperterminal, timing etc.

Test these in isolation by loopback testing.

1) Start with the PC with HT. Attach a loopback serial cable to the serial port
where TX and RX are tied together. Configure HT and the possible the null
modem cable connections until HT echos characters when the cable is plugged in.
Now you have HT configured. Save it and leave it alone.

2) Now extend testing to your level shifter. Connect the TX and RX of the cable
to the level shifter. Then connect the RX and TX of the shifter that goes to
the PIC I/O pins together (of course disconnecting them from the PIC. Power
up and retest. If you get echo's then you're in good shape. If not then debug
the level shifter until it works.

3) Finally put the PIC into the game. You now know that your HT, cable, and
level shifter are all good. So if it doesn't work now, then it's strictly the
PIC that needs to be debugged.

>
> I need to know how to calculate the timing routines and get this inversion
> for rs232 more clearly understood.

Rex,

That's what USARTs are for. They save you all that headache. Simply set the bit
rate and config the USART. You can then simply drop or read bytes from the
RX and TX registers. With a bit of interrupt programming you can make it
completely asyncronous to your main program. Personally I simply drop in
Fr. McGahee's PICUART.ASM code which works perfectly and move along.

Serial isn't interesting enough to reinvent. Get and use the serial hardware
and the bunch of code that already exists to drive it. Take a look on the
PICLIST website for more info:

http://www.piclist.com/techref/microchip/rs232.htm

BAJ

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@175044 by Byron A Jeff

face picon face
On Sun, Jul 07, 2002 at 05:38:39PM -0400, Sid Weaver wrote:
> For Rex
>
> Do you need to use an RS232.  Why not exchange information with a serout
> -serin or am I missing simething ?

I think you're missing a couple of things:

1) Rex is interfacing to a PC serial port. So he needs RS232.

2) I saw no indication that he was using a Basic of any kind. So he doesn't
have serout and serin.

BAJ

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@175517 by Andrew Errington

flavicon
face
Hi,

There are two important things to get your head round:

1) Try to forget about the differenc between 'logic' levels and voltage
levels.  Think in terms of logic levels, and program so that your
voltage levels are correctly derived from them.  In real RS232 a logic
'1' is a low or negative voltage, and a logic '0' is a high (positive)
voltage.  You can use transistors to switch the appropriate voltages, or
you can use a MAX232 (which IIRC inverts the voltage levels for you), or
you can in fact connect an RS232 port directly to a PIC I/O line (with a
current limiting resistor) but only for playing, not for a commercial
product!  When the serial line is idle it is in the logic '1' state.

2) The bit timing is simply 1/baud seconds.  So, 9600bd is 104us.
An incoming RS232 communication (i.e. incoming to your PIC) can happen
at any time.  Once it starts you have to focus your attention on it, so
you must either poll regularly to detect the start bit, or have an
interrupt to detect the start bit (line changes from idle, logic '1', to
logic '0').  Once you detect the start bit you must carefully time the
interval between each bit to sample the input line to get the data.

Hope this helps.

Andy

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@192425 by cdb

flavicon
face
The Square-1 book on serial communications for PICs is very good.

The programs can be downloaded from the website- though naturally it
makes more sense if you have the book as I'm sure the purple routine
with no comments would be a bit hard to follow :)

colin
--
cdb, spam_OUTbodgy1TakeThisOuTspamoptusnet.com.au on 08/07/2002

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@193727 by Rex Byrns

flavicon
face
Thanks,

I read your excellent article a while back on the 16f628 and bought one, but
then as my project has developed along, I want to save that one for the next
project, as it has more IO, etc.

Getting this bit bang to work is turning into a quest, it is getting
personal.  I should have licked it by now, grrrrr.

I am working on a prototype that will definitely use the USART and MAX232
one the next version, but lots of work till I get there.

I have  a question about ground, do I need a ground wire (-5v,pic) connected
to pin 5 on the 9-pin din?  Or, is it chassis ground (PC)?

Thanks again.

{Original Message removed}

2002\07\07@220855 by Dwayne Reid

flavicon
face
At 06:39 PM 7/7/02 -0500, Rex Byrns wrote:
>Thanks,
>
>I have  a question about ground, do I need a ground wire (-5v,pic) connected
>to pin 5 on the 9-pin din?  Or, is it chassis ground (PC)?

Yes - you need a ground wire from pin 5 of the DB9 connector.

dwayne

--
Dwayne Reid   <.....dwaynerKILLspamspam@spam@planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\08@093256 by Byron A Jeff

face picon face
On Sun, Jul 07, 2002 at 06:39:53PM -0500, Rex Byrns wrote:
> Thanks,
>
> I read your excellent article a while back on the 16f628 and bought one, but
> then as my project has developed along, I want to save that one for the next
> project, as it has more IO, etc.
>
> Getting this bit bang to work is turning into a quest, it is getting
> personal.  I should have licked it by now, grrrrr.

Rex,

Trust me, it isn't worth it. See, your time is much much much more valuable
than either the part or the aggravation. Don't have the '628, use it.

>
> I am working on a prototype that will definitely use the USART and MAX232
> one the next version, but lots of work till I get there.

But why spin your wheels when it isn't the ultimate goal? You'll have to spend
some debugging time with the 628 too. No point in doubling your efforts.

>
> I have  a question about ground, do I need a ground wire (-5v,pic) connected
> to pin 5 on the 9-pin din?

Yes. It's a signal ground. Full duplex RS232 requires a minimum of 3 wires:
RX, TX, and GND. And it is pin 5 on the DB9.

>  Or, is it chassis ground (PC)?

Nope. They may be one and the same. However that connection is always made
through pin 5 on the DB9 (pin 7 on the DB25 instead of pin 1: chassis ground)

>
> Thanks again.

No problem.

BAJ

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...