Author Topic: logic gates fun  (Read 1104 times)

0 Members and 1 Guest are viewing this topic.

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 548
  • Country: gb
logic gates fun
« on: March 07, 2020, 04:08:58 pm »
I've got all the usual logic gates now plus flip-flops, counters and adders.

I've managed to get the UK traffic lights sequence (needed a flip-flop!) and wondered if there are any "puzzles" like that that I could try and solve in order to aid my understanding?

Cheers.
You can release yourself but the only way to go is down!
RJD
 

Offline ebastler

  • Super Contributor
  • ***
  • Posts: 6510
  • Country: de
Re: logic gates fun
« Reply #1 on: March 07, 2020, 04:22:48 pm »
How about electronic dice? Build a state machine which cycles through states 1 to 6 and displays the proper dice pattern for each, using a suitably arranged set of LEDs.

You can either start with a standard binary counter (3 bits wide, i.e. 3 flip-flops, but with a reset from count 5 to 0 or from 6 to 1), followed by a "decoder" made of logic gates to produce the proper LED pattern. Or you can design a state machine which has one flip-flop for each LED (or group of LEDs -- there should be three pairs where 2 LEDs are always on or off together), and which cycles through the proper sequence of states right away. You will need four flip-flops for the latter approach if I am not mistaken, but probably fewer logic gates than for the former design.

You can either build it to step through the dice states manually, one by one, with a button connected to the flip-flop clocks. (You will need to debounce the button!) Or add an oscillator which is on as long as you hold a button down, and lets the dice cycle through its states too quickly to see -- then it will show a "random" roll of the dice whenever you release the button.
 

Offline AVGresponding

  • Super Contributor
  • ***
  • Posts: 4668
  • Country: england
  • Exploring Rabbit Holes Since The 1970s
Re: logic gates fun
« Reply #2 on: March 07, 2020, 04:35:19 pm »
Or a code lock, ie press the correct numbers in the correct order to toggle an LED.

That was one of my earliest ones, good brain exercise!
nuqDaq yuch Dapol?
Addiction count: Agilent-AVO-BlackStar-Brymen-Chauvin Arnoux-Fluke-GenRad-Hameg-HP-Keithley-IsoTech-Mastech-Megger-Metrix-Micronta-Racal-RFL-Siglent-Solartron-Tektronix-Thurlby-Time Electronics-TTi-UniT
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: logic gates fun
« Reply #3 on: March 07, 2020, 05:50:47 pm »
This is a really big project:
https://eater.net/8bit

One of the things you need to build is an EEPROM programmer which is a fun project:


I worked on this for a while until I got bored with prototype boards.  I did build a PCB for the programmer and it worked out well.  There's a LOT to learn in a project like this.

One of the nice things is that the project is modular and prototype boards contain only a specific functionality.  They can, and will, be built and tested one at a time and there's something to learn from each.

If I had a convenient way to build PCBs to replace each prototype board, and I could get them cheaply, I wouldn't even bother with prototype boards.  But the design has to be right, do-overs are expensive.

« Last Edit: March 07, 2020, 07:04:01 pm by rstofer »
 

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 548
  • Country: gb
Re: logic gates fun
« Reply #4 on: March 08, 2020, 10:43:05 am »
Cheers all, I'll have a go!
You can release yourself but the only way to go is down!
RJD
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 28387
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: logic gates fun
« Reply #5 on: March 08, 2020, 11:11:43 am »
Here's one:
Pump Off/ON sense.
Implementation:
Transmit timed burst from a remote tank to a pumphouse. Receiver is a toggling type; each received transmission results in the opposite state: pump ON or OFF
2 probes at different levels in a water tank representing required pump ON/OFF levels.
Each held high by a pullup but pulled low when immersed.

Logic out to transmitter required = high when the upper probe contacts the water level (pump OFF) and logic high remains until the upper probe leaves the water but another logic high must be generated when the lower probe leaves the water (pump ON).

Solution devised with one gate of a 4000 series IC and the transmission burst time set by another 4000 series IC.

Puzzle, what might both the IC's be ?

The solution for one was found here and proved by the interactivity the website provides:
https://tams.informatik.uni-hamburg.de/applets/hades/webdemos/10-gates/00-gates/chapter.html

Transmission burst time set with another once commonly used 4000 series IC.


« Last Edit: March 08, 2020, 11:21:13 am by tautech »
Avid Rabid Hobbyist
Siglent Youtube channel: https://www.youtube.com/@SiglentVideo/videos
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12864
Re: logic gates fun
« Reply #6 on: March 08, 2020, 12:26:08 pm »
One of the things you need to build is an EEPROM programmer which is a fun project:
<snip video>

I worked on this for a while until I got bored with prototype boards.  I did build a PCB for the programmer and it worked out well.  There's a LOT to learn in a project like this.
While learning to use shift registers as I/O expanders is extremely valuable, if you just want bash bytes into 5V programmable NV memory chips without a dedicated programmer so you can get on with whatever project needs the programmed chips, you are better off starting with an Arduino with enough I/O pins to do the job unassisted.  It also helps efficiency if you can avoid the horrors of digitalWrite() so enough contiguous 8 bit ports are desirable.  The Arduino Mega 2560 fills the bill, with more I/O than you can shake a stick at, including five complete eight bit ports that can be used without loosing UART connectivity to the host PC.  Its also got enough program and data memory to make it viable to write a full featured programmer sketch, that supports a variety of different memory sizes, 'speaks' IntelHEX, and supports a file transfer protocol so you can use an off-the-shelf terminal program on the PC to drive it without needing to copy/paste data files to/from the terminal window.

The only further hardware refinements that are worth doing if you need to program several memory chips are to provide a software switched current limited 5V supply to the target memory chip - possibilities include a LDO regulator with an enable pin if you are using external power >5V, or a beefy P-MOSFET and a polyfuse if you are running off USB power, with monitoring of target Vcc via an analog input so you can detect most shorts due to mis-inserted memory chips, a ZIF socket with a switch next to it under its operating lever to signal to the sketch when the socket is locked, and a status LED next to the socket.

However, *If* you want to program old-skool HV programmable EPROMs, (or support low voltage FLASH memory) the small Arduino + shift register as I/O expander approach may well be preferable as it allows you to vary the supply voltage to both the EPROM and the shift registers (over lets say a 3V to 6V range) and only have to level shift four SPI signals between the MCU and the shift registers + whatever control lines you have decided to directly drive.  If you do go down the shift register road, a universal shift register with parallel I/O, e.g 74HC299 is useful for handling the memory data bus.
« Last Edit: March 08, 2020, 12:28:16 pm by Ian.M »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: logic gates fun
« Reply #7 on: March 08, 2020, 04:14:08 pm »
Cheers all, I'll have a go!

There's documentation and videos of every aspect of the project.  It is worth the time to watch ALL of the videos in sequence just to get a feel for the project.  It is a BIG project but it's also a great education in computer architecture and CPU design.  You can come out of this project with a heck of an education!

Parts kits are available and this helps spread the cost over 4 separate projects (plus the programmer).  I suspect this is the easier way to go and it may be easier to get the correct parts.

https://eater.net/8bit/kits
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf