Traditional Macintosh Video Alerts Demystified, Designing a Mac-to-VGA Adapter with LM1881
Within the late Nineteen Eighties When Apple launched its first Macintosh fashions supporting exterior shade displays, the corporate made some design decisions that proceed to trigger bother even at the moment. Computer systems just like the Macintosh IIci supported 640 x 480 video decision, the identical decision because the VGA customary that was frequent within the PC world, however they used a distinct bodily connector for the monitor cable, a distinct vertical refresh price, and a distinct technique of encoding sync data. It’s these sync variations which have confirmed to be most problematic over time. Let’s take a look at what all is required to make use of my Macintosh IIci with a contemporary LCD monitor. Seize some espresso and get comfy, as a result of this might be an extended one.
Monitor Connector Comparability
The basic Macintosh video connector is a DB-15, with two rows of pins. The proper title for that is truly DA-15, however practically all people calls it DB-15 and we’ll observe that conference. The VGA connector is a DE-15 with three rows of pins. That is typically known as HD-15 owing to its “excessive density” association of pins. Regardless of the bodily variations, the video indicators on the 2 connectors are largely the identical: (pinout information from sfiera)
Sign | Mac | VGA |
Pink video | 2 | 1 |
Pink floor | 1 | 6 |
Inexperienced video | 5 | 2 |
Inexperienced floor | 6 | 7 |
Blue video | 9 | 3 |
Blue floor | 13 | 8 |
HSYNC | 15 | 13 |
HSYNC floor | 14 | 5 |
VSYNC | 12 | 14 |
CSYNC | 3 | NC |
VSYNC/CSYNC floor | 11 | 10 |
Sense 0 | 4 | NC |
Sense 1 | 7 | NC |
Sense 2 | 10 | NC |
Floor | shell | shell |
This distinction in bodily connectors is pretty straightforward to unravel with an adapter. Through the Nineties and 2000s you can discover a Mac-to-VGA adapter at any pc retailer. At the moment they’re extra uncommon, however nonetheless out there from surplus digital suppliers or eBay.
Alerts and Sync
A really temporary primer on video sign codecs: A video sign consists of a collection of traces, organized into frames. The traces are output from the video {hardware} one after the other, at a hard and fast price, and the timing of every line is indicated with an HSYNC pulse from the video {hardware}. After all of the traces in a body have been output, there’s a VSYNC pulse earlier than the beginning of the subsequent body. The monitor wants these sync pulses to maintain its show working in lockstep with the video sign.
The 640 x 480 VGA customary makes use of 60 frames per second – its vertical refresh price is 60 Hz. However Apple selected a 67 Hz refresh price for its 640 x 480 video format (truly 66.666666…), which could possibly be argued is barely higher than 60 Hz as a result of the upper price leads to diminished flickering on CRTs. The distinction is negligible, nevertheless, and the 67 Hz price solely serves to complicate issues. Thankfully most fashionable moderns help a reasonably big selection of vertical refresh charges, the place a variety like 50-75 Hz is frequent. Which means the 67 Hz refresh price normally isn’t an issue. If you understand of a counter-example, please inform me.
What about these sync indicators? Within the VGA customary, HSYNC and VSYNC are offered as separate enter indicators on VGA pins 13 and 14. It’s good and easy, finish of story. However within the basic Macintosh video world, sync is… difficult. There’s a good quantity of bewilderment and fantasy about this subject floating across the net, so I’m right here to clarify the reality. From the desk above we will see that the Mac has outputs for HSYNC and VSYNC, but in addition for CSYNC composite sync (HSYNC xor VSYNC). Many individuals have additionally heard about sync on inexperienced, the place composite sync is blended immediately into the inexperienced video channel. So what precisely is the Mac video sync customary? Does it output separate HSYNC and VSYNC, or CSYNC, or sync on inexperienced?
The reply is sure, the Mac generates all of these sync requirements at totally different instances, relying on what sort of monitor it thinks is related. But it surely doesn’t generate all of them all the time. The video {hardware} checks the voltages on the connector’s three sense pins, which kind a 3-bit monitor ID for the related monitor sort. If it’s a supported monitor sort, the video {hardware} configures itself for an applicable output sign and sync technique. If it’s not a supported monitor sort, the video {hardware} shuts off and outputs nothing.
Right here’s a web page from a Macintosh IIsi hardware developer note. The IIsi’s video {hardware} is almost an identical to my IIci:
We are able to see that 4 several types of displays are supported, however two of them share the identical monitor ID and sign format. For a 15 inch portrait monitor, the Mac outputs separate HSYNC and VSYNC indicators precisely like VGA requires, however on the mostly-useless portrait decision of 640 x 870. For the 13 inch RGB monitor customary that we’re concerned about, with 640 x 480 decision, HSYNC and VSYNC are caught excessive and the sync data is offered by way of CSYNC.
What about sync on inexperienced? Though it’s not talked about wherever within the developer word, the Mac additionally outputs sync on inexperienced any time it outputs composite sync. It outputs each CSYNC and sync on inexperienced. In truth, it additionally outputs sync on purple and sync on blue too – all three shade channels have embedded sync data when composite sync is used. This was lately confirmed conclusively with a video {hardware} schematic evaluation adopted by a collection of checks by dougg3 (Doug Brown), who kindly gave me permission to breed his oscilloscope captures right here.
Doug hotwired his IIci’s monitor connector, grounding pin 4 (sense 0) to provide the monitor ID for 640 x 480 RGB. He made this scope seize displaying the Mac’s CSYNC output (yellow hint) and purple video sign (cyan hint). On CSYNC you’ll be able to see the shorter HSYNC pulses and the longer VSYNC pulse mixed with the HSYNC pulses throughout it. On the purple channel, you’ll be able to see some purple video information on the left, with the sync data clearly additionally current within the decrease voltage vary.
Trying on the inexperienced channel additionally confirmed the identical factor – embedded composite sync within the inexperienced video information. Doug then appeared on the VSYNC output (cyan hint):
Nothing. VSYNC was only a fixed excessive voltage. Nothing to see right here. This confirms the data from the developer word: when CSYNC is output, VSYNC and HSYNC are turned off.
DIP Swap VGA Adapters
Now we all know sufficient to start peeking contained in the frequent Mac to VGA adapters, with their complicated arrays of DIP switches, to grasp how they work. Should you’ve been round basic Macintosh computer systems for some time, you’ve absolutely seen many variations of those:
Clearly they’re bodily adapters from DB-15 to HD-15, however what do all these DIP switches do? For practically all such adapters, the heart are merely a passive swap matrix, controlling how the Mac pins are related to the VGA pins. There’s no sign processing of any sort. The DIP switches sometimes carry out two capabilities:
Monitor ID – Configure how the sense pins are related to floor, or to one another, to set the specified monitor ID. This tells the Mac what sort of video sign to generate.
Sync mapping – VGA VSYNC can optionally be related to Mac VSYNC. VGA HSYNC could be related to Mac HSYNC or Mac CSYNC.
They’re fairly easy units. Perhaps you’re questioning why you’d ever need to join the Mac’s CSYNC to the VGA monitor’s HSYNC. Many more moderen displays are in a position to settle for composite sync as a substitute for HSYNC and VSYNC, and if they’ve that functionality, they’ll usually anticipate CSYNC on their HSYNC enter. Offering a DIP swap mapping for this can allow the Mac to work immediately with such displays.
Notice that there are not any DIP swap settings associated to sync on inexperienced. If the monitor helps sync on inexperienced, it can use the sync data within the inexperienced video channel with no further configuration wanted. If the monitor doesn’t help sync on inexperienced, too dangerous.
The Unhappy Story of One Macintosh IIci, 4 Displays, and No Pleasure
Are you continue to awake? With all of this background exposition completed, we’re lastly prepared to inform the story that impressed this complete investigation. It’s the story of my Macintosh IIci, 4 totally different displays, a bunch of various Mac-to-VGA adapters, and loads of frustration resulting in eventual understanding and the design of a brand new video adapter.
For a number of years I’ve been utilizing my Macintosh IIci with the Griffin Mac PnP adapter pictured above and a Dell 2001FP LCD monitor, and it’s labored nice. This explicit monitor additionally has a composite video enter that works with Apple II and different basic pc {hardware}, so it’s a superb instrument for pc collectors. As to precisely how the Mac IIci video labored with this monitor, I by no means gave it any thought. I simply plugged it in and acquired an image.
A few weeks in the past I went on a purchasing spree and bought a ViewSonic VG900b 19-inch LCD, a Viewsonic 6 TX-14H30 14-inch CRT, and an E-Machines ColorPage T16 II 1108DT16MR 16-inch CRT. These are all multisync shows, with a max decision of 1024 x 768 on the CRTs and 1280 x 1024 on the LCD. However once I related them to my Mac IIci with the Griffin adapter, I acquired no image from any of them. I attempted zillions of DIP swap settings, I attempted totally different adapters, however nothing helped. All three of those fussy displays merely refused to indicate any picture from my IIci. They behaved as if nothing had been related.
Now that we perceive the video indicators and the interior workings of the DIP swap adapters, we will see the seemingly purpose that nothing labored. In 640 x 480 mode the Mac IIci outputs composite sync and sync on inexperienced. My 2001FP should help one or each of these sync requirements, however the brand new displays most likely don’t help them. Within the case of the VG900b this was confirmed within the {hardware} specs listed in its guide, the place it lists help for “H/V Separated (TTL)” video sync. Different Viewsonic LCDs from the identical period particularly point out composite sync and sync on inexperienced of their specs, so this isn’t seemingly simply an unintentional omission from the documentation. I haven’t been capable of finding detailed specs for the 2 CRT displays, however I’m guessing it’s the identical challenge. These displays require separate HSYNC and VSYNC indicators, and gained’t help some other sync format.
LM1881 to the Rescue
What do you do when your pc outputs composite sync, however your monitor requires separate HSYNC and VSYNC? Say whats up to the Texas Devices LM1881 Video Sync Separator.
This chip is designed to extract composite sync from composite video, a video customary during which composite sync is blended with RGB shade information. In our case the composite sync is already separated from the colour information and doesn’t have to be extracted, however the LM1881 has one other characteristic we will reap the benefits of: synthesis of a separate VSYNC sign from the composite sync enter. Sadly the LM1881 doesn’t have a complementary HSYNC output. There are different rarer and costlier chips that may extract each HSYNC and VSYNC, however I haven’t investigated these.
Thankfully for us, I’ve realized that many (most?) displays will settle for CSYNC as an alternative to HSYNC, as long as a separate VSYNC sign can also be offered. So all we actually want is VSYNC, and the LM1881 can do the job.
Armed with this data, I got down to construct a Mac to VGA adapter with an built-in LM1881 that might allow my Macintosh IIci to work on these three fussy displays. I’d use the LM1881 to extract VSYNC from CSYNC, passing the VSYNC to the VGA monitor, and I’d cross CSYNC to HSYNC with my fingers crossed.
I started with a DB-15 breakout. I related up all of the grounds, and grounded pin 4 (sense 0) to request Mac 13 inch 640 x 480 mode. I plugged the breakout into my Macintosh IIci, and related a logic analyzer to all three sync outputs. CSYNC confirmed the anticipated composite sync with a interval of 15 ms (66.67 Hz), whereas HSYNC and VSYNC remained excessive.
Subsequent I soldered some wires to an LM1881 breakout PCB. The LM1881 requires a 5V provide, which isn’t current on the monitor connector, so I stole 5V from the floppy disk port. Later I intend to attempt self-powering the LM1881 utilizing the (in any other case unused) VSYNC and HSYNC indicators as an influence supply.
Analyzing the LM1881 composite sync output, I noticed that the output adopted the enter as anticipated.
However zooming in, the indicators weren’t fairly the identical. The LM1881 output lagged the CSYNC enter by about 100ns, and included a really brief low pulse earlier than going excessive and low once more, for every pulse on the CSYNC enter. This may need been an artifact of utilizing a logic analyzer to view the sign, quite than an analog oscilloscope.
Then I soldered one other wire to LM1881 pin 3, the synthesized VSYNC output. It labored! However the extracted VSYNC lagged the enter VSYNC by an entire line, and prolonged a number of traces previous the tip of the enter VSYNC. This was sudden, however I imagine the precise timing and length of the VSYNC sign isn’t vital, as long as the refresh frequency is appropriate.
Up to now, so good. I completed the adapter by including an HD-15 breakout. I related the LM1881’s VSYNC output to VGA VSYNC, and LM1881 CSYNC output to VGA HSYNC. Bear in mind, this second connection isn’t actually appropriate – CSYNC is just not HSYNC – however we’re counting on the premise that displays will settle for CSYNC on their HSYNC enter so long as in addition they have a separate VSYNC sign. Due to the LM1881, we now had that lacking VSYNC sign.
Right here’s the completed adapter, together with the floppy port adapter for stealing 5V: it truly is a giant mess o’ wires, and one thing so ugly that solely a mom may adore it.
I’ve talked about that I’ve one monitor that’s labored with my IIci’s built-in video all alongside: the Dell 2001FP. And three displays that don’t work, it doesn’t matter what settings I’ve tried on the VGA adapters: the Viewsonic VG900b LCD, Viewsonic 6 CRT, and E-Machines CRT.
As a sanity examine, I attempted the Dell first:
It nonetheless labored, however the video high quality was awful: there was every kind of shimmering and noise within the picture. Perhaps it was a results of my messy nest of wires snaking all over the place? At the very least there was a usable picture.
Subsequent I attempted the Viewsonic VG900b LCD. This was the true check, since this monitor had refused to sync with my IIci video earlier than. Would it not work now?
Whomp whomp, so sorry. There was no love from the VG900b, which nonetheless complained there was no video sign after which went to sleep. That was disappointing. Perhaps the VG900b doesn’t like CSYNC as HSYNC substitute, or possibly it’s confused by the CSYNC that’s additionally nonetheless current on the RGB channels.
OK, how about this Viewsonic 6 CRT? It by no means labored with the IIci video earlier than, however how about now?
Success, it labored! The picture high quality was fairly good too. There was nonetheless a little bit little bit of shimmer, however a lot lower than with the Dell 2001FP. I’m unsure why there was such a distinction, possibly one thing about digital versus analog video circuitry?
The ultimate check was the E-Machines 16 inch CRT. This was the third member of the fussy trio that had refused to work with my IIci built-in video earlier than:
Huzzah! It additionally labored (minus some picture centering). The picture high quality was much like the Viewsonic CRT: some shimmer, however not too dangerous.
Design of a New Mac-to-VGA Adapter
That’s a rating of two out of three for this Mac-LM1881 adapter. I believe that’s helpful sufficient to deserve being made into a correct PCB package, for different basic Macintosh pc homeowners who’ve confronted the identical monitor challenges. Because it’s such a easy circuit, I’ll most likely share the entire PCB design for anyone who desires to make their very own, and in addition inventory a couple of within the BMOW retailer for anyone that desires a pre-built adapater.
To help with troubleshooting, I’d additionally like to incorporate some LEDs within the adapter to indicate which of the Mac sync outputs have exercise, and possibly additionally which of the RGB outputs have exercise. I haven’t fairly found out how to do that. The RGB outputs are solely 0.7V, and should have unfavourable voltage swings if sync on inexperienced is used. The sync outputs are customary TTL ranges with 0 to 5V swing. I’ve been brainstorming construct an “exercise detector” circuit to activate an LED with out involving a microcontroller. Perhaps one thing with a flip-flop the place the sync sign is used because the clock enter, and there’s an RC circuit with applicable time fixed related to the flip-flop’s asynchronous clear. When you’ve got any nice concepts for this, please share them.
Some questions concerning the LM1881 stay. I belatedly learn the chip’s information sheet solely after I’d completed my experimentation, and realized that I could also be utilizing it incorrectly, and that most of the related circuits seen on the internet are utilizing it incorrectly. Referring to the canonical LM1881 circuit diagram proven above:
- Why didn’t the Viewsonic VG900b work with the LM1881 sync indicators? Is there one thing easy I may do to repair it?
- The datasheet says the beneficial enter voltage on pin 2 is 1.5V and absolutely the max is 3V, however I’m feeding it a 5V sync sign from the Mac.
- A unique RC filtering scheme on enter pin 2 could also be wanted – the 0.1 uF blocking capacitor is simply an instance. “Typical Purposes” within the datasheet reveals an alternate design with an RC lowpass filter on pin 2.
- The worth of the R-set resistor could have to be adjusted, relying on video timing. The default worth of 680 kOhm could also be inappropriate for this.
- The LM1881 output pins can solely supply a couple of mA of present, but when I’m placing 5V right into a 75 ohm terminated monitor enter, gained’t that be 67 mA? Do I must buffer these indicators? 67 mA is a fairly large quantity of present, and greater than even most buffers can present. Maybe I’ve misunderstood this. Do I additionally want a 75 ohm resistor on the supply? Does 75 ohm termination even apply to the sync indicators, or is that just for the RGB indicators?
The investigation continues. Extra updates quickly, I hope!