I've got this section of code that displays values from a 16 byte buffer. The sub is executed in the main program loop.
It only executes if the value has changed since the last time through the loop.
Code: Select all
if DMX_RX_Buffer_Old[0] <> DMX_RX_Buffer[0] then 'see if anything changed
LabelDMX0.Font_Color = CL_Lime 'erase DMX channel value
DrawLabel(@LabelDMX0)
bytetohex(DMX_RX_Buffer[0],LabelDMX0_caption) 'get new DMX channel value
LabelDMX0.Font_Color = CL_Black ' reset DMX channel value text color
DrawLabel(@LabelDMX0) ' write new DMX channel value
DMX_RX_Buffer_Old[0] = DMX_RX_Buffer[0] 'old = new
end if
(Yes, I have confirmed I'm actually running at 140Mhz..well, 70 actually )
Questions:
1) I need to do this same sub 16 times. How do I put this in a FOR loop to iterate with all 16 label names, i.e. LabelDMX0, LabelDMX1, etc
2) Is there a faster way to do this? It's going to take 40ms to update all 16 channels. That may not seem like much, but there's a lot of other stuff going on, and screen writes always seem to slow things down.
I'm still picking up things in MikroBasic, so I probably missed something obvious.
Thanks much,
Jerry