Author: ajcord
Subject: DMX driver for 83/84
Posted: 30 Dec 2012 12:00:55 am (GMT -5)
I wrote a simple DMX driver for Axe programs. It uses assembly opcodes to access the link port and the CPU timer, but it's designed to be included into normal Axe programs and accessed through a subroutine. I am not an expert at assembly though, so it may have errors. If I was better at assembly then I might make it into an axiom instead of an include file since it's pretty much all assembly anyway.
The problem is that I can't test the driver out on a real DMX system because a) I don't have any DMX or link cables to splice, and b) I'm not an electrical engineer, so I have no idea if such a cable is even possible. If it is, how simple would it be to make? Is it as easy as connecting the ring/tip to the pins, or does it require more work to make them compatible?
The rest of this post describes the workings of DMX. Most of the following information I found at http://www.dmx512-online.com/physl.html and http://elationlighting.com/pdffiles/dmx-101-handbook.pdf.
DMX cables use XLR connectors. They have 5 pins in a semicircle arrangement, but only the first 3 are used. Pin 1 is ground, Pin 2 is the negative data wire, and Pin 3 is the positive data wire. Pins 4 and 5 are spare. The pins are numbered counterclockwise from the top left on the male connector, and clockwise from the top right on the female connector. Here's a diagram:
![]()
One thing worth mentioning: Although my diagram is labeled as an XLR connector, and technically XLR cables should be interchangeable with DMX cables, they are not suitable for DMX wiring in the real world because they can't carry a 250 kHz signal well. Never replace a DMX cable with an XLR cable.
A 0 bit is sent when Pin 2 is a higher potential than Pin 3, and a 1 bit is sent when Pin 3 is higher than Pin 2. This is to nullify the effects of interference in the wires because both wires are affected equally, so the potential difference is not changed by interference. However, the cable still needs shielding, and the lines should be twisted to ensure that they both receive equal interference. Also, the ground shield (Pin 0) should never be attached to the connector because it can cause data errors in such a case.
Both wires can go up to +12V and down to -7V, but only a difference of 0.2V is required to trigger a state change and therefore signal a bit. Most implementations send a +5V on one line and a -5V on the other to make a difference of +/-10V, but this is usually overkill. The reason for it is that on a highly resistive wire, the ending difference is probably still greater than 0.2V, which still signals a bit.
The cable works at 250 kHz, which means that each bit is measured in 4 microsecond intervals. My driver uses a CPU timer at 250 kHz to time the bit sending. It manually pulls each line low and high rather than trying to send bytes through the link assist because apparently the OS sends bits at 9.6 kHz. Anyway, to send a 0 bit, I pull the tip low and the ring high, and vice versa for a 1 bit. I can post the driver code if anyone is interested in checking for errors. It's nothing too complicated - only 205 bytes compiled.
What I want to know is if this cabling is as easy as connecting the tip to Pin 3 and the ring to Pin 2, or if there's more to it. Kerm said that the calculator outputs +5V for high and 0V for low, which seems like it should work for DMX. I'm not sure about all the nitty-gritty electrical details, which is why I'd like some input on this idea.
P.S. For those who don't know, DMX is both a protocol and a type of cable. It's used commonly in theaters for lighting and special effects, as well as in other settings. My goal with this driver is, if possible, to run lights in a theater from a calculator. Because that would be amazing.
Subject: DMX driver for 83/84
Posted: 30 Dec 2012 12:00:55 am (GMT -5)
I wrote a simple DMX driver for Axe programs. It uses assembly opcodes to access the link port and the CPU timer, but it's designed to be included into normal Axe programs and accessed through a subroutine. I am not an expert at assembly though, so it may have errors. If I was better at assembly then I might make it into an axiom instead of an include file since it's pretty much all assembly anyway.
The problem is that I can't test the driver out on a real DMX system because a) I don't have any DMX or link cables to splice, and b) I'm not an electrical engineer, so I have no idea if such a cable is even possible. If it is, how simple would it be to make? Is it as easy as connecting the ring/tip to the pins, or does it require more work to make them compatible?
The rest of this post describes the workings of DMX. Most of the following information I found at http://www.dmx512-online.com/physl.html and http://elationlighting.com/pdffiles/dmx-101-handbook.pdf.
DMX cables use XLR connectors. They have 5 pins in a semicircle arrangement, but only the first 3 are used. Pin 1 is ground, Pin 2 is the negative data wire, and Pin 3 is the positive data wire. Pins 4 and 5 are spare. The pins are numbered counterclockwise from the top left on the male connector, and clockwise from the top right on the female connector. Here's a diagram:

One thing worth mentioning: Although my diagram is labeled as an XLR connector, and technically XLR cables should be interchangeable with DMX cables, they are not suitable for DMX wiring in the real world because they can't carry a 250 kHz signal well. Never replace a DMX cable with an XLR cable.
A 0 bit is sent when Pin 2 is a higher potential than Pin 3, and a 1 bit is sent when Pin 3 is higher than Pin 2. This is to nullify the effects of interference in the wires because both wires are affected equally, so the potential difference is not changed by interference. However, the cable still needs shielding, and the lines should be twisted to ensure that they both receive equal interference. Also, the ground shield (Pin 0) should never be attached to the connector because it can cause data errors in such a case.
Both wires can go up to +12V and down to -7V, but only a difference of 0.2V is required to trigger a state change and therefore signal a bit. Most implementations send a +5V on one line and a -5V on the other to make a difference of +/-10V, but this is usually overkill. The reason for it is that on a highly resistive wire, the ending difference is probably still greater than 0.2V, which still signals a bit.
The cable works at 250 kHz, which means that each bit is measured in 4 microsecond intervals. My driver uses a CPU timer at 250 kHz to time the bit sending. It manually pulls each line low and high rather than trying to send bytes through the link assist because apparently the OS sends bits at 9.6 kHz. Anyway, to send a 0 bit, I pull the tip low and the ring high, and vice versa for a 1 bit. I can post the driver code if anyone is interested in checking for errors. It's nothing too complicated - only 205 bytes compiled.
What I want to know is if this cabling is as easy as connecting the tip to Pin 3 and the ring to Pin 2, or if there's more to it. Kerm said that the calculator outputs +5V for high and 0V for low, which seems like it should work for DMX. I'm not sure about all the nitty-gritty electrical details, which is why I'd like some input on this idea.
P.S. For those who don't know, DMX is both a protocol and a type of cable. It's used commonly in theaters for lighting and special effects, as well as in other settings. My goal with this driver is, if possible, to run lights in a theater from a calculator. Because that would be amazing.