electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
4021 8-Bit Static Shift Register
Post new topic   Reply to topic Moderators: mosc
Page 1 of 2 [36 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2 Next
Author Message
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Mon Sep 27, 2010 9:39 pm    Post subject: 4021 8-Bit Static Shift Register
Subject description: the only chip inside the original NES controller!
Reply with quote  Mark this post and the followings unread

So, i bought this chip on a whim the other day not really knowing how to utilize it. After some quick research i stumbled upon this pdf:

http://www.parallax.com/dl/docs/prod/prop/hydra-ch6all-v1.0.pdf

it amazingly documents the CMOS 4021, how nintendo used it in their NES controller and how the author used it in some system of his own design called "hydra".

I will try to post all the results of my research and experiments utilizing this chip, the nes controller as it interfaces into my current lunetta (and i invite all to do the same)


nescont.jpg
 Description:
 Filesize:  28.03 KB
 Viewed:  32512 Time(s)

nescont.jpg



_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
tjookum



Joined: May 25, 2010
Posts: 360
Location: Netherlands
Audio files: 26

PostPosted: Tue Sep 28, 2010 1:43 am    Post subject: Reply with quote  Mark this post and the followings unread

haha very cool they actually build that entire controller around the 4021. A little while ago someone posted something about the very first pong machines, they were mostly transistors and a few TTL chips(older brother of cmos)

I don't really know much about the 4021 related to music but they are beeing used a lot in microcontroller projects, from the arduino.cc website:
Quote:
Sometimes you'll end up needing more digital input than the 13 pins on your Arduino board can readily handle. Using a parallel to serial shift register allows you collect information from 8 or more switches while only using 3 of the pins on your Arduino.

_________________
There he goes. One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
Hunter S. Thompson
movies
noise
Back to top
View user's profile Send private message
Mikmo



Joined: Dec 01, 2005
Posts: 150
Location: Copenhagen - Denmark

PostPosted: Tue Sep 28, 2010 5:49 am    Post subject: Reply with quote  Mark this post and the followings unread

I'll bet that each switch on the controller is connected to a input pin on the shiftrergister, and then the NES mainbox periodically polls the register.

Simple and efficient

_________________
Stay Cool
Mikael
http://www.mikmo.dk
Back to top
View user's profile Send private message Visit poster's website
-minus-



Joined: Oct 26, 2008
Posts: 787

Audio files: 13

PostPosted: Tue Sep 28, 2010 6:14 am    Post subject: Reply with quote  Mark this post and the followings unread

Well it is a great discovery! And just look at the exterior design of the controller too! NICE!! The only problem with posting this sort of information is those #@!? 'circuit benders' will be disrespecting and destroying a load of nice controllers! Shocked
Back to top
View user's profile Send private message
Mikmo



Joined: Dec 01, 2005
Posts: 150
Location: Copenhagen - Denmark

PostPosted: Tue Sep 28, 2010 1:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

What #@!? 'circuit benders' ???

http://www.mikmo.dk/cbgallery.html

Rolling Eyes Rolling Eyes Rolling Eyes Rolling Eyes

_________________
Stay Cool
Mikael
http://www.mikmo.dk
Back to top
View user's profile Send private message Visit poster's website
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Tue Sep 28, 2010 3:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

heh the only reason i have nes controllers lying around was from my circuit bending days. Im going to a fennesz show tonight, but hopefully tomarrow i'll get a chance to get down an dirty with the 4021 and see if i can figure it out.
_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Tue Sep 28, 2010 6:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

heres another great page about the nes controller:

http://www.mit.edu/~tarvizo/nes-controller.html

--------------------------------------

and after some thought, this is how i plan to attempt to use the nes controller with my lunetta:

According to my research, the NES sends a rather high clock signal to the chip and with each pulse the status of each button is sent back to the nes in a specific order as a data string of high/low/1/0's. (Which i predict will act similar to a 4017 with all the outputs tied via switches.) Whether or not the rate of pulses returned are related to the speed of the clock input (i.e. a division of) is yet to be determined, but i bet it's probable.

I would wire it up like i doodled up in the graphic. The latch output would spit 1 "longer" pulse with each clock pulse in. The Pulse out would send a string of high/lows such as 10110111 or 00110110...but because of how the nes works the data should be flipped with an inverter (if one prefers).
and finally a clock in jack should be wired up too.

I think thats how it would work easiest.


I'll have to think of it a bit more but if it were possible to have 1 out put per button, that would be slick. This i guess would involve how the nes interprets the returned serial data.


nescont1.jpg
 Description:
 Filesize:  22.92 KB
 Viewed:  311 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

nescont1.jpg



_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
-minus-



Joined: Oct 26, 2008
Posts: 787

Audio files: 13

PostPosted: Tue Sep 28, 2010 7:32 pm    Post subject: Reply with quote  Mark this post and the followings unread

Laughing I knew I'd be stirring a wasps nest up mentioning circuit benders! HA HA HA!!!! What's the matter? Didn't you like what Santa made you for Xmas? Laughing Look, I can see the joy it gives many.... but it's a bit over-rated if you ask me Shocked Laughing (not that you DID ask me).RANT ON/ A bit like 'DJ's..... flipping records used to be the mundane job of having a party... along with being the designated bong packer.... not sure how they ended up with 'hero' status! Circuit Benders and DJ's! Laughing Laughing Laughing /RANT OFF

I'll crawl back to bed now...
Back to top
View user's profile Send private message
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Thu Sep 30, 2010 3:30 am    Post subject: Reply with quote  Mark this post and the followings unread

I havent done any physical toying yet (only got one nes controller, dont wanna blow it up) but it turns out the 'latch' jack shown above should be an INPUT not an output.

I guess for the proper function you'd send the latch a slower, divided clock speed and the clock-in a relatively higher speed, for example.

The latch pulse should trigger a 'button check' and return up to 7 data pulses for each button at the incoming clock rate through the pulse/data out jack.

hopefully, more to come...

_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Fri Oct 01, 2010 1:53 am    Post subject: Reply with quote  Mark this post and the followings unread

heres a quick vid of my first experiments with the 4021.




i just read i could use a 4034 to help dissect the 4021 output data to be more easily used.

_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
slacker



Joined: Nov 18, 2007
Posts: 301
Location: England
Audio files: 11
G2 patch files: 1

PostPosted: Fri Oct 01, 2010 10:38 am    Post subject: Reply with quote  Mark this post and the followings unread

That's great.
Back to top
View user's profile Send private message
-minus-



Joined: Oct 26, 2008
Posts: 787

Audio files: 13

PostPosted: Fri Oct 01, 2010 11:20 am    Post subject: Reply with quote  Mark this post and the followings unread

That's a nice looking logic synth you have there! Great colour scheme! I was just wondering though if the D pad on the controller was doing much. Have you noticed a difference in the direction is is pressed or are all directions doing the same thing? Those controllers were a very stylish design, even looking great these days. I think the snes was not as good stylistically.... going off topic here again.....
Back to top
View user's profile Send private message
tjookum



Joined: May 25, 2010
Posts: 360
Location: Netherlands
Audio files: 26

PostPosted: Fri Oct 01, 2010 12:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

sweet stuff stolenfat, really creative use of what most people would considder junk Smile.

Seems like the 4021 and the melodygenerator are a perfect match, good to know. Ill add it to my list of things to keep my eyes open for when searching the local thriftstores.

_________________
There he goes. One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
Hunter S. Thompson
movies
noise
Back to top
View user's profile Send private message
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Fri Oct 01, 2010 5:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
I was just wondering though if the D pad on the controller was doing much. Have you noticed a difference in the direction is is pressed or are all directions doing the same thing?


Well, the d pad does at much as the rest of the buttons, but i'll explain why it seems a little less so:

the bits the 4021 nes controller spits out are in an exact order each time in accordance with the serial input pins of the chips.

A is first B is 2nd... and the d pads are at the end. the A bit for some reason is the strongest, or perhaps the longest, bit and has the most effect, when A and B are pushed together you are basically lengthening the size of the first bit which makes it even stronger (I believe). The d-pads only work one at a time (I THINK) so you cant join them all together to form 1 long giant bit, you end up getting 3 lows and 1 high (if you use an inverter) equaling one small quick bit- which is why it may seem like it isnt doing much to the enable pin of the slacker melgen. To a 4040 divider the d-pad bits have as much effect as the A button bit.
Quote:



nes-data.gif
 Description:
as you can see in this image, the A button bit is way bigger than the rest- prolly to correspond with the latch input. the nes can read this just fine, but it affects the lunetta differently.
 Filesize:  3.47 KB
 Viewed:  329 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

nes-data.gif



_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
loss1234



Joined: Jul 24, 2007
Posts: 1536
Location: nyc
Audio files: 41

PostPosted: Sat Oct 02, 2010 7:59 am    Post subject: Reply with quote  Mark this post and the followings unread

which input on the 4021 is the latch input again?
thanks

_________________
-------------------------------------------- check out various dan music at: http://www.myspace.com/lossnyc
http://www.myspace.com/snazelle
http://www.soundclick.com/lossnyc.htm http://www.indie911.com/dan-snazelle
Back to top
View user's profile Send private message
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Sat Oct 02, 2010 1:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

the latch input is actually just a pin on the controller connector. I havent done any soldering to the 4021, just the connector.

nintendo has it wired up in such a way that it needs a 'latch' pulse, i cant confirm nintendo's controller schematic since i havent busted mine open to take a peak. A regular 4021 seems a bit more complicated and has 3 outputs, and may not need a latch pulse.

its all very well documented in the links above, or google "4021 NES"

helpful? its still a mystery to me kinda Confused

_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
Ajax



Joined: Apr 05, 2010
Posts: 63
Location: San Francisco

PostPosted: Sun Oct 03, 2010 1:15 pm    Post subject: Reply with quote  Mark this post and the followings unread

So, so awesome.
Back to top
View user's profile Send private message
droffset



Joined: Feb 02, 2009
Posts: 515
Location: London area
Audio files: 2

PostPosted: Wed Oct 06, 2010 1:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

Wow!
Really cool use of that old controller and great that you explained what was going on with the hardware. Now I want to try it.

I suppose you could use that schematic and build a similar controller using other buttons? Like arcade buttons or the little tactile momentary ones.

_________________
==================
Check out the FREE Intro to Lunettas Document
https://docs.google.com/document/d/1V9qerry_PsXTZqt_UDx7C-wcuMe_6_gyy6M_MyAgQoA/edit?usp=sharing

Edit: Spelling mistakes.
Back to top
View user's profile Send private message
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Thu Oct 07, 2010 3:29 am    Post subject: Reply with quote  Mark this post and the followings unread

yea dr. offset- i predict that any amount of buttons could be used to set the parallel inputs of the 4021 to either V+ or Ground to get some sort of effect. More research needs to be done, but im at a pause till i get some 4034s

edit: im glad my vids are inspiring you because your vids totally inspired me Very Happy wowowoweee

_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
electri-fire



Joined: Jul 26, 2006
Posts: 536
Location: Dordrecht NL
Audio files: 4
G2 patch files: 4

PostPosted: Wed Oct 13, 2010 10:31 am    Post subject: Reply with quote  Mark this post and the followings unread

Eight NES controller buttons, 8 parallel inputs at the 4021.

Here are sections of the 4021 datasheet , and setup with 8 "set parallel in" switches and "manual load". I made the JPG when I was into making little modules on small circuitboards I got from Inventor.

May it be a visual aid for your builds.

http://electro-music.com/forum/phpbb-files/e_chuck_lunetta_4021_237.jpg
Back to top
View user's profile Send private message
electri-fire



Joined: Jul 26, 2006
Posts: 536
Location: Dordrecht NL
Audio files: 4
G2 patch files: 4

PostPosted: Wed Oct 13, 2010 10:44 am    Post subject: Reply with quote  Mark this post and the followings unread

Not shown: If you want your pattern to recirculate once loaded you need to connect pin 3 (Q8 out) to pin 11 (serial in).

I drew this as a hardwired module just to get my head around the workings of the chip.

Lately I've developed a fondness of the dual 4-bit 4015 shiftregister. Since building on circuitboard (so no panels with switches) I abandoned using the 4021. But hey, the "load parallel" feature with recirculating the bits was nice indeed. Thanks for the reminder.
Back to top
View user's profile Send private message
moordenaar



Joined: Nov 09, 2010
Posts: 16
Location: beep

PostPosted: Wed Nov 10, 2010 2:03 am    Post subject: Reply with quote  Mark this post and the followings unread

First post for me, so hello..


Stolenfat this is great. I've been lurking around, and I'm preparing to build some lunetta stuff. Incorporating a NES controller is just ridiculously cool.

I can inform you that I have checked one of my own NES controllers to this schematic. All was the same EXCEPT R1 and R2 is NOT there. Maybe they are internal in the NES console itself.

Also I can inform you that a SNES controller contains 2 x 4021, and has 12 individual buttons.

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message
tjookum



Joined: May 25, 2010
Posts: 360
Location: Netherlands
Audio files: 26

PostPosted: Wed Nov 10, 2010 3:41 am    Post subject: Reply with quote  Mark this post and the followings unread

hello moordenaar(goede naam!)

Welcome to the forum, and especially the lunetta subsection.

Quote:
Also I can inform you that a SNES controller contains 2 x 4021, and has 12 individual buttons.

ah, thanks for that! Now I am wondering what other nintendo or sega products contain the 4021, raygun anyone?

_________________
There he goes. One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
Hunter S. Thompson
movies
noise
Back to top
View user's profile Send private message
moordenaar



Joined: Nov 09, 2010
Posts: 16
Location: beep

PostPosted: Wed Nov 10, 2010 5:10 am    Post subject: Reply with quote  Mark this post and the followings unread

I don't think the Zapper contains anything else than an IR LED + some resistors..
Back to top
View user's profile Send private message
stolenfat



Joined: Apr 17, 2008
Posts: 476
Location: Sunny Oakland California
Audio files: 1

PostPosted: Wed Nov 10, 2010 11:44 pm    Post subject: Reply with quote  Mark this post and the followings unread

the zapper actually uses the different ports on the controller connector that the usual nes controller doesnt use.
_________________
home made noise and electronic ill-logic
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: mosc
Page 1 of 2 [36 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use