Function Realization: PLC's volume Control to LPC

Source: Internet
Author: User

Design Scenario 1:

On the PLC, when using qdial to adjust the volume, trigger the Qdial signal:valuechange (), corresponding slot sends the custom key code 0x22 to LPC;

On LPC, when the 0x22 key is received, the operation: set the current volume value, when the setup is complete, the PLC will receive the volume data from LPC to update.

Problem found:

1, when the trigger valuechange () signal, due to LPC set 3s no activity automatically enter the volume display interface, the PLC is still sending 0x22 key code every 3s, resulting in VfD has been shown 0x22 key code, other keys can be used normally, However, the operation will still enter the 0x22 display screen and blink once every 3s (the reason is that the volume interface is displayed but is 0x22 refreshed immediately).

2, send the data only a byte can carry data, with command data will not be able to carry the volume data, rewriting the protocol is relatively troublesome.

3, because the display 0x22 is also one of the function code operation, set the 3 second delay in LPC, so there will be problem 1 problem. You must turn off the 0x22 key to set the delay.

Design Scenario 2:

Set a Volume mirror variable volume_2 (volume_2 set as a global variable), qdial get the value of volume_2 and judge it with the current value, and send it after the direction volume+ (ADKey5) and volume-(ADKEY6) signal to LPC, directly perform the add and subtract operation.

Problem found:

1, with the qdial control of the trigger signal valuechange () will cause the volume has been zero, because the change in the occurrence of the value of the trigger to send changes to the volume of the function, resulting in a continuous change in volume;

2, use release () to do the trigger signal in the process of numerical change LPC does not respond, each time regardless of the number of adjustments to how much, do only one change.

3, the bottom is used to display the volume of the label without Valuechange trigger signal.

Workaround:

Remove the LBL control, switch to Spinbox and create a signal-slot relationship with qdial, hide the Spinbox button (it looks like a label), and use Spinbox valuechange as the trigger signal. This ensures that the value changes in real time with qdial, the problem is basically solved, but the effect is not ideal. Due to the use of loops, the difference is calculated once per change of the value in real time, resulting in noticeable jitter. There is no workaround.

Attention:

1, in the implementation of the function, as far as possible to avoid the use of global variables, reduce the difficulty of transplant and space occupancy;

2. The existing communication protocol cannot be rewritten.

Function Realization: PLC's volume Control to LPC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.