EmbeddedRelated.com
Forums

serial interfacing

Started by Vincent Clerc September 22, 2004
Message
Hello all,
 
I am considering to interface with an LCD.
I have an existing design on a PIC16F628, with three pins free. RB1, RB3, RB5.
 
I don't clearly see how to implement a serial com with those pins since they are not dedicated for this function.
I plan to use one for Data, one for clk and one for CS, but I have no idea of the bit-banging functions to write.
 
I can imagine how to perform the send: just set and clear the data and the appropriate frequency (even though, how to get a stable 9200bps, for example???)
But I have no idea on how to retrieve in formation through the same lines.
 
Do I have to pole on the clk, then start the reading of the data pin each time the clk edge appears?
 
Any information, would be great !
The must would be a snippet of code or a good link on the web??
 
Thanks a lot in advance for any helping hand!
Vincent
 
 



Message

You will have to be a bit more specific with the type of LCD as if it is the general ones with the Hitachi controllers onboard you will need either 7 or 11 pins.  There are some with a serial chip but these are normally an add on to a Hitachi anyway but they have specialised protocols.  So which LCD type is it or what chip do you see at the back of it?

 

Martin

 

From: Vincent Clerc [mailto:v...@idtect.com]
Sent: Wednesday, 22 September 2004 19:35
To: p...@yahoogroups.com
Subject: [piclist] serial interfacing

 

Hello all,

 

I am considering to interface with an LCD.

I have an existing design on a PIC16F628, with three pins free. RB1, RB3, RB5.

 

I don't clearly see how to implement a serial com with those pins since they are not dedicated for this function.

I plan to use one for Data, one for clk and one for CS, but I have no idea of the bit-banging functions to write.

 

I can imagine how to perform the send: just set and clear the data and the appropriate frequency (even though, how to get a stable 9200bps, for example???)

But I have no idea on how to retrieve in formation through the same lines.

 

Do I have to pole on the clk, then start the reading of the data pin each time the clk edge appears?

 

Any information, would be great !

The must would be a snippet of code or a good link on the web??

 

Thanks a lot in advance for any helping hand!

Vincent

 

 



to unsubscribe, go to http://www.yahoogroups.com and follow the instructions




Vincent,

I had the same problem, a project on a 16f628a, 4
IO-pins left, needed 6 pins for the lcd.
I have made an i2c-interface for the lcd with a
PCF8574a-chip (i2c IO-expander), so I ended up with
only using 2 pins (clock and data) from the 16f628a.
I can mail you my assembler-code with the i2c-routines
if you want.

Kees Stenekes

--- Vincent Clerc <> wrote:

> Hello all,
>
> I am considering to interface with an LCD.
> I have an existing design on a PIC16F628, with three
> pins free. RB1,
> RB3, RB5.
>
> I don't clearly see how to implement a serial com
> with those pins since
> they are not dedicated for this function.
> I plan to use one for Data, one for clk and one for
> CS, but I have no
> idea of the bit-banging functions to write.
>
> I can imagine how to perform the send: just set and
> clear the data and
> the appropriate frequency (even though, how to get a
> stable 9200bps, for
> example???)
> But I have no idea on how to retrieve in formation
> through the same
> lines.
>
> Do I have to pole on the clk, then start the reading
> of the data pin
> each time the clk edge appears?
>
> Any information, would be great !
> The must would be a snippet of code or a good link
> on the web??
>
> Thanks a lot in advance for any helping hand!
> Vincent >

__________________________________



Hi Vincent,

Yuo can try building Myke Predko's
2 wire LCD Interface to PICmicro MCUs

the link with the schematic and source code is:
http://www.myke.com/pic-app.htm

Ofcourse if the controller of the
LCD you want to use is
Hitachi HD44780 or compatible.

GREETZ, Jovan

---------- Original Message ----------------------------------
From: "Vincent Clerc" <>
Reply-To:
Date: Wed, 22 Sep 2004 09:35:29 +0200

>---------- Original Message ----------------------------------

>Hello all,
>
>I am considering to interface with an LCD.
>I have an existing design on a PIC16F628, with three pins free. RB1,
>RB3, RB5.
>
>I don't clearly see how to implement a serial com with those pins since
>they are not dedicated for this function.
>I plan to use one for Data, one for clk and one for CS, but I have no
>idea of the bit-banging functions to write.
>
>I can imagine how to perform the send: just set and clear the data and
>the appropriate frequency (even though, how to get a stable 9200bps, for
>example???)
>But I have no idea on how to retrieve in formation through the same
>lines.
>
>Do I have to pole on the clk, then start the reading of the data pin
>each time the clk edge appears?
>
>Any information, would be great !
>The must would be a snippet of code or a good link on the web??
>
>Thanks a lot in advance for any helping hand!
>Vincent >
>




Hi all again,

Actually my LCD is an EA DIPS082HNLED : LCD 2x8 Y-G STN backlight LED
from ORTEK.
Driven by an Hitachi HD44780...

My intention is to drive it with an EDE702 soic chip
(http://www.elabinc.com/ede702.pdf)
The ED702 is only a PIC16c54b programmed to translate an asynchronous
serial flow into a 4-bits HD44780 type command.

This way I only need a data line and a gnd.

Actually, if I clarify my needs: how do I create a 9200 serial output or
input flow with my pic16f628 with GPIO of port B?

Thanks a lot to those who already brought their stones to my
comprehension!!!

Vincent



if you need extra pins you could use 74HC165 for more inputs and 74HC595 for more outputs.
 
There is a picture of my beginings to do this here:
http://www.users.on.net/~symes/projects.htm
 
You just use the SPI interface over three pins to control a 74xx165 or 74xx595 and they are really cheap (AUS$1 each)
 
Of course you do sacrifice speed for extra pins this way.
 
Nigel
----- Original Message -----
From: Kees Stenekes
To: p...@yahoogroups.com
Sent: Wednesday, September 22, 2004 6:58 PM
Subject: Re: [piclist] serial interfacing

Vincent,

I had the same problem, a project on a 16f628a, 4
IO-pins left, needed 6 pins for the lcd.
I have made an i2c-interface for the lcd with a
PCF8574a-chip (i2c IO-expander), so I ended up with
only using 2 pins (clock and data) from the 16f628a.
I can mail you my assembler-code with the i2c-routines
if you want.

Kees Stenekes

--- Vincent Clerc <v...@idtect.com> wrote:

> Hello all,

> I am considering to interface with an LCD.
> I have an existing design on a PIC16F628, with three
> pins free. RB1,
> RB3, RB5.

> I don't clearly see how to implement a serial com
> with those pins since
> they are not dedicated for this function.
> I plan to use one for Data, one for clk and one for
> CS, but I have no
> idea of the bit-banging functions to write.

> I can imagine how to perform the send: just set and
> clear the data and
> the appropriate frequency (even though, how to get a
> stable 9200bps, for
> example???)
> But I have no idea on how to retrieve in formation
> through the same
> lines.

> Do I have to pole on the clk, then start the reading
> of the data pin
> each time the clk edge appears?

> Any information, would be great !
> The must would be a snippet of code or a good link
> on the web??

> Thanks a lot in advance for any helping hand!
> Vincent



           
__________________________________to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

If you can spare some time, you can do a nested project. Reading the
previous post, this idea just popped up. Why dont you use a lower
cost pic like the 84A or 818 as a i2c lcd interface? You can set the
parameters using the i2c bus (type of lcd ) and adjust brightness
using pushbottons. So the required content would be sent to the
driver pic using ascii. Could cut down the i/o to two pins and easily
ported to so many projects!

BG
79 Labs --- In , "martin de lange" <martin_de_lange@x>
wrote:
> You will have to be a bit more specific with the type of LCD as if
it is the
> general ones with the Hitachi controllers onboard you will need
either 7 or
> 11 pins. There are some with a serial chip but these are normally
an add on
> to a Hitachi anyway but they have specialised protocols. So which
LCD type
> is it or what chip do you see at the back of it?
>
> Martin
>
> _____
>
> From: Vincent Clerc [mailto:vincent.clerc@i...]
> Sent: Wednesday, 22 September 2004 19:35
> To:
> Subject: [piclist] serial interfacing
>
> Hello all,
>
> I am considering to interface with an LCD.
> I have an existing design on a PIC16F628, with three pins free.
RB1, RB3,
> RB5.
>
> I don't clearly see how to implement a serial com with those pins
since they
> are not dedicated for this function.
> I plan to use one for Data, one for clk and one for CS, but I have
no idea
> of the bit-banging functions to write.
>
> I can imagine how to perform the send: just set and clear the data
and the
> appropriate frequency (even though, how to get a stable 9200bps, for
> example???)
> But I have no idea on how to retrieve in formation through the same
lines.
>
> Do I have to pole on the clk, then start the reading of the data
pin each
> time the clk edge appears?
>
> Any information, would be great !
> The must would be a snippet of code or a good link on the web??
>
> Thanks a lot in advance for any helping hand!
> Vincent >
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
<http://us.ard.yahoo.com/SIG9vt205s/M)8184.5285298.6392945.300117
6/D=gr
>
oups/S06554205:HM/EXP95924847/A#19498/R=0/SIGthfntfp/*http:
/www.n
> etflix.com/Default?mqso`185352&partidR85298> click here > <http://us.adserver.yahoo.com/l?
M)8184.5285298.6392945.3001176/D=groups/S=
> :HM/A#19498/randy2750062>
>
> _____
>
> > .





The way to get the lowest cost is to use a shift register - about
$.50. I would use the 74HC595 as mentioned in another post. You wire
up the outputs of the SR to the various LCD inputs and wire the SR
inputs to 3 I/O pins on the PIC. Then for programming the LCD, you
simply clock the desired bit pattern into the SR and pulse the load
pin on the SR - poofs, the bits get dumped into the LCD controller.

see the 74HC595 datasheet for details.

shift regs are incredibly usefull and cheap ways to expand I/O on a
PIC. 2 pins allow you to control 8 LEDs, for example.

--- In , "bg3009" <bg3009@y...> wrote:
> If you can spare some time, you can do a nested project. Reading the
> previous post, this idea just popped up. Why dont you use a lower
> cost pic like the 84A or 818 as a i2c lcd interface? You can set the
> parameters using the i2c bus (type of lcd ) and adjust brightness
> using pushbottons. So the required content would be sent to the
> driver pic using ascii. Could cut down the i/o to two pins and easily
> ported to so many projects!
>
> BG
> 79 Labs > --- In , "martin de lange" <martin_de_lange@x>
> wrote:
> > You will have to be a bit more specific with the type of LCD as if
> it is the
> > general ones with the Hitachi controllers onboard you will need
> either 7 or
> > 11 pins. There are some with a serial chip but these are normally
> an add on
> > to a Hitachi anyway but they have specialised protocols. So which
> LCD type
> > is it or what chip do you see at the back of it?
> >
> > Martin
> >
> > _____
> >
> > From: Vincent Clerc [mailto:vincent.clerc@i...]
> > Sent: Wednesday, 22 September 2004 19:35
> > To:
> > Subject: [piclist] serial interfacing
> >
> > Hello all,
> >
> > I am considering to interface with an LCD.
> > I have an existing design on a PIC16F628, with three pins free.
> RB1, RB3,
> > RB5.
> >
> > I don't clearly see how to implement a serial com with those pins
> since they
> > are not dedicated for this function.
> > I plan to use one for Data, one for clk and one for CS, but I have
> no idea
> > of the bit-banging functions to write.
> >
> > I can imagine how to perform the send: just set and clear the data
> and the
> > appropriate frequency (even though, how to get a stable 9200bps, for
> > example???)
> > But I have no idea on how to retrieve in formation through the same
> lines.
> >
> > Do I have to pole on the clk, then start the reading of the data
> pin each
> > time the clk edge appears?
> >
> > Any information, would be great !
> > The must would be a snippet of code or a good link on the web??
> >
> > Thanks a lot in advance for any helping hand!
> > Vincent
> >
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> >
> >
> >
> >
> >
> >
> >
> >
> >
> <http://us.ard.yahoo.com/SIG9vt205s/M)8184.5285298.6392945.300117
> 6/D=gr
> >
> oups/S06554205:HM/EXP95924847/A#19498/R=0/SIGthfntfp/*http:
> /www.n
> > etflix.com/Default?mqso`185352&partidR85298> click here
> >
> >
> > <http://us.adserver.yahoo.com/l?
> M)8184.5285298.6392945.3001176/D=groups/S=
> > :HM/A#19498/randy2750062>
> >
> > _____
> >
> > > .




--- In , "Vincent Clerc" <vincent.clerc@i...>
wrote:
> Actually, if I clarify my needs: how do I create a 9200 serial
output or
> input flow with my pic16f628 with GPIO of port B?

This sure looks like it will work for you...
http://www.piclist.com/techref/microchip/rs232at9600on16F84noint.htm


You can even daisy chain the 74HC595s to get as many in pins as you need (same for 165s). The only drawback is that it takes more time the more pins you have but if you were controlling leds or something I think a few microseconds here and there wouldn't hurt.
 
I don't think there is any limit to the number of shift registers you can daisy chain together, is there?
 
Nigel
----- Original Message -----
From: Phil
To: p...@yahoogroups.com
Sent: Thursday, September 23, 2004 1:55 AM
Subject: [piclist] Re: serial interfacing

The way to get the lowest cost is to use a shift register - about
$.50.  I would use the 74HC595 as mentioned in another post.  You wire
up the outputs of the SR to the various LCD inputs and wire the SR
inputs to 3 I/O pins on the PIC.  Then for programming the LCD, you
simply clock the desired bit pattern into the SR and pulse the load
pin on the SR - poofs, the bits get dumped into the LCD controller.

see the 74HC595 datasheet for details.

shift regs are incredibly usefull and cheap ways to expand I/O on a
PIC.  2 pins allow you to control 8 LEDs, for example.

--- In p...@yahoogroups.com, "bg3009" <bg3009@y...> wrote:
> If you can spare some time, you can do a nested project. Reading the
> previous post, this idea just popped up. Why dont you use a lower
> cost pic like the 84A or 818 as a i2c lcd interface? You can set the
> parameters using the i2c bus (type of lcd ) and adjust brightness
> using pushbottons. So the required content would be sent to the
> driver pic using ascii. Could cut down the i/o to two pins and easily
> ported to so many projects!
>
> BG
> 79 Labs> --- In p...@yahoogroups.com, "martin de lange" <martin_de_lange@x>
> wrote:
> > You will have to be a bit more specific with the type of LCD as if
> it is the
> > general ones with the Hitachi controllers onboard you will need
> either 7 or
> > 11 pins.  There are some with a serial chip but these are normally
> an add on
> > to a Hitachi anyway but they have specialised protocols.  So which
> LCD type
> > is it or what chip do you see at the back of it?
> > 
> > Martin
> > 
> >   _____ 
> >
> > From: Vincent Clerc [mailto:vincent.clerc@i...]
> > Sent: Wednesday, 22 September 2004 19:35
> > To: p...@yahoogroups.com
> > Subject: [piclist] serial interfacing
> > 
> > Hello all,
> > 
> > I am considering to interface with an LCD.
> > I have an existing design on a PIC16F628, with three pins free.
> RB1, RB3,
> > RB5.
> > 
> > I don't clearly see how to implement a serial com with those pins
> since they
> > are not dedicated for this function.
> > I plan to use one for Data, one for clk and one for CS, but I have
> no idea
> > of the bit-banging functions to write.
> > 
> > I can imagine how to perform the send: just set and clear the data
> and the
> > appropriate frequency (even though, how to get a stable 9200bps, for
> > example???)
> > But I have no idea on how to retrieve in formation through the same
> lines.
> > 
> > Do I have to pole on the clk, then start the reading of the data
> pin each
> > time the clk edge appears?
> > 
> > Any information, would be great !
> > The must would be a snippet of code or a good link on the web??
> > 
> > Thanks a lot in advance for any helping hand!
> > Vincent
> > 
> > 
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> >
> >
> >
> >
> >
> >
> >
> > 
> >
> <http://us.ard.yahoo.com/SIG9vt205s/M)8184.5285298.6392945.300117
> 6/D=gr
> >
> oups/S06554205:HM/EXP95924847/A#19498/R=0/SIGthfntfp/*http:
> /www.n
> > etflix.com/Default?mqso`185352&partidR85298> click here
> >
> > 
> > <http://us.adserver.yahoo.com/l?
> M)8184.5285298.6392945.3001176/D=groups/S=
> > :HM/A#19498/randy2750062>
> > 
> >   _____ 
> >
> > > .



to unsubscribe, go to http://www.yahoogroups.com and follow the instructions