Quick question about logic switching FET's..

Status
Not open for further replies.

Blueteeth

Well-Known Member
Hi,

My basic knowledge of FET's really isn't that good, but I'm doing some research, so don't worry, I'm not after theory, google has (almost) everything. If you want to skip the waffle, see below.

I have an app dealing with ttl logic. I need to have a 2-input selector for an input pin, one that can be disabled, tristate output. Its basically an over complicated 'logic' circuit for interfacing LCD's via serial SPI-like connection, using a shift-register. It'll be able to deal with both 4 and 8 bit modes. I need to switch the RS line from being on the serial data (set after data byte is sent)...to being one of the SR's outputs. (4-bit mode, send two bytes, with RS being one of the unused data bits).

Sounds complicated, but I can't for the life of me find a single logic IC that will do everything. So...considering I only need to 'switch' one line here Would two FET's safice? (also using a buffer to disable the 4-unused inputs, to prevent screw ups). A single buffer disables all inputs to the LCD making them high-Z, allow for a direct parallel connection (straight through)...that gives 3 options for interfacing.

Aside from the app, I'm also just curious...of course CMOS is made of MOSFETS, so for very small apps, could a single one of these act as a 'tristate' switch? That is...enable...and the output becaomes the input, 1 or 0, and disable, and its output is high Z. I mean, I'm pretty sure thats the case, just need conformation. Might come in handy for routing single data lines when I can't get hold of an IC.

Cheers,

Blueteeth.
 
A block diagram might be helpful.
 
Hi Ron,

As suggested heres a rough diagram. Sort of half bway between a block and a schem, but I tihnk you'll get the general idea. Sorry for the quality, 5 minutes + MSpaint

I know I'm over complilcating this...but its for a sort of 'education' board, so it needs to use both interfaces. Plus, when using 8-bit for SPI, one needs to turn off the SPI module, in order to set the 'dataout' high/low for data/command, then strobe. With 4-bit mode, two bytes are sent, both include the RS 'bit'. Same SR is used for both ways, just need to switch the RS line between the 'data in' and one of the SR outputs....and possibly disable D3-D0 on the LCD (otherwise, one could still write to those bits from the shiftregister, and 'may' accidently write a '1' to one of them during setup, ergo...no 4-bit mode).

The buffer isn't really needed, but it makes things look neater, plus, I have about 10 here doing nothing.

Blueteeth
 

Attachments

  • 48-bitmodes.JPG
    25.8 KB · Views: 189
So what is the part in question? Is it just the 2:1 MUX with tristate capability? Two MOSFETs won't satisfy that requirement unless you have a gate drive voltage that will go at least 5 volts above your logic supply (e.g., 10 volts if you are using 5 volt logic). There are analog switch ICs which would work, and there are several (I think) noninverting tristate buffers that would work.
EDIT: The problem with tristate buffer ICs is that the tristate control is common to all the buffers, at least in HC365 that I looked at. I found NL7SZ18, which should work. It's a surface mount part, and it's tiny.
 
Last edited:
Hi agian,

Yeah its the mux thats the issue. I did look at analogue switches...I could just common the inputs of two of them, and have two outputs. I also have a aspare 4-bit buffer...because it comes with 2, using the 74HC244, each with its own enable. I'm just working out how to use just two jumpers to change all the settings...

And thats why I asked about FET's, I knew there was a catch Well I guess I'll stick with logic. I could of course abandon the buffer, because the SR I have has its own tristate output, and also a inverted 'Q7', but then it really does get complicated, dealing with how I connect the SR to the LCD (Q7->D7 or Q7->DO?) and thats to do with whether the SPI is MSB first...etc..etc..

As I said, its probably pointless, but its just one of those things that bugs me, whether I need it or not, I'd like to be able to solve the problem..otherwise it jsut plays on my mind, sad really.

I'm sure i'll solve it, just thought I'd ask in here, cus you guys know your stuff.

Cheers Ron,

Blueteeth
 
I was just thinking, if MOSFETS would need a gate voltage higher than the logic voltage...how do CMOS chips do it? This is purely for curiosity..I'll google..
 
Blueteeth said:
I was just thinking, if MOSFETS would need a gate voltage higher than the logic voltage...how do CMOS chips do it? This is purely for curiosity..I'll google..

THat's mainly for NMOSs where the drain is connected to +V. CMOS chips are complimentary, hence the C. THey use both PMOS and NMOS. PMOS has no trouble switching when it's on the high side.
 
Well, you could use a 74HC4053...

Or you could consider a 74HC595 or two. If you tie Q7H' output to the SRCLR input a high bit clocked through will clear the shift register.

Tying one of the Q outputs to the RCLK input will load the register with previously shifted data.

This way you can chain two together for a 16 bit data frame that gives you all the control you need with out the extraneous logic.

D.
 

Attachments

  • sn74hc595.pdf
    658.4 KB · Views: 273
dknguyen, thanks for the reply!

I get it now...just went through a few of those lecture notes from universities they have freely available (google), saw the push-pull type configuration. Still out of my depth, but I'll go through it..very interesting!

cadstarsucks,

Hey, I am currently using the 595. Even though the 74HC164 would do, as it doesn't need a 'latch', since the LCD only reads in when the strobe goes from high, to low, but considering the 595 latches on low-high, and the fact it has tristate output..its a winner. The chaining of SR's isn't something I thought about, at least not for this app The idea is to send one byte per instruciton for 8-bit mode, but send two for 4-bit mode..
Nowthinking, they both will have tristate (complete isolation for when 'parallel connection is used), I could just disable the second SR for 8-bit mode..but use them both for 4-bit mode..but then it gets really tricky...

I'll definately look into it though...might be able to use the SR's in 'parallel'!! That is, both connected to the LCD, one with all outputs to the LCD (q7..q0 -> D7..D0) and one with (q7-q4 -> D7-D4, and Q3 -> RS). Their 'output enables' could be set by jumpers, one or the other (never both).

Theres still the problem of disconnecting the 'serial data' line from the RS when its in 8-bit mode, to using 4-bit mode..thats where I need a 'conduct/don't conduct' type switch..(simple BJT transistor? remember, its not bidirecitonal..) .again contolled by a jumper. Ok thinking about it, thats a bloody good idea! Cheers man.

I indeed happen to have some 4053's here! (not ttl though, but good enough for breadboarding), I tihnk I'll get cracking with some tests tomorrow. I can't believe how difficult this has been, probably easier just to use a micro to control the LCD, for SPI (both 4-bit and 8-bit mode from the user perspective) UART...I2C...bah.but thats all too easy

Thanks cadstarsucks, great help, lots and lots of idea's to work with. And thankyou dknguyen for getting me to start learning about something again.


Blueteeth
 
Blueteeth said:
Thanks cadstarsucks, great help, lots and lots of idea's to work with. And thankyou dknguyen for getting me to start learning about something again.
Blueteeth
Actually I was thinking you could use shift outputs for the RS too, but I am not really sure offhand what the line does.

D.
 
The RS line on the LCD sets between command and instruction. Because I'm using a shift register, its one-way, so theres no point in me trying to 'read' the display, so R/W is tied to ground. Essentially theres just 8 data lines, and two control lines. With the 'E' strobe being one of the inputs, I'm left with 9 lines to control...thats why 8-bit mode isn't that difficult, we just use the input of the first shiftregister as the 9'th bit, but that means setting/clearing it after the transfer...which for 'some' SPI masters, isn't always easy (easy for PIC and AVR's though).

Cascading two SR's is of course an option, but that would mean sending two bytes, regardless, negating the need for 8-bit mode. However, I have cascaded two SR's, because the whole system will also workwith graphic LCD's, which have two or more control lines than the character LCD's.

One very quick question remains: When using 4-bit mode, can the lower 4 bits, normally left unconnected, be left connected to the SR, providing they are 0 during setup? That way, I could switch the lines I need for use with 4-bit mode, allowing two bytes to be sent, without having an extra buffer to make these inputs high-Z.

Blueteeth
 
Last edited:
In 4 BIT mode, the LCD controller doesn't care about the lower 4 data pins. I would just use the LCD in 4 bit more and run E off the the RCLK line. I think that would work just fine as long as you don't read RS. You clock the 5 bits (data plus RS). Only 1 '595 needed. You might need to strobe RCLK/E twice depending on 44780 timing.

I wouldn't bother with 8 bit mode since 4 bit isn't much of a penalty - think about how many times per second you will update the display. Since it has to be readable by humans, not very often - maybe every 100 mS at the fastest?

By the way, it's a good idea to put a 1K or so resister in series with the inputs to the 595 and a 100K or greater to ground. this prevents inadvertent destruction of the 595.
 

Hey philba,

I did think of just leaving it in 4 bit mode, but like many problems, it just got to a point where I wanted to solve it, as opposed to 'need it'. But I have a schem now, using the 595 and 4053 as suggested (Thanks to cadstarsucks for getting me to have another look at using it) looks like it'll work like a charm). I'll decide whether to leave it in 4-bit mode when I get building it, after all, less chips = less work You're completely right about the update rate of the display, and I tend to use timer interupt delays, as opposed to loops between LCD commands/data, so not much over head at all.

Whether or not I decide to add my 128x64 onto the 'shiftregister bus', I don't know, as that would require an 8 bit transfer as well as an extra SR for the many control bits...... as always my little project has ballooned into something horrendous Still, should look nice on a big project board, without being restricted to one type of LCD.

I am curious about the resistors though. I know protection resistors are generally a good idea, but I wasn't sure what kind of, if any, internal pull-ups/downs these modules have. I guess none, or pull-downs given the fact you recommended 100k's to gnd. I'll add in the 1k's though, probably a good idea just incase. Thanks again, great idea's people,

Blueteeth
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…