hi all

now i've got my z80 that read a program from the EPROM and print sokme animations to an LCD. What could be a next step to learn something more ? Adding a ram chip is mi forst tought, so i could then use also Call instructions. But i don't really now what the best chip for this.. Is there some EPROM with some RAM inside in the same chip ?....

Then , could i interface my circuit in some way with the PC ? could i talk by USB / PS2(i2c) or IDE ? Could i do something useful ?


hehe :) im a children :)

B7
Posted on 2004-02-07 14:08:18 by Bit7
>What could be a next step to learn something more ? Adding a ram chip is mi forst >tought, so i could then use also Call instructions. But i don't really now what the >best chip for this..

?? using ram to execute call???
i dont understand that.

>Is there some EPROM with some RAM inside in the same >chip ?....

i guess no.

>Then , could i interface my circuit in some way with the PC ? could i talk by USB / >PS2(i2c) or IDE ? Could i do something useful ?

yes of course (for usb), but for your sake, i suggest to use available controller from many vendor, almost or got to say all of them are in smd package. that one reason that i dont do it long ago. for ps2, maybe could applied directly. IDE need port expander i thought.

well, i could be wrong here :)
Posted on 2004-02-07 20:37:54 by dion
Add switches and pushbuttons.

The simplest switch interface is a tristate buffer, one for each switch. Enable outputs on specific I/O address (or range of I/O addresses.) Make sure the LCD uses a different I/O address. Add resistors to make buffer input high when switch is open, and low when switch is closed. You can read up to 8 switches with one IN instruction.

Of course, you can replace the buffers with a parallel interface chip.

(You can also use open-collector/drain gates, but these require collector/drain resistors.)

=====

With switches you can select different actions depending on the settings.
With a push button, you can build a counter, or make something happen.
With several push buttons, you can build a keypad.

At some point, you should add a timer and use a timer interrupt.

=====

The problem with PS/2 is the OS. They (DOS and Windows) want to use it for mouse and keyboard. Plus PS/2 is not designed for "hot plugging" (connecting while PC is running.) By the way, PS/2 is not i2c.

If you want to use what's built into Windows and the PC, USB is complex. You can eliminate this complexity only by using different hardware that is not under control of Windows. On the other hand, once you've created one working USB interface, it's not so hard to create another.

My nonUSB preference for communicating with a PC is COM ports. You can communicate with Hyperterminal or a program of your own choosing. A serial interface chip simplifies this communication. (Alternative: Guess what? You can generate the serial signal directly in code!) You will also need a RS-232 voltage translator (like the MAX233.)
Posted on 2004-02-07 23:58:50 by tenkey
thx, for now..

dion,
thx, for now i have only Z80 and EPROM, i tought that since Z80 hasn't internal ram, i couldn't use call instructions in the EPROM proggy, since i can't push anything on the stack. Would you say that there's some stack space inside and i can use Call and ret anyway ?

tenkey, thx
yes, i would like to add some buttons or a keyboard :) but i have to decode PS2 informations from the keyboard...

next step for now will be to add some ram.. :)
Posted on 2004-02-08 11:31:25 by Bit7
that one meant i was wrong :)
i think what you said is right.
Posted on 2004-02-08 20:14:18 by dion
You can add RAM, such as 61256, which is nice because it's an 8-bit part with the same footprint as an EPROM. Or you can simply use old SRAM's once used as cache in 486 systems.

Adding a Z80SIO and an RS-232 interface (MAX232 or equiv.) can make your circuit communicate serially with a PC. Then you can download your programs to the RAM and execute them from there, without the need to burn EPROM's every time you need to experiment something. Of course, the EPROM must contain the loader and communication driver.
Maybe you should start with this.

You do not have to add a "real" keyboard, just a few buttons which your Z80 can scan and debounce. These are basic tasks that you should master. Then you can use your circuit to play by controlling different things: LED's, motors, etc, based on inputs from sensors or buttons.

Try building a thermometer with a thermistor used as the timing resistor in a 555-based circuit. Your Z80 has to measure the frequency, linearize the result, display the temperature on your LCD display. It should also allow for calibrations (buttons come in handy now).
Try building a clock, displaying the time on the LCD (perhaps together with the temperature), which can also be calibrated in software.

If you have an A/D, try using it and see what the challenges are. Try building the thermometer with the A/D.

Try producing an analog output by producing a PWM signal (you simply write to a port) and then integrating it. Use that signal to control the brightness of an LED or lamp (in this case it does not need to be integrated).

Use an old remote control receiver from an old TV or VCR and connect it to your board to remotely control something in your house. The Z80 has to receive the data, understand the command and do something. Then test it with your regular TV remote control to make sure it does not respond to it.

If you have a PIO to use as a port, fine, if not, simply use latches, like the 374.

These are just A FEW things you can do. You will learn a lot and get a feel for what embedded systems are all about.
Posted on 2004-02-09 11:34:37 by VVV
thanks vvv,

you really give me many jobs to do :) First of all i'll go with the ram :)
Posted on 2004-02-09 14:01:28 by Bit7
next : add some RAM
next, next : add commnunication port
next, next, next : make some progame to talk with pc
next, next, next, next : add more complicate i/o that you like
next, next, next, next, next : some program to control your i/o

my first z80 has 256 bytes RAM, my eZ80Accliam now has 1MB+ flash, 1MB+ RAM.
Posted on 2004-02-10 02:51:49 by andaman
oh yeah, how you guys connecting the sram so the code can be downloaded to it?
Posted on 2004-02-10 21:08:32 by dion
dion, my first z80 time is not far behind the altair 8080, code are bit-by-bit DMA input directly in to RAM (no budget for long row of panel swith at that time but breadboard with patching wire worked well).
Posted on 2004-02-12 21:12:22 by andaman
thx again , now idea are not missing :)
Posted on 2004-02-13 01:36:21 by Bit7
I would not try to do a DMA using any wires to write directly to RAM.
Instead I would code a bootloader in the EPROM.

It receives the data byte by byte over the serial port (or parallel) and then stores it at consecutive locations in the RAM, starting at address xxxxH.
Then, when the download is complete, execute a jump instruction: jp xxxxH. Now the micro will start executing the code you just downloaded.

The only problem with this approach is that after reset you start at 0000H, so the first instructions will be in EPROM and you need to remap the interrupts to handle them in RAM. But that can be done.
Probably the easiest way is to test a jumper after reset and if it's in a certain position you jump to the bootloader, else you jump to xxxxH, where you normally load your programs in RAM. So you can also reset the board (without powering down) and restart you loaded program, in case it hangs up. If you need to reload the program, put the jumper in the other position and reset the board. You are now ready to reload a program.

I have used this approach and it works fine.
Posted on 2004-02-13 11:54:16 by VVV