BRX PLC INC DEC 512 Registers for DMX512

I was recently asked the following question after posting the Analog Dust to Dawn program:
” I was wondering if there’s an easy way to increment and decrement a range of values.
e.g. I have a range of registers (V100 ~V611) the values in each register are different. But I want to increment or decrement all the registers values by 1 at the same time. So that the ramp rate is the same.
Is that possible without having to do 6 rungs of logic for each register?
To elaborate a little on my use case. 512 registers were chosen because that equals one DMX universe. So my scaling factor is 0~255.
16 channels are mapped to two BX-08DA-2B modules to control 0-10 fixtures. All other channels are mapped to SERIO module to control DMX512 fixtures and other devices.”

We will be looking at the DMX512 protocol and how to control 512 registers at a time using our BRX PLC (Do-More). Let’s get started!



Previously in this BRX series PLC, we have discussed:
System HardwareVideo
Unboxing – Video
Installing the SoftwareVideo
Establishing CommunicationVideo
Firmware Update – Video
Numbering Systems and AddressingVideo
First ProgramVideo
Monitoring and Testing the ProgramVideo
Online Editing and Debug ModeVideo
TimersVideo
CountersVideo
High-Speed IOVideo
Compare InstructionsVideo
Math InstructionsVideo
Program ControlVideo
Shifting InstructionsVideo
Drum InstructionVideo
Serial Communication – Modbus RTU to Solo Process Temperature ControllerVideo
Data LoggingVideo
Email – Text SMS Messaging GmailVideo
Secure Email Communication Video
AdvancedHMI Communication – Modbus TCPVideo
Analog IO – System ConfigurationVideo
HTTP JSON InstructionsVideo
Analog Dusk to Dawn ProgramVideo

Our entire series can be found here.
https://accautomation.ca/series/brx-do-more-plc/
The programming software and manuals can be downloaded from the Automation Direct website free of charge.

Watch the video below to see the INC DEC 512 Register for DMX512 program in action on our BRX PLC.

DMX512 Hardware
This is a stage lighting control protocol allows the BRX platform to easily send and receive commands to most DMX512 devices and controllers.

The DMX512 protocol is available on the BX-SERIO expansion module. This module will add four additional serial ports to any BRX system. Depending on the base unit (MPU), up to 8 modules can be added.

DMX512 Protocol
DMX512 is commonly used to control stage lighting, dimmers and special effects devices such as fog machines and intelligent lights. DMX can also be used to control non-theatrical interior and architectural lighting as well as electronic billboards.
A DMX512 network is called a “DMX universe.” Each communications port on a DMX512 controller can control a single universe.
The physical layer of DMX12 is based on the RS-485 standard. It is unidirectional. This means that the master will send out the information approximately 40 times a second but no reply is returned from the slave units.
Data for the DMX512 protocol for both master and slave is stored in a structure that is created when the protocol is selected in the serial port setup. If you do not change the name of the serial port, it will default to DMXA to DMXD for serial port 1 to 4 respectively. To access the data, you would use DMXx0 to DMXx511, where x equals A, B, C or D assuming that you did not change the serial port name from default. The values for the data range are between 0 and 255.
Further information can be found in the BRX Do-More! Serial Communication chapter in the BRX User Manual.

BRX Program
We will be using the Do-More Designer Simulator to modify 512 registers at a time.  This will simulate the DMXx0 to DMXx511 registers for one DMX universe. We will use V100 to V611 as our analog variables that will range from 0 to 255.

The program consists of the main program that will call up subroutines that will set all of the registers.

X0, when on, will call the Increment subroutine on the leading edge of the one-second clock bit to add one to each of the 512 registers from V100 to V611.

The for next loop is from 100 to 611 at V0. This means that the value in V0 will change from 100 to 611. This acts as the pointer.
V[V0] will represent V100 to V611.
The increment instruction will increment the V area from V100 to V611 as it loops through all of the registers.
The compare instruction will ensure that we will not go above our limit for each of the registers. (0-255) (0-FF Hex)

X1, when on, will call the Decrement subroutine on the leading edge of the one-second clock bit to subtract one from each of the 512 registers from V100 to V611.

The decrement instruction will decrement the V area from V100 to V611 as it loops through all of the registers.
The compare instruction will ensure that we will not go below our limit for each of the registers. (0-255) (0-FF Hex)

X2, when on, will call the Max_All_Words subroutine. This will put the value 255 (FF) into each of the 512 registers from V100 to V611.

The MOVE instruction will set the V area from V100 to V611 to the value of 255 as it loops through all of the registers. 255 = FF Hex

X3, when on, will call the Reset_All_Words subroutine. This will put the value 0 (00) into each of the 512 registers from V100 to V611.

The MOVE instruction will set the V area from V100 to V611 to the value of 0 as it loops through all of the registers.

Changing individual registers in our DMX Universe. This code will allow for the selection of one of the registers to change. This can easily be modified for HMI (screen) input.

Scale WX0 – 0 – 4095 to 100 to 611 – This will represent the register in our DMX Universe that we want to change.

Scale WX1 – 0 – 4095 to 0 to 255 – This will represent the data for our register in our DMX Universe that we want to change.

When X7 turns on our data (V2) will be moved indirectly to our selected register in our DMX universe.
If this was using a BX-SERIO card the indirect move would be DMXx[V1]. We would ensure that the range of V1 would be 0 to 511.
Note: DMXx0 to DMXx511, where x equals A, B, C or D assuming that you did not change the serial port name from default.

Watch the video below to see the INC DEC 512 Register for DMX512 program in action on our BRX PLC.

You can download the program here.

BRX Series PLC from Automation Direct – Power to deliver
Overview Link (Configure and purchase a system)
Manuals and Product Inserts (Installation and Setup Instruction)
Do-More Designer Software v2.0.3 (Free Download Link) – The software will contain all of the instruction sets and help files for the BRX Series PLC.

Watch on YouTube : BRX PLC INC DEC 512 Registers for DMX512
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.




Leave a Reply

Your email address will not be published. Required fields are marked *