View Full Version : 82C55 help!! output latched or not during reading?

March 27th, 2009, 08:15 AM
Hello, I'm programming in mode 0 a 82c55 with a z80 to read and burn an eeprom.
So I have set one port to read the EEprom data as input, and two ports as output for the addresses.

I put the address on the output with the Z80, than try to read the eeprom with the z80 and store the data in the A register.

But it doesn't work...In the istant i read the data, the outputs port for the address go to an high status.....
Question: is it possible to write two output ports, and then read with the third port just after that?
When I read, the two ouputs shouldn't be latched and maintain the address while I read the data?

If I read from a port, data are maintained on the other two output ports in the same time?

I succeded to burn the eeprom but in this case all the 3 ports were outputs....I cannot verify what I have just written since I cannot read while I out the adresses........

my program:

set 8255 as output,output,read;
set via z80 a 16 bit address word and put on the two ports output;
outputs stay latched while Z80 reads the data with the third port

this program is simple but doesn't work...
....please help!

March 27th, 2009, 09:12 AM
It should work; a snippet of code showing what you're doing (particularly with the setup) will help to identify your problem.

Are you also certain that the 82C55 isn't decoding some address line glitches?

March 27th, 2009, 11:24 AM
Hello, thanks for the prompt reply...it is making me crazy!
Here my code and HW connection.
The writing routine works!
The reading routine not!
Step to step measurement show hi impedance on Port B&C during IN A,(02H)...
Here the main code.

DA .EQU 06000H ; display "DATO"
LO .EQU 04000H ; display "LO"
HI .EQU 02000H ; display "HI"

.ORG 0E000H
; read AT28C64
; Port A out (00H) = LO
; Port B out (01H) = HI
; Port C in-out (02H) = DATO
; Control (03H) = Out,Out,In =(89H) READ
; Control (03H) = Out,Out,Out =(80H) WRITE
; 8 bit data word= CS(8°bit),WE-(7°bit),OE(6°bit),xxxxx (HI last 5 bit)
; WE is inverted
; data H = 1xxxxxxx = Standby (CS=1) Code: AND 01FH, ADD A,080H
; data H = 000xxxxx = READ (OE=0) Code: AND 01FH, ADD A,0H Control (03H) = Out,Out,In =(89H)
; data H = 001xxxxx = WRITE (OE=1,WE-=0) Code: AND 01FH, ADD A,020H Control (03H) = Out,Out,Out =(80H) WRITE
; data H = 011xxxxx = pulse DOWN (WE-=1 for 50 ms - managed by 74LS123) Code: AND 01FH, ADD A,060H Control (03H) = Out,Out,Out =(80H) WRITE

LD A,089H ; Control (03H) = Out,Out,In =(89H) READ
OUT (03H),A ; Control (03H) = Out,Out,In =(89H) READ
AND 01FH ; Masque the last 3 bits of H = 0
LD (HI),A ; Display HI
OUT (01H),A ; Out HI on port B
LD A,C ;
LD (LO),A ; Display LO
OUT (00H),A ; Out LO on port A
IN A,(02H) ; In DATO from port C
LD (DA),A ; Display DATO

March 27th, 2009, 03:32 PM
I don't see anything wrong with your code. I wonder if you might not have a race condition or glitch in your 8255 address decoding, however.

March 27th, 2009, 03:49 PM
I haven't analysed your code (I'm unfamiliar with the 8255) but I see a potential problem.
The EPROM will take a little time to decode the address and present the data.
And so maybe a small delay needs to be added to your code, eg.

OUT (00H),A ; Out LO on port A
IN A,(02H) ; In DATO from port C

March 27th, 2009, 04:45 PM
so velocity is not a problem:sneaky:

It always returns me the data contained in address 0000H, since when read at any address the output go to high impedance for that while, but since I have resistors 10k to gnd, the addresses are always read 0000H ...:confused:...

March 27th, 2009, 04:57 PM
What speed are you running your CPU? In particular, are you cutting t(rv) short? My datasheet says that the time between read and write is 850 nsec minimum. (that's for the 8255A-5, the 82C55 might be different).

March 27th, 2009, 05:06 PM
Can you post a link to a schematic? I've recently soldered up an 82C55 with a Z80 and written some driver code as part of the N8VEM project. A schematic will help a lot as there are quite a few possibilities.

March 27th, 2009, 06:20 PM
Can you post a link to a schematic? I've recently soldered up an 82C55 with a Z80 and written some driver code as part of the N8VEM project. A schematic will help a lot as there are quite a few possibilities.

Personally, I hate the things. The 8255 was probably one of the first peripheral I/O chips (other than the 8212) to come out with the 8080. It's ancient, quirky and slow--a CPLD or even a couple of 374 latches is a better choice--and much faster.

One of the more irritating things about the 8255 is that if you write to the mode register to change the operation of one port, everything gets reset.

I think it's interesting that the 5150 printer BIOS talks about an 8255, yet the actual card doesn't use one.

Terry Yager
March 28th, 2009, 12:07 AM
I'm no programmer, but muddling thru your code, I see no problem, which puts me in the "It's gotta be hardware" camp, where I'm even less of an expert. Sorry no help, just wishing you the best of luck in working out the prob.


March 28th, 2009, 03:46 AM
You said it should work and to post a schema:
you reencourage me :rolleyes:so I started to put it down and soon I discovered that on port A i had an LS240 with dip-switch input.:mad:
I totally forgot to put it in High impedance and this caused a conflict on port A bus!:sneaky:

Now I fixed it and 8255 can read the EEprom!:p

I've just found this forum and i like to find so many people keen on vintage electronics!;)

See my Z80 working!

my Z80 (http://www.flickr.com/photos/32893012@N08/3392034666/)

Z80 video (http://www.flickr.com/photos/32893012@N08/3391147835/)

March 29th, 2009, 04:40 AM
Great to hear it is working. Nice looking board too!

Terry Yager
March 29th, 2009, 05:12 PM
Ooo, ooo! I want one!


March 30th, 2009, 03:16 AM
Nano computer or NBZ80 was AFAIK a european SBC that came out around 1980.
It was sort of similar to Microprofessor MPF and a very nice educational computer

It would be great if you could provide more information such as Schematic drawings,
ROM BIOS, and all available technical info about the computer.

Is this a new commercial remake, or your own reincarnation of the old system?


March 30th, 2009, 05:39 AM
Answering my own inquiry:


ziloo :biggrin:

P.S. American made...I stand corrected!!!

March 30th, 2009, 12:58 PM
Hello, I will try to answer to some of your questions.:D
Unfortunately I don't have the full schematic.:(..I've modified parts and added devices hand by hand during the construction...:rolleyes:
But I want to draw the schematic, so when ready I will post.

Anyway the main schema comes from this site (not mine:sneaky:):


I have added the 82C55, to which is connected via analog switch the 555 tone generator to play music effects (see main schema from here, but idea is mine...:mrgreen:):


and the manual HW/SW E/EEprom programmer from here (modified:cool:):


I have completely rewritten the Assembly even if the main routines (check RAM and Keyboard input) are the same;).
I'm still adding to the BIOS useful routines like 16 bit math operation, hex-dec converter, bios duplicator, SW e2-eprom programmer, variable parametric delays, random number generator, sound effects, RAM/ROM reader and writer etc...: when ready I will post.:p

About NANOCOMPUTER name: you are right, it is a remake from the old training board machines, but I remember that time there were different unofficial Z80 Nanocomputer....

For the display I have used the cross referenced MC14495. The 74C923 was very hard to find and expensive : it costs now more than the CPU!

Z80 is quite impossible to find new. I had old pieces from mine. 82C55 is still available and costs 5 euro. Also the EEprom and Eprom are still available at about the same.

March 30th, 2009, 04:25 PM
Looks like a lot of work has gone into that board.

You can get a new CMOS 4Mhz Z80 for $US2.90 here http://www.futurlec.com/ICZ80Series.shtml

And an 82C55 for $3.90 at the same store. Shipping is a flat $4 worldwide for smaller orders.

Keep us posted as the project develops!