It has been 3 or more years since I worked on low level code so things may have changed and the CM12 may differ from the CM11A but the current CM11A protocol documentation (Section 3.1.1) says...
Number of Dims is a value between 0 and 22 identifying the number of dims to be transmitted (22 is equivalent to 100%)
It can take quite some time for a Dim or Bright command to be sent over the powerline and the CM11A doesn't return the 0x55 until that has completed. From a web article I wrote...
21 contiguous commands require 231 half cycles of the powerline or 3.85 seconds @ 60Hz. If an address + gap precedes the sequence, the total becomes 4.27 seconds.
It will take 20% longer at 50Hz.
OTOH, if you are sending extended dims, that requires a different method. See Section 3.2 of the documentation.
I wrote a CM11A demo in RealBasic several years ago but no longer have the source. A networked HDD died a couple of years ago and it had lots of things like this.
I no longer use RealBasic as it appeared their main motivation was to milk maximum revenue from their
victims customers. I do have some ZBasic code but I'm not sure it will help you much and, as it was written 3+ years ago, I may not be able to answer questions. If you want the ZBasic code, send me a PM with your email address.