Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cheapest microcontroller with external bus?

42 views
Skip to first unread message

andy

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
Hi.

I am after the cheapest possible microcontroller with an external bus.
(It doesn't need to do anything much except shuffle data from the
external ROM to another port). The external ROM will be 128K, but I can
get by with a 64K chip by bank switching and code duplication.

So far, I have arrived at the MC68HC05C0, which is <US$2 in quantity.

Anybody know anything cheaper than this?

Andy


Lewin A.R.W. Edwards

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
>I am after the cheapest possible microcontroller with an external bus.
>So far, I have arrived at the MC68HC05C0, which is <US$2 in quantity.
>Anybody know anything cheaper than this?


How about a Z-80, which you can get for about US$1 in quantity? No RAM
internally, that's the only problem.

If ALL you need to do is shift data from ROM to a port, you might be able to
get away with a counter IC (and maybe an 8-pin PIC to control that counter
if something smart needs to be done).

--
-- Lewin A.R.W. Edwards <http://www.zws.com/>
Realtime/Embedded Programmer & Embedded HW Eng
It is computed that more than eleven thousand persons have on
several occasions suffered death rather than submit to Windows NT.


Don McKenzie

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
Lewin A.R.W. Edwards wrote:
>
> >I am after the cheapest possible microcontroller with an external
> bus.
> >So far, I have arrived at the MC68HC05C0, which is <US$2 in quantity.
> >Anybody know anything cheaper than this?
>
> How about a Z-80, which you can get for about US$1 in quantity? No RAM
> internally, that's the only problem.

You don't need ram to run a Z80 Lewin! Just a clock and a ROM will do
fine.

I wrote many a program using the registers only for sub-routines. No
stack, no ram. They give you a whole 208 bits of registers if I
remember, to do everything. JP (IX) and JP (IY) was used. I think most
of my routines are hidden at:
http://www.dontronics.com/z80.html

Don McKenzie mailto:d...@dontronics.com http://www.dontronics.com

Don's Download Dungeon: http://www.dontronics.com/download.html
Australian Electronics Ring http://www.dontronics.com/aering.html

Lewin A.R.W. Edwards

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
>> How about a Z-80, which you can get for about US$1 in quantity? No RAM
>> internally, that's the only problem.
>
>You don't need ram to run a Z80 Lewin! Just a clock and a ROM will do


I know... I've used that CPU a lot (and I often wished it was possible to
use the 6502 without RAM). But the poster asked for a *microcontroller*.
Implication that he is expecting a single chip with integrated ROM, RAM and
maybe other peripherals. Or that's the way I read it anyway. Doesn't really
matter. It's just a caveat which I thought was worth stating.

There are even two hidden extra 16-bit registers on many Z80s. You access
them with ix/iy prefix to instructions that operate with BC. Read about
those in Byte around 1985 I think! :-)

--
-- Lewin A.R.W. Edwards <http://www.zws.com/>
Realtime/Embedded Programmer & Embedded HW Eng

STOP RACISM! Equal rights for Danish & Swiss cheese!


Richard Erlacher

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
On Fri, 12 Mar 1999 21:29:18 +1100, Don McKenzie <d...@dontronics.com> wrote:

> Lewin A.R.W. Edwards wrote:
> >
> > >I am after the cheapest possible microcontroller with an external
> > bus.
> > >So far, I have arrived at the MC68HC05C0, which is <US$2 in quantity.
> > >Anybody know anything cheaper than this?
> >

> > How about a Z-80, which you can get for about US$1 in quantity? No RAM
> > internally, that's the only problem.
>
> You don't need ram to run a Z80 Lewin! Just a clock and a ROM will do

> fine.
>
> I wrote many a program using the registers only for sub-routines. No
> stack, no ram. They give you a whole 208 bits of registers if I
> remember, to do everything. JP (IX) and JP (IY) was used. I think most
> of my routines are hidden at:
> http://www.dontronics.com/z80.html
>
> Don McKenzie mailto:d...@dontronics.com http://www.dontronics.com
>
> Don's Download Dungeon: http://www.dontronics.com/download.html
> Australian Electronics Ring http://www.dontronics.com/aering.html

===========================================================
If youre after a one-part solution, it may cost more than the sum of the
separate parts you'd use with some other processor, but it seems to me that
there's an ATMEL 805x-comaptible with 132K of rom space, which allows you to
program into it the contents of your external rom along with the code to
shuffle it to one of its ports. If you really are just duplicating or
dumping a rom, though, all you need is an appropriately long counter. A
couple of 4040's should do nicely at less than $0.50.

Lewin A.R.W. Edwards

unread,
Mar 13, 1999, 3:00:00 AM3/13/99
to
>>There are even two hidden extra 16-bit registers on many Z80s. You access
>>them with ix/iy prefix to instructions that operate with BC. Read about
>>those in Byte around 1985 I think! :-)


>I don't recall any *hidden* registers; rather one can access the
>halves of IX,IY using some undocumented prefixes. This worked on the
>Zilog-designed Z80 only.

The article in Byte was an in-depth analysis of undocumented magic in the
Z80. It talked about all sorts of things, including the undoc 'IXH/IXL'
instructions. The extra registers, IIRC, were not present on Zilog parts,
maybe SGS? Can't remember. It was too long ago. I know I ran the tests on my
Sinclair machines (NEC 780-1) and they didn't have any of the undocumented
features in the article :-(

Don McKenzie

unread,
Mar 15, 1999, 3:00:00 AM3/15/99
to
Peter wrote:
>
> AFAIR the NEC 780 was *not* a Zilog mask; it was designed by NEC to be
> Z80 compatible, without Zilog's co-operation.
>
> I don't know if the IXL/IXH stuff was in it, but it could have been if
> the opcode decoding was done the same way.
>
> Hitachi's 64180 is microcoded and none of the undocumented Z80 opcodes
> work in that one.
>
> The SGS Z80 was, IIRC, a Zilog licensed mask.

>
> >The article in Byte was an in-depth analysis of undocumented magic in the
> >Z80. It talked about all sorts of things, including the undoc 'IXH/IXL'
> >instructions. The extra registers, IIRC, were not present on Zilog parts,
> >maybe SGS? Can't remember. It was too long ago.

Don't recall any extra registers. I think there was 208 bits in all
registers.

The undocumented instructions article I recall, and I'll almost bet it
was Steve Ciacia that wrote it as he was doing all the Micro project
articles about Z80's at one stage. Things like build the GT180 color
graphics board for your SB180. He has heaps of articles like that. I may
even have the original Z80 "undocumented". I better go have a look. I
doubt if I threw that one out.

Lewin A.R.W. Edwards

unread,
Mar 15, 1999, 3:00:00 AM3/15/99
to
>> >The article in Byte was an in-depth analysis of undocumented magic in
the
>> >Z80. It talked about all sorts of things, including the undoc 'IXH/IXL'
>
>Don't recall any extra registers. I think there was 208 bits in all
>registers.

I hope I remembered the magazine right. I'm 99.9999% sure I did. IIRC the
author had a TRS-80 background.

--
-- Lewin A.R.W. Edwards <http://www.zws.com/>
Realtime/Embedded Programmer & Embedded HW Eng

Aguja

unread,
Mar 15, 1999, 3:00:00 AM3/15/99
to
Hi andy <a1w...@ozemail.com.au> !

>I am after the cheapest possible microcontroller with an external bus.

>(It doesn't need to do anything much except shuffle data from the
>external ROM to another port). The external ROM will be 128K, but I can
>get by with a 64K chip by bank switching and code duplication.
>

>So far, I have arrived at the MC68HC05C0, which is <US$2 in quantity.
>
>Anybody know anything cheaper than this?

8051s with disabled ROM are sometimes offered at a very small price...

cu,

Aguja [Please remove the '1's from my E-Mail-Address before replying]
(==> Spam-Protection !)

--> 8252 & AVR & PIC-PROGRAMMER: http://uC-Project.de <--

Steve

unread,
Mar 15, 1999, 3:00:00 AM3/15/99
to Aguja
--------------------------------------
Intel 8031/8032/8051/8052/8751/8752's ALWAYS ignore internal burned-in
code simply by grounding their /EA (pin 31) LO externally. No need to
find "disabled" ones. All compatibles are the same, and many others are
QUITE similar in this respect. (AMD DallasSemi Philips Atmel and many
others).

Older Intel uC's with a different and slightly reduced instruction set
8035/8039/8048/8049/8748/8749 need pin 7 (EA) pulled HI to defeat
internal ROM.
-Steve
--
DON'T BUY the Pentium III !!! It's Hitler Inside!!!
Leave Intel to die with shit in their mouth and ashes in their eyes!!
The ONLY way they are going to learn is if YOU REFUSE TO BUY IT!!
--
-Steve Walz rst...@armory.com ftp://ftp.armory.com:/pub/user/rstevew
-Electronics Site!! 1000 Files/50 Dirs!! http://www.armory.com/~rstevew
-Europe/Italy/Napoli http://ftp.unina.it/pub/electronics/ftp.armory.com

Andrew Dunkerton

unread,
Mar 30, 1999, 3:00:00 AM3/30/99
to
In article <36E8EC7E...@dontronics.com>, Don McKenzie
<d...@dontronics.com> writes

>Lewin A.R.W. Edwards wrote:
>>
>> >I am after the cheapest possible microcontroller with an external
>> bus.
>> >So far, I have arrived at the MC68HC05C0, which is <US$2 in quantity.
>> >Anybody know anything cheaper than this?
>>
>> How about a Z-80, which you can get for about US$1 in quantity? No RAM
>> internally, that's the only problem.
>
>You don't need ram to run a Z80 Lewin! Just a clock and a ROM will do
>fine.
>
>I wrote many a program using the registers only for sub-routines. No
>stack, no ram. They give you a whole 208 bits of registers if I
>remember, to do everything. JP (IX) and JP (IY) was used. I think most
>of my routines are hidden at:
>http://www.dontronics.com/z80.html
So where did you put the STACK ?????. Are you thinking of the Z8, which is a
different animal completely. If it IS the Z80 then if you want to handle interrupts
(which automatically pushes onto the stack) some RAM is essential. If you don't
need interrupts and you can get away without calling nested subroutines then you
should manage OK, but since adding a bytewide static ram chip is relatively simple,
why not do so ??. If you use A15 to decode between RAM and ROM then
address decoding is easy, ROM must start at address 0000h because that is what
is loaded into the program counter after a reset. RAM can be anywhere but if you
put a 32k byte static ram at 8000h then by default the stack pointer will start off
with the correct value (As far as I can remember - I did the software for an
analogue-addressable fire alarm panel back in 1993 - and that used a Z80 on the
main board, with intel 8031 slave processors on the sensor device loop
controllers). I still have the ZILOG handbook (1991) and I think you can still buy it
from RS components in the UK. (www.rs.com ?)

--
Andrew Dunkerton

Don McKenzie

unread,
Mar 31, 1999, 3:00:00 AM3/31/99
to
Andrew Dunkerton wrote:

> >of my routines are hidden at:
> >http://www.dontronics.com/z80.html
> So where did you put the STACK ?????. Are you thinking of the Z8,
> which is a
> different animal completely. If it IS the Z80 then if you want to
> handle interrupts
> (which automatically pushes onto the stack) some RAM is essential. If
> you don't
> need interrupts and you can get away without calling nested
> subroutines then you
> should manage OK, but since adding a bytewide static ram chip is
> relatively simple,
> why not do so ??. If you use A15 to decode between RAM and ROM then
> address decoding is easy, ROM must start at address 0000h because that
> is what

You missed the point Andrew, you don't need to use the stack or any ram
at all to run a z80 program.
No I am not confusing it with the Z8.

I did Z80 machine code for 15 years before I gave it away.

also at:
http://www.dontronics.com/z80.html
you will find routines to add 4mb of dram to a z80 system by using only
a single 74LS00 and single 74LS04, and a 555 timer for generating
interrupts, no other hardware, all cas/ras refresh done in software.

No I am not confusing it with the Z8.

It could be expanded to 64mb without additional hardware, but I never
got that far before I decided to do other things.

> Andrew Dunkerton

Rainier Lamers

unread,
Mar 31, 1999, 3:00:00 AM3/31/99
to

Andrew Dunkerton wrote in message ...

>In article <36E8EC7E...@dontronics.com>, Don McKenzie
><d...@dontronics.com> writes
>>Lewin A.R.W. Edwards wrote:
>>>
>>> >I am after the cheapest possible microcontroller with an external
>>> bus.
>>> >So far, I have arrived at the MC68HC05C0, which is <US$2 in quantity.
>>> >Anybody know anything cheaper than this?
>>>
>>> How about a Z-80, which you can get for about US$1 in quantity? No RAM
>>> internally, that's the only problem.
>>
>>You don't need ram to run a Z80 Lewin! Just a clock and a ROM will do
>>fine.
>>


Yes, I did something like this many years ago for a remote display (using
semi-permant magnet driven 5x7 mechanical displays).
One Z80 and a 2K ROM was about all there was as far as controller goes. It
did half-duplex serial comms at 9600 baud in software and even ran
interrupts. Quite amazing what can be done once you get down to using just
registers an no stack whatsoever. The msb of the stackpointer even makes a
handy storage byte (the lsb gets clobbered by the interrupts). The tricky
part is to get the interrupt to return somewhere usefull but since this
application was relatively simple it would go straight to one of several
safe entry points in the base software.

This was the kind of project you had to stake your reputation onto with many
of your collegues betting that it would not work - which would result in
more costly harware development. Anyway, it was fun.

With todays microcontrollers however this is not the cheapest way as you
have to add the cost of the CPU and ROM plus the Z80 does not have an
integrated crystal oscillator and you need some I/O I suppose ?

Rainier


Andrew Dunkerton

unread,
Mar 31, 1999, 3:00:00 AM3/31/99
to
In article <37017872...@dontronics.com>, Don McKenzie
<d...@dontronics.com> writes

>Andrew Dunkerton wrote:
>So where did you put the STACK ?????. Are you thinking of the Z8,
>> which is a
>> different animal completely. If it IS the Z80 then if you want to
>> handle interrupts (which automatically pushes onto the stack) some RAM is
essential. If you don't need interrupts and you can get away without calling
nested subroutines then you
>> should manage OK, but since adding a bytewide static ram chip is
>> relatively simple,
>> why not do so ??. If you use A15 to decode between RAM and ROM then
>> address decoding is easy, ROM must start at address 0000h because that
>> is what
>
>You missed the point Andrew, you don't need to use the stack or any ram
>at all to run a z80 program.
>No I am not confusing it with the Z8.
If you read my reply properly you would see that it is yourself who has missed
the point !, I too have many years Z80 programming and I have the ZILOG 1991
tech ref manual in front of me, and it clearly states that the following opcodes
use/require a valid stack pointer :-
CALL nn
CALL cc,nn
RET
RET cc
RETI
RETN
RST pp

If you wish to use *either* :-
a) interrupts, *or*
b) the call instruction (for nested subroutines) then a valid stack pointer and
some ram is necessary - and you only need a single 32K byte byte-wide static ram
chip using A15 to select either EPROM or RAM - completely unnecessary to mess
around with dynamic rams and 555 timers, nobody does it that way anymore - as
you must surely be aware.
Here is the output of HITECH's C to Z80 compiler, just for your info, not that it
proves anything nor does it do anything useful other than to show an interrupt
routine generated from a High-level language, using the CALL instruction to
go down another level.

;INTERRUP.c: 1: int more_code(int x)
;INTERRUP.c: 2: {
global _more_code
signat _more_code,4154
psect text
_more_code:
push ix
ld ix,0
add ix,sp
push bc
;INTERRUP.c: 5: int y = x >> 8 ;
ld a,d
ld l,a
rla
sbc a,a
ld h,a
ld (ix+-2),l
ld (ix+-1),h
;INTERRUP.c: 6: return y ;
ld sp,ix
pop ix
ret
global _handler
signat _handler,24
;INTERRUP.c: 8: void interrupt handler(void)
;INTERRUP.c: 12: {
_handler: ** note ** at this point the Z80 microcode has already pushed the
return address onto the STACK!!!!!
push af
push hl
push de
;INTERRUP.c: 13: (void) more_code(136) ;
ld de,136
call _more_code
;INTERRUP.c: 14: }
pop de
pop hl
pop af
ei
reti <<<- this will POP the STACK !!!!!!!
end

>I did Z80 machine code for 15 years before I gave it away.
>
>also at:
>http://www.dontronics.com/z80.html
>you will find routines to add 4mb of dram to a z80 system by using only

You can add a whole 32K bytes with a single byte-wide static ram chip and use
A15 as chip select, WHY ON EARTH use 3 chips PLUS the drams (power
guzzlers !) to do the same thing. Everyone uses lowpower CMOS static rams
for this sort of application these days !!.

>a single 74LS00 and single 74LS04, and a 555 timer for generating
>interrupts, no other hardware, all cas/ras refresh done in software.
>
>No I am not confusing it with the Z8.
>
>It could be expanded to 64mb without additional hardware, but I never
>got that far before I decided to do other things.
>
>> Andrew Dunkerton
>
>Don McKenzie mailto:d...@dontronics.com http://www.dontronics.com
>
>Don's Download Dungeon: http://www.dontronics.com/download.html
>Australian Electronics Ring http://www.dontronics.com/aering.html

--
Andrew Dunkerton

Lewin A.R.W. Edwards

unread,
Apr 1, 1999, 3:00:00 AM4/1/99
to
> >You missed the point Andrew, you don't need to use the stack or any ram

> If you read my reply properly you would see that it is yourself who has


missed
> the point !, I too have many years Z80 programming and I have the ZILOG
1991

No, I'm afraid you really have missed the point here, Andrew. Don is saying
that it is possible to build a Z-80 system which does not have any RAM, and
have that system do useful work. This is possible. You simply avoid
instructions which use the stack - call/return functionality. You wind up
with a very linear sort of program, but it works just fine.

You're quite right that it would be very difficult to get C code to run in
that environment. You'd have to inline everything, including every RTL
function, and every RTL sub-function, ad infinitum. Probably there are a lot
of constructs which couldn't be achieved in a sane ROM space. But who
cares - Don wasn't talking about building a C program, but simply the fact
that it is possible to write A PROGRAM which will run on a naked Z-80, no
RAM, and achieve useful work.

Contrast this with a chip like the 6502, where you really can't do anything
much without at least a few bytes of RAM in zero page. It isn't feasible to
use the 6502 without some external RAM, because so many instructions require
zp. It IS feasible to use the Z-80 without any external RAM. You can even
use interrupt functionality. Your ISR sets SP to point to a return address
hardcoded in ROM. The chip doesn't care if its attempt to save a return
address into non-existent RAM went nowhere.

You can even use CALL/RET by limiting the number of code segments which can
call any subroutine, and by passing a pointer to a return address in a
ROMmed return table as a parameter to the call. It's complicated but
perfectly doable. The called subroutine moves the parameter into SP before
returning, and the return address is fetched from ROM.

Think more laterally!

> >you will find routines to add 4mb of dram to a z80 system by using only
>
> You can add a whole 32K bytes with a single byte-wide static ram chip and
use
> A15 as chip select, WHY ON EARTH use 3 chips PLUS the drams (power

*sigh* First: "Because you can". Second: It's cheaper (and in the past the
gap was even wider) to use DRAM for large amounts of RAM. 32K <<<<<< 4Mb, in
case you hadn't noticed.

You don't sound much like an old 8-bit-hound and lover of small micros...

--
-- Lewin A.R.W. Edwards <http://www.zws.com/>
Realtime/Embedded Programmer & Embedded HW Eng

You'll catch more programmers with donuts than with bagels.


Tap

unread,
Apr 1, 1999, 3:00:00 AM4/1/99
to
On Thu, 1 Apr 1999 12:16:27 +1000, "Lewin A.R.W. Edwards"
<sys...@zws.com> wrote:

>Contrast this with a chip like the 6502, where you really can't do anything
>much without at least a few bytes of RAM in zero page. It isn't feasible to
>use the 6502 without some external RAM, because so many instructions require
>zp.

Well I wouldn't go quite that far , acc, xreg, yreg, stackpointer, and
status register could make a usefull program..but not very usefull
Tap

To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.

Rainier Lamers

unread,
Apr 1, 1999, 3:00:00 AM4/1/99
to

Andrew Dunkerton wrote in message ...
>In article <37017872...@dontronics.com>, Don McKenzie
><d...@dontronics.com> writes
>>Andrew Dunkerton wrote:
>>So where did you put the STACK ?????. Are you thinking of the Z8,
>>> which is a
>>> different animal completely. If it IS the Z80 then if you want to
>>> handle interrupts (which automatically pushes onto the stack) some RAM
is
>essential. If you don't need interrupts and you can get away without
calling
>nested subroutines then you
>>> should manage OK, but since adding a bytewide static ram chip is
>>> relatively simple,
>>> why not do so ??. If you use A15 to decode between RAM and ROM then
>>> address decoding is easy, ROM must start at address 0000h because that
>>> is what
>>
>>You missed the point Andrew, you don't need to use the stack or any ram
>>at all to run a z80 program.
>>No I am not confusing it with the Z8.
>If you read my reply properly you would see that it is yourself who has
missed
>the point !, I too have many years Z80 programming and I have the ZILOG
1991
>tech ref manual in front of me, and it clearly states that the following
opcodes
>use/require a valid stack pointer :-
>CALL nn
>CALL cc,nn
>RET
>RET cc
>RETI
>RETN
>RST pp
>


You are correct but still missing the point of this thread.

The applications taked about where reasonably common many years ago when
cpus where few and expensive. Often you could get away with a simple
application running on a Z80 with just a single ROM attached and perhaps a
latch as I/O. No RAM is required and, yes, any CALL (or related) instruction
cannot be used. This also implies that no high level language can be used.
Remember that there are still a significant number of programers who are
quite capable programming in assembler. You could do very cost effective
simple controllers with this kind of thing at one stage. Even 256 byte RAMs
where expensive many years back !

To call a subroutine you can do:

ld ix,retaddress
jp subroutine
retaddress:
more code...

subroutine:
some code
jp (ix)

Yes, this does not need a stack and operates at only one level (you could
use IY for another...)
This also leaves you the stackpointer as convienient 8 or 16 bit (no
interrupts) storage location for data.

The point is, the Z80 has a good number of registers which might be all that
is required for a simple application.

Interrupts ? Yes, you can do as well. Consider Int mode 1. As the interrupt
happens, a (non functional) return address gets stored into (non existant)
RAM. OK that means we can't go back to the exact point where this interrupt
happened BUT we can execute some code as response to this interrupt. So
where do we go back to ? Well, often your software might be sitting in a
tight loop waiting for this interrupt. If you have such a situation you KNOW
where to go back to.
Another source for an interrupt is your reset line ! (This has the advantage
that the stackpointer is left alone leaving you 16 bits of data storage
there)
I once did an application (see post in this thread) that had a Z80 and a 2K
ROM plus a few latches for I/O to do a mechanical display of sorts. It had a
half duplex 9600 baud UART in software and used a 50 hz mains derived
interrupt source coupled to the reset line (as interrupt). The software
would figure out if the reset was genuine or from a 50 hz pulse and behave
accordingly.

By the way, with only 2K of ROM you have a few addresslines unused. With
diligent programming these can be used as outputs !

This type of application development was tinkering in the real sense but is
is fun as it is a good challenge.

Rainier


Rainier Lamers

unread,
Apr 1, 1999, 3:00:00 AM4/1/99
to

Rainier Lamers

unread,
Apr 1, 1999, 3:00:00 AM4/1/99
to
0 new messages