Updating multiple labels

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
jmusselman64
Posts: 31
Joined: 15 May 2018 21:05

Updating multiple labels

#1 Post by jmusselman64 » 16 Sep 2018 01:23

OK...I got no bites on my DMA question a couple weeks ago, so I'll try this one instead..

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
My Mikromedia dsPIC33EP runnnig at 140Mhz executes this sub in 2.5ms. To me that seems like a long time for ll it's doing, especially at 140MHz
(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

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Updating multiple labels

#2 Post by petar.suknjaja » 17 Sep 2018 16:31

Hi,
Do you have some other code, rather than this snippet?
Could you share the project?

Kind regards,
Petar

jmusselman64
Posts: 31
Joined: 15 May 2018 21:05

Re: Updating multiple labels

#3 Post by jmusselman64 » 18 Sep 2018 02:53

Hi Petar,

I will attempt to get a smaller version together to send out...but it might not be right away. It's basically a small controller for several different brands of obsolete automated stage lights.
They can be controlled by the touchscreen or by DMX-512 input. The control signals to the various fixtures (only one at a time) vary from 19.k async serial, 230.4k FM0 encoded serial, 100k differential async serial with CRC-16 checksum, and 1Mb differential Manchester encoded HDLC synchronous serial (that one will get a separate processor to do the Manchester and HDLC un-stuffing)
It's definitely a work in progress... I'd like to find some way to emulate a traditional character LCD display, as I've got a chunk of code from a previous project that does part of what I need.
I tried using string functions (strcopy and strmove) but it seems really awkward. I have looked at the 'Calculator' demo for some ideas as well.

Jerry

jmusselman64
Posts: 31
Joined: 15 May 2018 21:05

Re: Updating multiple labels

#4 Post by jmusselman64 » 19 Sep 2018 05:25

Hi Petar-

I've attached the project I spoke about. I cut out everything irrelevant to the DMX input screen I'm working on.

The idea is to display DMX data on a screen similar to an LCD character display. The top row is the channel number, the next row is the data.


Jerry
Attachments
DMX_In_Test.zip
(516.16 KiB) Downloaded 99 times

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Updating multiple labels

#5 Post by petar.suknjaja » 19 Sep 2018 08:10

Hi,
Thank you Jerry for submitting this,
I will review it and try to find the solution to this.

Kind regards,
Petar

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”