Implement a shift register in a pic?

jpmkm

That Ain't Mayo On My Lip...
Joined
Oct 30, 2001
Messages
5,772
I am looking to build this n64 -> parallel port adapter, and I have everything except the 4006s. I do have some pics, though, and it seems pretty trivial to implement the 33 bit shift register with a pic. I'm no pic master, though, and I really have no idea where to start. I know I have a couple 16f84As and a couple 16f628s as well as a couple other various pics. It seems like I should be able to just read in bits, store them in registers(however I have to arrange it to get 33 bits), and then output those bits. Would that work in this circuit? Thanks guys.
 
I'd suggest just getting the logic chips specified. I'm not even sure that the 40-pin PICs have 33 output lines, and even if they did, you'd end up with a lot of latency (in logic terms) in the shift register, and delays between times when the data on each 8-bit section is valid. (I'm assuming that this is parallel communications we're talking about here.)

long story short, it's probably doable, but it's a duct-tape approach that will probably give less than optimal results, expecially if you want a fast system. That, and if you put a reasonable monetary value on your time, you'll probably be money ahead shelling out a bit of cash for the right parts.

Good luck, eh.
 
I don't need 33 bits of output. From the schematic, it looks like the shift registers are used more as a 33bit delay line than a serial-in, parallel-out type thing. Unless I'm misunderstanding what a shift register does, which is quite possible. The chips are fairly expensive($3 x 2 chips) and I can't get them locally, so I'm looking at at least $10 for two little chips. I already have some pics, so that's why I was trying to go that route.
 
NTE makes a substitute, and you can buy nte parts all over the place. There's a list of distributors here. Find a distributor near you and ask if they have part # NTE4006B. They should be around $3 apiece.
 
Unfortunately I'm still a couple hours away from the closest distributors. I suppose I'll just wait until I go home for christmas break in a couple weeks. Thanks for the information.
 
If you're just looking for a delay line, rather than a parallel device, that does make things a bit easier... what worries me is the need to clock the PIC and somehow keep it in sync with the rest of the circuit. Assuming you've got parts that run on a 20MHz clock, you've got a 200ns execution time per assembly instruction with the PIC. If the communication bus you're working with is slow enough that you can tolerate a couple microseconds of slop, you can probably manage. If you're going to keep things in sync, you're going to have to somehow clock the PIC with a signal from the other circuit--and if the only clock available runs at one cycle per bit to be output, you're probably hosed. It might be possible to have the PIC run on its own clock and monitor an input pin for a clock signal that tells it when to shift the bits... But the PIC's GOTO instruction takes 2 instruction cycles to execute if I remember correctly, and you'll need a few more to select the right bit to send out... So any way you slice it, you're going to have a few microseconds of delay between clock input and data output... and it'll really slow things down, I'm guessing....
Serial logic communications are generally pretty speedy things, and with a modern device, you're probably looking at bit widths of a few tens or hundreds of nanoseconds--so if you're trying to buffer a signal that can only transfer things with bit widths of microseconds (like a PIC) you're out of luck--it just doesn't have the bandwidth.

Anyhow, you know your application better than I do, so it's up to you to figure out wether or not you can make it fly. And if I may ask, where are you located that a few logic parts are hard to come by? I can sympathize if you're in alaska, siberia, or the more rural parts of Brazil, but even then, modern distribution channels are pretty good...

...but then again, if you're on the young side and don't have a credit card to order stuff, that makes it hard too... been there;)

buena suerte, eh
 
I'm out in the middle of fucking nowhere Kirksville, MO(I'm going to school here). My hometown is Kansas City, which has a pretty decent electronics store(electronics supply KC). There are radio shacks all over the damn place, but they have about 5 different chips. KC and St. Louis are both a few hours away, as is any major city in either Iowa or Illinois. I could order them, but shipping costs just about as much as the parts do, and by the time I would get them I might as well wait a few more days and just get them when I go home.

I'm looking to do this for a game controller adapter - to hook a nintendo 64 controller up to a computer, so I don't think it's too terribly high-speed. The circuit does use a trigger to shift the bits, and I was thinking of using an interrupt on the pic for this trigger. I still have a timing issue, though.

Finals are getting close, so there is less and less a chance that I'm actually going to do this. At this point it looks like I'll probably just wait until I get home and get the proper parts. Thanks guys.
 
Ok, I am going to let all of you electronics gurus in on one of the best kept secrets in the industry...samples. I am currently employed for a very, very small medical R&D company. Due to the multitude of prototypes I have worked on, my company would have gone under months ago if we had to pay retail for chips. We only order chips from companies that offer free samples...Texas Instruments, Microchip (PIC maker), Dallas, Maxim-IC, National...just to name a few. All of these companies have links on their website to order free samples. All you have to do is make up a company name and a legitimate application. I literally ordered $1000 worth of chips from TI at 3:30 EST on a monday. They were on my desk the next morning, compliments of UPS overnight delivery...all for free. Also, don't expect to find ANYTHING you need at RadioShack. They stopped selling ICs a long time ago.

I know this is a tangent from the original topic, but don't let the price of chips discourage you from going the easier route, ie digital only. Any time you introduce a uProc into a circuit, you introduce a plethora of unknow variables. Troubleshooting becomes a nightmare.

As an added side note...always use decoupling caps (100nF cap that goes from +5 to ground right next to the IC) on digital IC's!!!!!!!!!!
 
Believe me, getting samples was the first thing I tried. :) I found one chip company who makes a 4006, but they don't offer samples for that particular chip. Other chip companies that do samples didn't have a 4006. I'm not finding anything on NTE's site relating to samples. If anyone can find me a sample of a 4006 I would greatly appreciate it.
 
I would just like to caution all of the [H]ers not to take undue advantage of samples offered by companies. Don't order more samples than you need, the last thing we need is a bunch of people sampling everything left and right. Then they won't give samples any more.
 
You said you're going to school? Does your school happen to have an Electrical Engineering department? Around here at least, you can get chips and parts from them if you need to. It helps to be an EE, but it's worth a shot.
 
fat-tony said:
You said you're going to school? Does your school happen to have an Electrical Engineering department? Around here at least, you can get chips and parts from them if you need to. It helps to be an EE, but it's worth a shot.
I wish. I'm in a fairly small liberal arts school, and we don't have a whole lot of engineering stuff. I know we have an electronics course, though, so I'll look into that. Thanks.
 
*sigh*

samples are intended for people that want to evaluate chips in small numbers and build prototypes, before ordering huge quantities for volume production. They're not meant to be a source of parts for cheap bastards that don't want to spend $10 on a newark order, or companies that would go under if they weren't being indirectly funded by chip companies, like yours seems to be.

And thanks to abuse of free samples, plenty of companies have stopped sending out samples entirely or require some sort of telephone "you're really an engineer right? tell me the innards of your design" interrogation before they'll send anything. Or they'll send out 2 of a part (eg, an op-amp) that you'd find dozens of in a typical design.

bottom line: don't abuse sample services. It ruins things for people that have legitimate reasons to use them.

joecool234 said:
Ok, I am going to let all of you electronics gurus in on one of the best kept secrets in the industry...samples. I am currently employed for a very, very small medical R&D company. Due to the multitude of prototypes I have worked on, my company would have gone under months ago if we had to pay retail for chips. We only order chips from companies that offer free samples...Texas Instruments, Microchip (PIC maker), Dallas, Maxim-IC, National...just to name a few. All of these companies have links on their website to order free samples. All you have to do is make up a company name and a legitimate application. I literally ordered $1000 worth of chips from TI at 3:30 EST on a monday. They were on my desk the next morning, compliments of UPS overnight delivery...all for free. Also, don't expect to find ANYTHING you need at RadioShack. They stopped selling ICs a long time ago.

I know this is a tangent from the original topic, but don't let the price of chips discourage you from going the easier route, ie digital only. Any time you introduce a uProc into a circuit, you introduce a plethora of unknow variables. Troubleshooting becomes a nightmare.

As an added side note...always use decoupling caps (100nF cap that goes from +5 to ground right next to the IC) on digital IC's!!!!!!!!!!
 
If a company like Texas Instruments were to stop offering samples, they would receive no new business. And who is anyone to say that jpmkm isn't using the sample for a legitimate reason? What if he uses a TI chip and actually sees a future in the circuit? Chip companies lose very little money when sending out samples. They stand to lose a lot more if you choose to buy it from another company instead. If it weren't for samples, I would have FAILED my senior design project ($32000 tuition awarded me a $50 budget) or gone broke in the process. And no, not every school is willing to hand out chips to students. My lab manager had the fucking solder locked up for christ sake. Anyways, it appears as if the CD4006 is quite an old chip. Samples of that guy will be pretty impossible to find.
 
Aristarchus said:
If you're going to keep things in sync, you're going to have to somehow clock the PIC with a signal from the other circuit--and if the only clock available runs at one cycle per bit to be output, you're probably hosed.

To do what you suggest (keeping the PIC's clock synched), he needs a Phase Locked Loop (PLL).

In the end it will be cheaper (and easier) to just get the right chips.
 
Back
Top