From: "Roger Hamlett"
References: <email@example.com> <1xgR9.2310$tQ1.firstname.lastname@example.org> <email@example.com>
Subject: Re: RS232 newbie - in need of assistance!
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
Date: Fri, 3 Jan 2003 17:12:27 -0000
NNTP-Posting-Date: Fri, 03 Jan 2003 17:11:58 GMT
Organization: ntl Cablemodem News Service
"Matt Foster" wrote in message
> I took it out as requested!
Now't much wrong with this. :-)
Do you need RTS/CTS?. Though it does no harm to have them, these are extra
tracks and signals to control. If the unit is only going to transmit data,
you don't need the Sin connection (receiving serial involves more work to
get the timing right, than simply sending...). Since the 16F84, doesn't have
a UART, it is _very_ difficult to code simultaneous receive/transmit (hence
probably the use of the RTS/CTS lines, but if reception is not needed, this
all becomes redundant). Have you considered using the MAX232A (smaller
caps - 0.1uF), or the Max 233 (no caps at all). Reduces the component count.
The 'minimum' part count configuration (and probably cost...), would be to
use the PIC12C508 instead (only 8 pins), and have just the five switch
connections, and serial out (no LED). This has an internal RC oscillator,
removing the need for the crystal as well!. If you want a 'data sent' LED,
you could connect this to the transmit pin as well. C1, and the LED, both
show lines across them (presumably an artefact of the drawing, otherwise
these are shorted out...).
The MCLR line, should ideally have a resistor between it an the supply rail
(50 to 100 ohms). You can (will) get away without this, but generally there
is a risk associated with attaching any signal input directly to a pin.
The biggest actual 'fault', is the wiring of the switches. You need
resistors pulling the input pins to one rail (the PIC actually has these
internally available on port B, pulling the signals to the 5v line), and
then the switches need to pull the signals the other way (allowing a change
to be detected). Hence the switches actually need to wire to the 0v
connection, not the 5v line as shown, or you have to provide your own
'pull down' resistors on the inputs.
Tell me what serial strings you want the PIC to send for the switches being
on/off, and I'll write you a crude routine to do this. I'd suggest the unit
just sending the status of all five inputs, in the form of a simple pair of
hex digits, when any input changes, allowing the status of all the switches
to be seen. With the serial input, as a real 'frill', you could have the
code set to give a similar return if any data is seen on the Sin line (but
this involves a lot more work, unless this line is connected to the INT
E-mail me directly if you want.
> "PCS Electronics" wrote in
> message news:HAiR9.2322$tQ1.firstname.lastname@example.org...
> > > AFAIK, the OP still wants to stay with the serial port because he
> > > wants the challenge and, ostensibly, because that's one of the
> > > instructor's requirements.
> > >
> > > Reading a [bidirectional] parallel port is a no-brainer, while
> > > formatting data and sending it to the RX DATA input of an RS-232
> > > port is a little more challenging, especially doing it in hardware.
> > >
> > > I don't think the price of the solution matters much (it's not going
> > > to be much anyway, maybe 10 or 20 bucks) it's the exercise which is
> > > important.
> > >
> > > Yes, no code required to do the data generation and transmission.
> > > ---
> > >
> > > John Fields
> > > Professional circuit designer
> > > http://www.austininstruments.com
> > All right than. Actually, Matt, the circuit is not that bad for the
> > Except for that 100K resistor. Take it out.
> > I'm not familiar with PIC, but attaching switches directly to Vcc or
> > could be problematic. It might be better to connect them via resistors
> > damage to the drivers.
> > Any thoughts from PIC experts, anyone?
> > Good luck with the project.
> > Marko
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.434 / Virus Database: 243 - Release Date: 25/12/2002