6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 9:13 pm

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.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 6283 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  
 Post subject: [85.34] Tip of the day
PostPosted: Thu Jan 18, 2001 4:45 am 
Offline
User avatar

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

The popular intelligent character LCD modules with a parallel interface are inexpensive on the surplus market, and I think you'll find them valuable for your home-made computer project.  The interface is pretty standard except for some pin-out differences and the fact that some need -5V instead of +5V on the viewing angle adjustment pot.  In the power-up routine, you have a choice of a 4- or 8-bit interface method.  There's also E (enable) and RS (register select), bringing the minimum hardware interface requirement to 6 bits.  If you ground the R/W, you will not be able to read data or status from the module, which is ok if you leave enough time to be sure you won't overrun its ability to process the instructions.  The data and RS lines (but not E) can be common to something else like the printer output bits.  The character set includes most of ASCII, but you can also feed it actual bit patterns to make your own custom characters.  It can handle up to 8 special patterns at a time.

See the picture on Tip #40 for a 1x16 intelligent character LCD.

See sample code at http://wilsonminesco.com/6502primer/LCDcode.asm , and connection diagram at http://wilsonminesco.com/6502primer/potpourri.html#LCD .

_________________
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:53 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.35] Tip of the day
PostPosted: Fri Jan 19, 2001 3:00 am 
Offline
User avatar

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

Use a pocket-sized loose-leaf ring-type binder for quick-reference information on your computer project. I always keep mine within reach at the workbench to look up I/O connector pin-outs, selectable hardware options, and other hardware info. Two rings seems common for 3x5 cards. Mine has 6 rings and came with 3x5 notebook-type paper. Software documentation is very complete but is all kept in text files on the PC where the text editor's search function can find things quickly, instead of being in the little quick-reference binder.

Image

This one is very full, although it has other modules' info and not just the workbench computer's.

I don't find it necessary, practical, or even helpful to have the whole computer's diagram in a single big sheet. The tiniest I had to draw anything to get it on one of these 3x5" pages was for the PIC programmer which allows setting the Vcc on the PIC for 2V to 6V, and it wasn't hard with a .3mm mechanical pencil.

_________________
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:12 am, edited 2 times in total.

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

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

Debugging.  Part I.  Hardware.  You can use some very simple tools to debug your new home-made computer without expensive logic analyzers, emulators, simulators, or debuggers.  Starting with a longish routine to actually do something useful will usually disappoint, as it probably won't run the first time and you won't have the means to debug it yet.  Start with a very simple routine to just toggle an output bit, for example.  If the computer doesn't do anything at all, first use your oscilloscope to see if you get a good reset.  (See tip #3.)  Then make sure you have a clean phase 2 toggling at the expected frequency.  (Use the scope probes' x10 setting for all but the lowest frequency work.)  Are address and data lines toggling?  If they sometimes don't go as high or as low as expected, maybe there's bus contention.  If an IC's output voltage never gets very close to power or ground, did you forget to hook one of these up to it?  Is IRQ or NMI going down unexpectedly?  Is the power supply current approximately what you expected?  There's also the single-cycler clock source shown about 3/4 of the way down the clock-generation page of the 6502 primer.  If the hardware seems fine, move on to software.  (to be continued)

_________________
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 9:12 am, edited 2 times in total.

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

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

Debugging. Part II. Software. A simple effective debugging tool is a piezoelectric beeper, the kind that's .010"-.020" thick and needs an AC signal in order to sound.

Image

The one at the top is in a black plastic housing that's about 3/8" thick and improves the volume if there's no sounding board. The small one is 3/4" diameter and .012" thick. The bigger one that's tarnished from skin oils and soldering at four points around the edge (but would still work perfectly fine) is 1-3/8" diameter and about .020" thick.

They can be taped or soldered onto the breaboard, so the entire breadboard acts as a sounding board. I've even used scissors to cut them down to fit a tight space, like this one on the back of a mostly analog breadboard with a microcontroller on it:
Image

Very simple beep and delay routines should run on the first try. Write about 3 beep routines of different frequencies and maybe different durations so you can tell them apart. These should save the processor registers like an ISR does. Once these work, call them at appropriate places in your next routine. Put delays between the beeps to make them easier to separate when you hear them. Does it make it to point A before crashing? How about point B? Does the loop that point C is in get run the right number of times? Keep re-assembling and trying your code, each time narrowing down the problem area. LEDs can also be used to monitor the progress; but the software-driven beeper's sound "signature" assures you that the output is not a random effect of a crash. As code development advances, you might incorporate other debugging routines; but in the absence of expensive debugging tools, the lowly beep is indispensable as a "crash-finder".

Without a digital-storage oscilloscope, you can still study a pulse train output by making the software repeat in a loop for an analog scope. For real-time, things that cannot be slowed down to deliver a beep can be watched on the scope with probes on various I/O lines. Sometimes it can be a challenge to get the triggering and sweep rate just right, but it's usually doable. (to be continued)

_________________
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 9:11 am, edited 1 time in total.

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

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

Debugging.  Part III.  An ounce of prevention... Take a building-block approach.  Start with the really simple stuff, then use those things as components to build or debug more advanced components, and so on.  The job is only complicated if you don't break it down into manageable chunks, conquer them, and then put them together in steps.  Working for small, low-budget outfits, I have found that the lack of expensive debugging tools actually teaches you to write better code.  You can't have the attitude that "I'll whip out this code in record time and debug it later."  Out of necessity, I've become more structured and neat in my programming, documenting everything thoroughly, making the code as readable as I know how, and proofreading.  Large companies are finally starting to see the value in this, and the industry magazines have recently had some articles on code inspection and having committees of the programmers' peers proofread the code.  I sometimes catch bugs when further commenting code that's already working but not exhaustively tested yet.  I comment as if trying to explain it to someone else who hasn't been following my train of though on it.  (If I come back to change it a year later, I'll need the comments anyway.)  As a result of this madness, no user has ever found a software bug in any product or automated test equipment I programmed.  The projects have had from 700 to 10,500 lines of code.  BTW, using a lines-of-code-per-day benchmark of programming performance is a sure way to end up with inefficient, buggy code that's hard to figure out and fix or modify later.  I once worked with a programmer who typed non-stop.  I always wondered what he was typing.  After he left the company, I had to fix a 4-page routine he wrote.  When I was done, it was down to a half page, bug-free, clearer, faster, and did more with less memory.  (Eventually most of what he wrote had to be redone.)

_________________
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 9:13 am, edited 1 time in total.

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

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

Don't ignore your assembler' more advanced features.  Macros especially make assembly code more concise, even hiding the ugly details of conditional assembly based on input parameters or other factors.  Since there's no run-time overhead, macros don't slow the execution down like JSR and RTS do, and a macro may be worth defining even if you only use it once.  The simple example

Code:
        DISPLAY_IMM    "Press YES key to continue"
        WAIT_FOR_KEY   YESKEY


could display the message and then wait in a loop until the user presses the Yes/Continue key.  The first line, "display immediate", indicates that the parameter is the actual string to display and not just an address.  It might assemble

Code:
        JSR    DISP_QUOTE
        BYTE   25             ; (the string length)
        BYTE   "Press YES key to continue"


where the first line calls a subroutine, which uses the return address to pick up the next byte which tells how many bytes following make up the string that is to be displayed, gets the string, and advances the return address past the data to the next actual instruction.  The WAIT_FOR_KEY line might assemble

Code:
ReScan: JSR    SCAN_KEYPAD
        CMP    #YESKEY
        BNE    ReScan


Suddenly assembly is a higher-level language than you thought.  A macro may replace hundreds of lines.  A complex piece of code may be much more clear with certain portions pre-defined as macros with descriptive names.  A macro's parameter list can be as long as you want, as long as it all fits on one line of usually 255 characters.  Most assemblers allow nested macros.  The assembler's list code output file shows exactly what got assembled.

Edit, 7/28/12:  I put an article on my website about macros, focusing on program structures to get better control of your project.  It is posted at http://wilsonminesco.com/StructureMacros/index.html and has accompanying working source code.  Here is probably the simplest of the program structures:
Code:
        CMP  #14
        IF_EQ            ; clear enough that it really needs no comments
           <actions>
           <actions>
           <actions>
        END_IF
No label is needed.  It assembles exactly what you would do by hand, with no penalties, just better readability.  It can be nested many levels deep too, and each branch instruction will go to the right place.

_________________
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 9:13 am, edited 1 time in total.

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

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

Some of you have mentioned using PIC microcontrollers.  Macros can again make your PIC code a little easier in perhaps an unexpected way.  Define macros named after 65c02 mnemonics.  For example, disabling interrupts on the PIC requires a loop because if an interrupt hits during the instruction to disable interrupts (clearing GIE), the interrupt service will still go forward, restoring the ability to interrupt when done.  It must go back through the loop again if it finds that interrupts are not disabled after the instruction to disable them.  Put the loop in a macro, and name it SEI, like the two-clock 6502 instruction that does what the PIC can't insure in less than 12 clocks.

Doing a conditional branch on the PIC takes two instructions: one to test the flag, whether zero, carry, etc and skip around the branch instruction if appropriate, plus the actual GOTO instruction.  Define macros in your PIC code and call them BEQ, BNE, BMI, BPL, etc like the 6502 mnemonics.  In this example, the PIC takes 8-12 clocks to do what the 6502 does in 2-3.  This is often the case.  In my experience, the 65c02 can do a job generally in half the number of clocks it takes the PIC to do the same job.  (Beware when Microchip tells you their PICs have single-cycle instructions—when they say one cycle, they really mean an instruction cycle, which is 4 clock cycles.  The clock info here is unrelated to macros—just a plug for the '02.)

_________________
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 9:14 am, edited 1 time in total.

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

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

Crashing is common during development and the reset button gets used. Most crashes do not make the computer write garbage all over your program so it's not usually necessary to re-load a RAM-resident program to get it going again. Instead of having your ROMed reset routine start over new every time, put in a choice to either

A. start new,
B. keep the old program but don't run it yet, or
C. keep the old and even set it up again and run it so you don't have to re-issue instructions and parameters for the program to process to get things going again.

You may not need choice B if you're only doing assembly language unless the target computer itself is doing the assembling and you need for it to keep the old pointers, tables, etc..

My workbench computer has the LCD ask "New/Old/Init-Ap?" The choice is made using the first 3 keys of the 5-key keypad. Init-Ap executes a routine at the address I stored in the Init-Ap variable when I loaded the program. (The variable is initialized to point to a do-nothing routine if you choose option A above.) Without fixing the cause of the crash, 2 seconds may be all that's needed to reset and restart the program to try a different condition to see how it behaves. (Don't you wish Windoze were so considerate of your time?!)

Here's the display of choices on mine. The three correspond to the three keys in the left column in the keypad.


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 Sat Mar 03, 2012 8:52 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.42] Tip of the day
PostPosted: Fri Jan 26, 2001 3:16 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
I've reached the end of the tips I can think of that can be more-or-less adequately communicated without diagrams or lines of code.  Edit:  Tips resume 2/3 of the way down page 4 of this topic, with Tip #41, "Getting started," with considerations that will save the newbie a lot of indirection and frustration.  And since we're not on the Delphi forum anymore and I can add photos, diagrams, and code, I might continue to slowly add tips.

Although this topic has increased forum traffic, there have not been any responses.  Everyone seems to be taking it in silently.  I'm not particularly disappointed, but I told Mike that it was not my intention for this to become my own personal column.  He was quite supportive.

I would like to see others add their own tips from their work with other 65-family parts.  This may include the 65134, 65265, 65151, and other microcontrollers, 6508, 6509, 6510, 65F11, and other variations of the 6502 microprocessor, the 6523 & 6525 TPI's, 6526 CIA, 6532 RIOT, 6552 dual ACIA, 6529 IOD, 6590 EBC, 6545 CRTC, 6560, 6561, 6567, 6569, 6572, and 6573 VIC's, 6582 SID, and so on.  Most of us have no experience at all with many of these and may never see a lot of them, but your tip might spark an idea and save the day for someone in an unexpected way.  Give it a try.

Almost all of my tips were from personal experience.  I have broken some rules of writing trying to limit the length of some of them.  Everyone will have their own style, but I would only suggest being sure of what you write.  Who knows—I might challenge you on the tip (or so it may seem).  That's not to make life difficult, but just to learn more or make sure I'm understanding something right.  Go for it.

Edit, Apr 26, 2012: I have a 6502 primer, with the index at http://wilsonminesco.com/6502primer/index.html , for those wanting to build their own 6502 computer.

_________________
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:18 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.43] Tip of the day
PostPosted: Sat Jan 27, 2001 7:03 pm 
Offline

Joined: Fri Aug 30, 2002 3:06 pm
Posts: 124
Location: Colorado
Garth,
You've done a great job with your tips!

Here's one from me:
For address decoding on a not-real-fast design, try using a 74LS145 instead of an LS138. the '145 has open collector outputs, which means you can "wire-OR" the outputs to change the memory mapping. For example, configure it so that outputs 0-7 are each an 8K block. By simply connecting (for example) 0 and 1 together, you now have a 16K decoded block. Use male Berg-type pins with those little black jumpers to make quick changes.

This approach was hotly debated some months ago in the "PCB project" discussion. Because there is no active pullup on an O.C. signal, the signal integrity may not be good enough for higher clock speeds. What is "higher"?? Well, it depends on several things, such as the value of the pullup resistor, the loading on the signal, etc. I've used this approach at 1.84 MHz with no problems, and it should work at 2 or 3 times that speed.

Pete


Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.44] Tip of the day
PostPosted: Wed Jan 31, 2001 3:40 pm 
Offline

Joined: Sun Oct 06, 2002 3:46 pm
Posts: 50
All the boards I got from Rockwell & DynaTem had a 4MHZ crystal & a 74HC74 to divide it to 1MHZ. The DynaTem boards also had jumpers so that the board could run at 2MHZ.
Until I read your Tip I really never thought of connecting a crystal directly to the 6502. I remeber looking at the DATA sheet & seeing that it had an onboard oscillator, but the examples I had didn't use it that way.

Ted Melton


Report this post
Top
 Profile  
Reply with quote  
 Post subject: [85.45] Tip of the day
PostPosted: Wed Jan 31, 2001 3:45 pm 
Offline

Joined: Sun Oct 06, 2002 3:46 pm
Posts: 50
Do you have any website references to these serial flashparts ? I had thought about using flash parts, but I haven't had the time to do the research. I think that would be a good solution for industrial controllers & data acqusition.
Ted Melton


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 6 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: