• Please review our updated Terms and Rules here

7-segment LED problems on an 8088 project

otacon14112

Experienced Member
Joined
Apr 19, 2012
Messages
115
Location
Iowa, United States
Hey guys, it's been a couple years since I messed with my 8088 project. I took a break from it because I got frustrated with not being able to correct some problems. Anyway, I decided to start over from scratch a little over a week ago. It's gone good so far. I just added 4 dual-digit seven-segment LED digits for a total of 8. I'm using a 8255 PPI to use ports. When I apply power to the 8088 board, I have to hit the reset button once and then the program I'm posting runs. However, it takes a long time for the digits to gradually light up. Probably 3 minutes; I haven't timed it. Then, after a while, they start flickering, and then segments start getting dimmer and brighter randomly. Eventually all but one digit goes blank, and the one stays like that for a while, then the whole thing starts all over again.

I know there's a lot of information you guys need. I'm following the project from Robert Grossblatt's "The 8088 Project Book". I use a 138 to control which digit is accessed, and a 6116 2KB ROM for the character map. The digits display the characters correctly, 1-8. I replaced the 138 and the ROM chip, and it didn't make any difference. Before I added the 138, char ROM, and seven-segment LEDs, I had 8 LEDs connected to the 8 bits on port B of the 8255. They illuminated and displayed the correct binary combinations every time. I didn't have to wait for them to light up, but once in a while, they would change and display random combinations. I checked the voltage at various points around the board, and they're all anywhere between 4.69-4.78 volts. My power supply reads 5.0 volts.

Before I added the 138 BCD decoder, and the 2KB 6116 char ROM, and the 4 dual-digit displays, I tested the voltage across one of the basic LEDs. it was around .785, and it always fluctuated like it did when I was measuring the voltage around the board by + - .01 V approx.

I've checked the connections on everything, being paranoid that a wire is connected to a wrong pin, but every time I check everything over, all the connections are correct.

I have the complete data for the clock generator circuit, which I soldered onto a prototype board. I wanted to make sure there wasn't a capacitance problem near the clock generator, so I didn't want it in a breadboard. I wanted it to be as good as possible. Using my oscilloscope, here is the data for the clock pulses:

Crystal: 14.31818 MHz
CLK rate: 5 MHz
Period: 200 ns @ 10 zoom, 225 ns @ 1 zoom
Low period @ 1.5V: 122 ns
Low V: -.6V
High V: 5.39
Low-to-high 1.5V to 3.9V: 11 ns @ 10 zoom
High period @ 1.5V: 76 ns @ 10 zoom
High-to-low 3.9V to 1.5V: 7 ns

The max transition period is 10 ns, according to intel. I hope that extra nanosecond isn't messing things up.

I'll be posting pictures of schematics and diagrams shortly. I have to find my login information for the image hosting website I used last time. Ok I guess the schematics were already uploaded. Here's the link:
https://www.flickr.com/photos/9114793@N03/sets/72157634881520510/

But I wondered if anybody knows any possible electrical reasons why it would take the digits a long time to light up, and then flicker and go berserk.

It's set up so that the lower 5 bits are the character to be displayed, and the higher 3 bits are which display to light up. For example, 000 lights up the first seven-segment digit, and 111 lights up the eighth seven-segment digit. The lower 4 bits are standard hex: xxxX1010 will display an "A". If bit 5 is a 1, it provides additional character segment patterns (for a total combination of 32) if the reader of the book wanted to program any additional ones in the char ROM. Only a decimal point, dash, and underscore are extra characters, so far.

Here is my code so it can be scrutinized and analyzed for any potential logical errors:
Code:
     1                                  ;              ************************************************
     2                                  ;              *                                              *
     3                                  ;              *  CREATED JAN. 23, 2015                       *
     4                                  ;              *                                              *
     5                                  ;              *  PURPOSE: TO CAUSE 8 8-SEGMENT LEDS TO SHOW  *
     6                                  ;              *  HEX VALUES                                  *
     7                                  ;              *                                              *
     8                                  ;              ************************************************
     9                                  ;
    10                                  ;*****************************************************************************
    11                                  
    12                                  USE16
    13                                  section		.data
    14                                  ROM_SIZE	equ	2048			; size of ROM
    15                                  
    16                                  section		.text 
    17                                  Startup: 
    18 00000000 B80004                  		mov	ax,0x0400		; Initialize the stack so that it
    19 00000003 8ED0                    		mov	ss,ax			; occupies the last 1KB of memory
    20 00000005 BC0008                  		mov	sp,0x0800		; in the 2KB 6116. This gives me 
    21                                  						; the first 1KB for misc data.
    22 00000008 B880FF                  		mov	ax,0xFF80		
    23 0000000B 8EC8                    		mov	cs,ax			; Set up the code segment to FF80 
    24 0000000D B090                    		mov	al,0x90			; This sets the 8255 to operate
    25                                                                                  ; in Mode 0 (basic input output)
    26                                                                                  ; with port 0 as an input and 
    27 0000000F E603                                    out	0x03,al                 ; ports 1 and 2 as outputs.  
    28                                  
    29                                  display:
    30                                  
    31                                  ; Digit 0
    32 00000011 B001                    		mov	al,0x01			; Prepare digit 0 to display "1"
    33 00000013 E601                    		out	0x01,al			; Send data out to make it happen
    34                                  		
    35                                  ; Digit 1
    36 00000015 B022                    		mov	al,0x22			; Prepare digit 1 to display "2"
    37 00000017 E601                    		out	0x01,al			; Send data out to make it happen
    38                                  		
    39                                  ; Digit 2
    40 00000019 B043                    		mov	al,0x43			; Prepare digit 2 to display "3"
    41 0000001B E601                    		out	0x01,al			; Send data out to make it happen
    42                                  		
    43                                  ; Digit 3
    44 0000001D B064                    		mov	al,0x64			; Prepare digit 3 to display "4"
    45 0000001F E601                    		out	0x01,al			; Send data out to make it happen
    46                                  		
    47                                  ; Digit 4
    48 00000021 B085                    		mov	al,0x85			; Prepare digit 4 to display "5"
    49 00000023 E601                    		out	0x01,al			; Send data out to make it happen
    50                                  		
    51                                  ; Digit 5
    52 00000025 B0A6                    		mov	al,0xA6			; Prepare digit 5 to display "6"
    53 00000027 E601                    		out	0x01,al			; Send data out to make it happen
    54                                  		
    55                                  ; Digit 6
    56 00000029 B0C7                    		mov	al,0xC7			; Prepare digit 6 to display "7"
    57 0000002B E601                    		out	0x01,al			; Send data out to make it happen
    58                                  		
    59                                  ; Digit 7
    60 0000002D B0E8                    		mov	al,0xE8			; Prepare digit 7 to display "8"
    61 0000002F E601                    		out	0x01,al			; Send data out to make it happen
    62                                  		
    63 00000031 EBDE                    		jmp	display
    64                                  
    65                                  ;****************************************************************
    66                                  ; Chuck (G)'s code from Vintage Computer
    67                                  ;****************************************************************
    68                                  
    69 00000033 00<rept>                		times	((ROM_SIZE-16) - ($-$$)) db 0
    70 000007F0 EA                      		DB	0EAh
    71 000007F1 [0000]                  		dw	Startup
    72 000007F3 80FF                    		dw	10000h-(ROM_SIZE/16)	; target segment
    73 000007F5 00<rept>                		times	ROM_SIZE - ($-$$) db 0
    74                                  
    75                                  ;****************************************************************

I've studied the NASM manual, and I have like 5 different books about 8088-based systems and its assembly language. One of the books, likely a former university textbook (it has the typical "used" sticker commonly seen in college textbook stores on the binding - I got it from Amazon) doesn't even talk about setting or messing with SS or SP, saying it's the job of DOS, or the OS to do it, not the individual, but it has very good information about the instruction set otherwise. I've written the best code I can come up with, but I am still leaving open the possibility of a logical error on my part.

I have run out of ideas about how to test possible problems. I've checked and done everything I can think of, but I'm no computer engineer, just a hobbyist trying to see how far I can go lol.

So if anyone can help me figure out what's wrong, I'd appreciate it very much. Thanks a lot guys.
 
Last edited:
Well, you don't need to set up cs:; it's set with the EA far jump at the ROM entry. Have you looked at the binary before you burned your PROM? Make sure it's not been offset by 100H as in a .COM executable. You also don't need to set SS/SP, because you never use a stack. I'm assuming that the ROM really does map into FF80:0-FF80:7FF.

Do you have any way NMI can be activated indadvertently?
 
Well, you don't need to set up cs:; it's set with the EA far jump at the ROM entry.
Right, I forgot that the far jump sets cs. Thanks for the reminder :p

Have you looked at the binary before you burned your PROM? Make sure it's not been offset by 100H as in a .COM executable.
Yeah, I always read the data from the chip to see if it was correct, and all the code is in the right places. EA is at the power-up location at FFFF0h.

You also don't need to set SS/SP, because you never use a stack. I'm assuming that the ROM really does map into FF80:0-FF80:7FF.
Ok, that's good to know. Thanks. I wasn't sure, so I set it up after I encountered problems, hoping that clearly defining the stack would eliminate some suspicions. Also, I was going to write some subroutines and use calls, but I haven't yet.

Do you have any way NMI can be activated indadvertently?
I honestly have never messed with NMI. I have no experience with it. I haven't reached that point yet. I was hoping to go far and learn about many of the cpu's features, but I just haven't got that far yet.

Back in 2012 or 13, you mentioned something about setting up a 232 or UART and using that as an interface. Do you mind sharing your schematics and code for that?

Thanks for your ideas.
 
Back in 2012 or 13, you mentioned something about setting up a 232 or UART and using that as an interface. Do you mind sharing your schematics and code for that?

Well, let's see how we can adapt it to your design. Care to share a schematic of your setup?
 
My schematic is identical to his. It's the big schematic in the picture, but I removed IC10 and the 8 LEDs and resistor since I didn't need them anymore. Then just add the other schematics in the link to the big one that is shown on the left and right pages. It's identical to all of his schematics, with the only difference being I removed IC10, the LEDs, and resistor. Thanks
 
Well, I'll get to it, but it'll be "when I can find time", I'm afraid.

In the meantime, the datasheet for the MAX232 should give you a very good idea of how to wire one up. For a UART, I'd look to the 8250/16450/16550 (all have the same pinout) or Signetics 2650/2660. Both have internal baudrate generators, are easy to interface and simple to program.
 
Awesome, thanks. Whenever you get around to it is fine. But I just discovered a big problem. When I step away from the breadboards when the circuit has power, all the LEDs, but especially the seven-segment LEDs go black, and then slowly dim back on. When I step closer to it, it goes from being either dark or dim to a bright digit. The individual LEDs (that I put back on the board, along with the 373, ic10, aren't affected as much, but still are to some degree).

It seems that there is an adverse effect involving energy fields of some sort. This is far beyond my electronics skill level to even begin to know what to do about it or test it or anything. I hate to quit, but there's no point in adding onto this if it can't even run simple programs correctly.

Here's how my board is set up now. I unhooked 8255 port B from the 138 and 6116, but I left both chips and all 4 dual-digit displays connected to the power rails. In fact, the 138, 6116 char ROM, and the displays are all the same and still connected together, except that 8255 port B is now connected to a 373 and 8 individual LEDs which light up as "00001011" when my program sends out 0Bh. Seven-segment display #0 eventually lights up after a while (the delay in illumination hasn't changed), but the fact that digit 0 is the only one lit, and it's displaying 0 means that the 138, 6116, and the displays are doing what they're supposed to, just not very good, since it takes them a long time to light up. Plus it still flickers and goes dim sometimes, but when I step away quickly, there's a significant reaction by the circuit, blacking out the seven-segment displays, and also affecting the individual LEDs connected to the 373 and 8255 port B.

I went back to an extremely basic program to test it, simply outputting 0Bh to port 1, and I used that 373 latch. The program works, but even after a while, the LEDs can sometimes change whenever they want, which isn't very often, but it does happen, so that should be noted as well.

I wonder if this energy field effect is what could be causing all the problems, or if it's just another problem in addition to a seperate one. I see so many people using breadboards and showing off cool stuff they're doing with 8088s on youtube and all over the internet, but no matter which breadboard I use, and I have different brands, and after swapping out chips, it still doesn't work. Which really makes me wonder what the heck I'm doing wrong that so many other people aren't.

The only chip I haven't changed is the 8255 because I only have one of them. I guess I'll order another one or two, but with my bad luck thus far, I doubt that would matter. The only things that actually (and accurately) do what I tell them to are my microcontrollers.

Could that extra 1 ns on the low-to-high pulse from the clock generator be causing this to go wrong? My scope is analog, not digital, so I could only estimate with my eyes the closest measurement, but I didn't want to just say, "Yeah, it's close enough," I wanted to be honest with myself and write down 11 ns just in case. It's a 20 MHz scope, so measuring a nanosecond or 2 is kind of just an estimate.
 
My guess is that you've either got a grounding issue or you have some inputs left "floating". Especially on MOS (NMOS, CMOS, PMOS), that's not a good idea.
 
Thanks for your quick reply. That's a great idea to check. I never would have thought about it. I'll check it out. I've made my connections identical to Robert Grossblatt's schematics, and there are many pins that he doesn't connect to anything. Should every unused pin be grounded? There are several pins that he specifically says NC or "no connection" on the 8088 and 8284. And there are several logic gates on chips like the 32, 08, etc.

Also, I wanted to put the question out there: What digital logic simulation software do you guys recommend? I use Linux on my main computer, but I have an older computer that I have XP on. That's the one I use to program my EEPROMs, PICs, and BASIC Stamp. So it could be for either OS.

I'm going to do what you said Chuck and check to see if some pins aren't grounded, but I'd love to be able to put the schematic of my circuit into a simulator to see how it would actually run theoretically. Because if it works like it's supposed to, I might make some PCBs and actually solder and put one together. This was always my end goal, but I wanted to test it out first in a breadboard prototype, which isn't working out well. I would love to have gotten around to interfacing a qwerty keyboard and putting actual physical port interfaces on the board by now, but have been stuck on whatever voodoo is going on. I hope I find some floating pins so I can fix this problem once and for all.

Thanks again Chuck!
 
Last edited:
Back
Top