6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 12:42 am

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: [85.19] Tip of the day
PostPosted: Tue Jan 02, 2001 3:52 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #18

Use a 6522's T1 for a time reference, and T2 to count external pulses on PB6 to make a frequency counter.  The 6522's ACR<5> will need to be a 1.  Instead of using T2's interrupt-on-rollover feature, just read the T2 counter, then read it again after a certain amount of time to see how many pulses were counted in that amount of time.  You might want to have T1's rollover cause an interrupt, read T2, and then read it again at the next T1 interrupt.  For period, it might be easier to have T2 interrupt, and then read T1's counter at the interrupt.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:41 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.20] Tip of the day
PostPosted: Wed Jan 03, 2001 5:17 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #19

Do a make-shift watchdog timer for an embedded system with one of the timer/counters in a 6522.  Set it up to interrupt when it rolls over, and have your main program loop keep resetting the counter so it never rolls over as long as things are under control.  If the computer crashes with interrupts disabled, this watchdog scheme won't help unless the 6522's interrupt pin is connected to the 6502's NMI\, and it won't work if a wayward routine fowls up the 6522's setup.  (Maybe the part of the main loop that resets the counter should also re-check the set-up.)  So although it's not 100% fool-proof, it may be close enough.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:43 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.21] Tip of the day
PostPosted: Thu Jan 04, 2001 4:12 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #20

I stumbled on a difference between the CMD and the Rockwell 65c22's.  The first time I used the 65c22 serial ports to pass data from one 65c02 computer to another, I used CMD's.  When I replaced it with a Rockwell, the program no longer worked.  It wouldn't get started with the first byte.  The reason was that I was checking IFR<2> to see if the SR was ready for another byte.  With CMD, this bit means "SR empty", whereas with the Rockwell, it means "8 shifts completed".  These normally mean the same thing, but my program wouldn't start with the Rockwell part because even though the SR was ready, no shifts had occurred yet because I hadn't given it anything to transmit yet.  I ended up using a RAM byte variable as a flag to tell the loop if the first byte had been sent yet.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:44 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.22] Tip of the day
PostPosted: Fri Jan 05, 2001 4:34 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #21

Use the 6502's NMI\ and a 6522's free-running T1 generating interrupts for a real-time clock (RTC).  Even if you don't need time and date, you can use it to time the key de-bouncing and auto repeat, time-out on hardware error (like printer not ready), etc., without using delay loops that keep the computer from doing other things while waiting.  I'm using an NMI every 10ms to update the RTC variables.  It slows the whole system down by about 1%, including looking to see if an alarm is due.  An alarm would tell the computer it's time to do a particular job.  The RTC can of course be stopped if it would cause too much jitter in another job being done in the foreground.

There is same code just over halfway down the long page of my interrupts primer.

We're often told to reserve the NMI for something drastic like power going down; but in most systems the people on this forum are making, what happens in the last milliseconds before power is gone is of no concern.  If you have a system that remembers things when it's off, it probably has batteries and can turn itself off in an orderly fashion.  There's no time to store anything useful on a disc.  If the 6522 used for the RTC goes on the 6502's NMI\, polling for interrupt sources on IRQ\ is simplified, and the RTC never misses a beat when other interrupts hit or are masked.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:45 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.23] Tip of the day
PostPosted: Sat Jan 06, 2001 4:15 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #22

RAM needs Φ2 brought into the chip-select logic to avoid invalid writes.  Neither Φ2 nor R/W need to be brought into the chip-select logic for ROM in a 6502 system, but a 65816 system may not latch the correct bank number if ROM output is not disabled when Φ2 is low.  Φ2 must not be brought into the chip-select logic for I/O ICs that have their own Φ2 input, like the 6522 and 6551.

If your RAM were slow enough to need more time (which is unlikely, since SRAM comes in faster speeds than anything else you'll put on your board), you can apply the Φ2 signal to the WE\ and OE\ signals instead.  This will prevent writes to unintended addresses, and prevent possible bus contention, yet still give the RAM more time to respond to its CS\ input if needed.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:46 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.24] Tip of the day
PostPosted: Mon Jan 08, 2001 5:32 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #23

You can get RAM, ROM, and plenty of 65xx I/O in your 6502 sytem using a single quad 2-input NAND gate 14-pin IC. Here's one way to do it:

Use one NAND to invert A15, the high address bit, to get A15\. Connect A15\ to the CS\ and OE\ of a 27c256 32Kx8 EPROM, giving you ROM from 8000 to FFFF.

Connect A14 to a 62256 32Kx8 SRAM's A14 and OE\ inputs, and use another NAND for the RAM's CS\ input such that

CS\ = NOT(phase_2 AND A15\). This way you use half the 32Kx8 RAM (16KB), from 0000 to 3FFF.

Connect a third NAND's inputs to A14 and A15\ (derived above), and its output to the CS\ inputs of up to ten I/O ICs like the 6522 and 6551 in the 4000-7FFF range. Individual CS inputs of the various ICs can then go to individual address lines A4,A5,...A13. (The 6522's need A0 to A3 for register selects.)

This scheme is more-or-less what I have on my workbench computer with 3 65c22's and 3 65c51's. Four more could be accomodated without any more glue logic. A tradeoff for the simplicity is that some address ranges in the 16K I/O area duplicate others and thus are essentially unusable; but it fits the purpose nicely.

Image

For more simple address-decoding schemes, see the address-decode section of my 6502 primer. (Actually, you will find the above to be more clear there too.) There is also a basic 6502 computer schematic showing the simple address decoding at http://wilsonminesco.com/6502primer/pot ... ml#BAS_CPU .

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.25] Tip of the day
PostPosted: Tue Jan 09, 2001 4:22 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #24

An asymmetrical clock may keep your 6502 system from running as fast as it otherwise could. Connecting a crystal or RC directly to the pins of most 65c02's works for non-critical applications; but to improve the timing margins for higher speeds, use an external clock oscillator running at twice the final speed, and use one flip-flop in a 74HC74 or 74AC74 to divide the frequency by two, making the waveform symmetrical in the process. Connect the Q\ output back to the D input, and the oscillator to the flip-flop's clock input. The flip-flop's Q output becomes your new clock source. Here's the connection:

Image

There's more about clock generation in the chapter by that name in the 6502 primer, at http://wilsonminesco.com/6502primer/ClkGen.html .

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.26] Tip of the day
PostPosted: Wed Jan 10, 2001 4:01 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #25

For easy, compact mass storage, use flash memory with a single power supply voltage and a serial interface. Two large ones I know of are the Atmel AT45D161 2Mx8 (which I've used, and was about $15 in Dec '00), and the AT45DB642 8Mx8 (about $40 in Dec '00). 8Mx8 is about as much as 50 Commodore 64 discs held. This one uses a supply voltage of 2.7 to 3.6 volts; but if you run it on a standard 3.3V, it will be fully compatible with your 5V 6502 system without any level-translation parts because it can tolerate 6V input signals and can output at least 3.1V with a 3.3V supply. These serial flash memories only need four wires for interfacing: clock, serial in, serial out, and chip select. Each additional flash adds one more wire for chip select. There is a write-protect pin for the lowest 128K so you can for example, keep your operating system there so you won't accidentally overwrite it.

Edit, 16 years later: I'm now using the much cheaper 25VF032 4Mx8 SPI flash memory in a tiny SO-8, mounted to tiny PCBs I had made with the SPI-10 interface and am offering for hobbyists. See the front page of my website. There are several other pin-compatible SPI flash ICs that also work on the same tiny board, shown here compared to SD Card and CF card for relative size:

Image

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.27] Tip of the day
PostPosted: Thu Jan 11, 2001 6:02 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #26

If your small computer project needs a keypad, 3 to 5 keys is often enough. I have Up, Down, Yes/Enter/Select/Continue, No/Cancel/Escape/Exit, and Help/Menu/Edit/Special. In the source code, they're called UPKEY, DNKEY, YESKEY, NOKEY, and HLPKEY. Multi-key combinations (as with "shift") would enhance the possibilities. For my workbench computer, text (mostly source code) is entered by RS-232 from the PC; but the keypad allows quick choices while a program is running.

My workbench computer has these buttons on the board itself, but as I gave it commands from the PC on the desk opposite the workbench and turn around toward the workbench to see instant results, there were times that I wanted the keys within reach without having to get up each time; so I also made a remote keypad and added a pin header on the workbench computer to connect it with a long cord, like this:

Image

A small, portable system we did in the late 80's actually used two keys plus a 2-bit gray-code rotary switch to select menu options and even enter text. For text, rotating the knob would run through a list of characters at the cursor position, and the Enter key selected the current character. It was the Dymo label-maker idea, but special-function characters offered insert & delete, backspace, and so on. Pressing Enter and Exit simultaneously was the equivalent of a "help" key. Text entry was kind of slow, but easy for the user to learn. A later product revision used the above 5-key system instead.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Sat Mar 03, 2012 8:41 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.28] Tip of the day
PostPosted: Fri Jan 12, 2001 5:11 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #27

Some of the densest memories may only be available in SOJ or SOIC surface-mount packages. Since there are no wire-wrap sockets for these, solder them to SOJ-to-DIP adapters so you can use a DIP socket in your home-made computer. The adapter is basically a PC board the size of the DIP socket it plugs into. The top has pads to solder the surface-mount IC to, and there are IC pins comming out the bottom. Some of these adapters are much more expensive than others. Mouser carries Aries, which I have found satisfactory at less than 1/4 of the price of equivalent Ironwood parts.

Attachment:
18011.jpg
18011.jpg [ 5.62 KiB | Viewed 11470 times ]

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:51 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.29] Tip of the day
PostPosted: Sat Jan 13, 2001 5:04 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #28

Following up on tip #27, hand-soldering surface-mount IC's with your regular solder and soldering iron is easy. Tin the DIP adapter pads at both ends of one row (like pins 1 & 14 for a 28-pin IC). Set the IC on the adapter. Using one hand to keep it properly positioned, heat the IC's two end pins with the soldering iron to tack them down using only the solder you already applied. This "tacking" is just to hold the IC in place for the next step. Check the positioning after tacking the first corner, and straighten if necessary before doing the other end.

Radio Shack sells flux in a tube. Squeeze a little right onto the pins down the side that's not tacked. This flux is what turns a nearly impossible job into an easy one. Go down the side of the IC with the soldering iron, applying solder. For J-leaded parts, you may need to make sure the tip touches not only the pins, but also the pads on the adapter. It's ok if the iron touches 2 or more pins at once. After applying the solder, go down the side with the iron again, holding the adapter up such that the excess solder runs onto the iron, eliminating bridges. There is no need to pay individual attention to each pin.

Now do the same thing on the first side (which was only solder-tacked at the ends earlier). When you're done, clean off the flux with solvent. Even the first time you try, the result may look like it was done by machine.

Edit, 15 years later: I do it a little easier now, no longer needing the extra flux or the clean-up afterward. I soldered these SOJ-36's with .050" pitch with just a 1/8" chisel tip that covered three pins at a time, and regular 60/40 solder, and no extra flux. I tell the method at viewtopic.php?p=48875#p48875 .


Image

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:52 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.30] Tip of the day
PostPosted: Sun Jan 14, 2001 2:43 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #29

Use the MVN instruction on the 65c802, '816, and '265 to quickly fill a block of memory with a particular byte value.  The source and destination blocks will overlap, but move the block up instead of down, by just one byte.  After some set-up overhead, it will take 7 clocks per byte, meaning 10k can be filled in under 8ms at 10MHz.  What you do is put the desired byte value in the first address, and then have MVN do the iterative work of copying the 1st address to the 2nd, then the 2nd to the 3rd, and so on, until it has been copied to all addresses in the specified range.  (This assumes they are all RAM, or at least act like it.)  Interrupts can be serviced during the process.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:53 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.31] Tip of the day
PostPosted: Mon Jan 15, 2001 3:23 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #30

Use pin headers of .025" square posts on .100" centers to select various hardware options like clock sources and speeds, interrupt connections of various I/O IC's (NMI\ versus IRQ\), memory map configuration, and other things you may want to change occasionally after your board is made.  Make the selection by plugging the little shorting blocks onto various pairs of adjacent pins, shorting them together.  You've probably seen these on various cards that plug into your PC.  It's more reliable and takes less space than DIP switches.  Finding wire-wrap pin headers is not as easy as finding those made to solder into a PC board, but they are available.  If you get them from Digi-Key, you may have to get the shrouded kind and cut off the shrouds.  I managed to get a good collection of shroudless ones at an electronics swap meet.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.32] Tip of the day
PostPosted: Tue Jan 16, 2001 4:01 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #31

For interfacing your home-made computer's I/O to the outside world, it is often practical to use dual-row pin headers (.025" square posts on .100" centers). Female insulation-displacement connectors (IDC's) on ribbon cable plug onto the headers. These are the ones commonly used in PC's for connecting the disc drives. The pin headers fit the .100" perfboard grid, unlike DB-25's. IDC's are quick to connect to ribbon cable, commonly available, and pretty reliable (although not quite as reliable as wires soldered onto connector pins). You don't need to buy the special press to press the ribbon cable onto the IDC. Just use any bench vise. The common IDC sizes are 10, 16, 20, 26, 34, 40, and 50 contacts. Even Radio Shack has DB-9's and -25's that go onto the ribbon cables the same way.


Image Image

Image

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Wed Feb 22, 2012 8:59 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.33] Tip of the day
PostPosted: Wed Jan 17, 2001 3:54 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Tip of the day, #32

Many projects seen on 6502.org have wires soldered to solder-tail IC sockets. I like certain solder-type breadboards for analog work with all its discrete components; but digital work is almost all IC's, and wire-wrap generally works much better. The tool, tightly wrapping clean wire onto clean posts, makes the corners of the posts bite into the wire, producing a chemical weld. If you unwrap, you can sometimes feel the microscopic welds breaking. Since you don't need to get a soldering iron in between pins, the IC sockets can go right together with no board space between. The shorter wires improve operation with high-speed parts. In my 20 years of using WW, it has proven to be 100.00% reliable. I use the OK Industries WSU 30-M manual wrap tool (the blue one near the top in the picture below). To avoid wire breakage at the end of the insulation, the WSU 30-M wraps a couple of turns of insulated wire first. This insulated part can go over a previous WW since it doesn't need to touch the actual post. This way, you can always get 3 wraps on a 2-level post. Individual turns of bare wire should go against each other with no space between and no overlapping. Practice makes perfect. Do not solder them!

Attachment:
OKIndManualWWtools2.jpg
OKIndManualWWtools2.jpg [ 44.82 KiB | Viewed 6285 times ]


The little blue one near the top is the tool I used to WW my workbench computer whose bottom is shown here:

Image

This 4.5 x 6.5" board has 19 ICs plus connectors, keypad, LEDs, DIP headers for discretes, and the piezoelectric beeper, all of which take room. As you can see, you can put parts shoulder to shoulder with no gaps between them, and in most cases, have the wires straight (meaning as short as possible) and without risk of breakage from movement, unlike the situation with soldering wires. Although I've added to it over the years, I used it regularly since originally making it 28+ years ago (as of the time of this edit, Nov 2021), and never had any trouble with it.

The dark-gray drums are ferrite beads put over twisted pairs of wires to reduce unwanted high-frequency digital common-mode signals, forcing them to be differencial. Six of them are in the analog inputs and outputs for the A/D and D/A converters which are very well behaved as a result, in spite of not having a ground plane.

Wire-wrap questions and doubts are answered at http://wilsonminesco.com/6502primer/WireWrap.html .

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Last edited by GARTHWILSON on Mon Mar 05, 2012 5:59 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Search for:
Jump to: