Home AMX User Forum AMX General Discussion

Volume control for LG TVs via RS232

Can anyone help me Volume up/down for LG tvs ??

The volume control command is 'k f 00 ~ 64' but how would I incorporate it into volume up/down ??

Thanks.

Comments

  • BrallenBrallen Posts: 25
    It's actually 0 to 100 (0-64 in hex). They want you to send the ascii representation of the hex number in the command IIRC.
  • mvadormvador Posts: 17
    Oh ok.. But in either case, how would I incorporate it for volume up and volume down ??
  • PhreaKPhreaK Posts: 966
    You will need to use a variable to track the current volume, you can then add/subtract your desired increment/decrement to this. You can then form a command string by utilizing the ITOHEX() function to create a create a string representation the volume's hex equivalent, then send it to the device
    SEND_STRING dvTV, "'k f ',ITOHEX(nVolume)"
    
    Ideally you should then update this volume variable based on feedback from the device, that way if someone changes the volume on the tv itself the next time the control system is used to change the volume it won't suddenly jump in level.
  • mvadormvador Posts: 17
    thanks a lot guys.. appreciate your help..
  • You should also consider implementing a queue to send the strings to the device. You can do a search for "queue" on the forums and you should be able to find some info.

    --John
  • jjamesjjames Posts: 2,908
    In case anyone is interested in all the commands or is looking for them.
    http://www.amxforums.com/showpost.php?p=40282&postcount=5
  • Awesome !! Thanks a lot James...
  • I'm a little confused by this - how does the variable that tracks the current volume assist in determining the next step up in volume? The string I see below:

    SEND_STRING dvTV, "'k f ',ITOHEX(nVolume)"

    is just sending the current volume value to the TV. How does that variable get increased with the button press? Is it like this:


    SEND_STRING dvTV, "'k f ',ITOHEX(nVolume(+1))" ?

    Or would I use constants set to 1 and -1, accordingly?

    Or would I create another variable that changed based on pressing vol up or vol down, where it would set itself to 1 or -1?
  • BUTTON_EVENT [dvTP, dcVOL_UP]
    {
    PUSH:
    {
    nVOL ++
    {
    SEND_STRING dvDEVICE, " '(* LG PROTOCOL *)', ITOHEX (nVOL) "
    }
    }
    }
    
    BUTTON_EVENT [dvTP, dcVOL_DOWN]
    {
    PUSH:
    {
    nVOL --
    {
    SEND_STRING dvDEVICE, " '(* LG PROTOCOL *)', ITOHEX (nVOL) "
    }
    }
    }
    
    

    thats a very simplified way of doing it. I would actually do it with a button array to discern whether you were pushing the UP or DOWN button using GET_LAST and compressing it all to a single button event. you will need holds and repeats too i would think. Or do it with a LEVEL_EVENT using a bargraph, using Level control buttons, that way you only need the one LEVEL_EVENT and let the TP do the incre-/decrementing.
  • jjamesjjames Posts: 2,908
    Thats a very simplified way of doing it. I would actually do it with a button array to discern whether you were pushing the UP or DOWN button using GET_LAST and compressing it all to a single button event. you will need holds and repeats too i would think. Or do it with a LEVEL_EVENT using a bargraph, using Level control buttons, that way you only need the one LEVEL_EVENT and let the TP do the incre-/decrementing.

    Exactly, except I use timelines and functions for it (coupled with button arrays.) The timeline does the "repeat" portion, and the function does the management of variables & strings; this way, if there's multiple devices that do volume (say an Autopatch and an Integra receiver), you can use one button event for all touch panels.
  • PhreaKPhreaK Posts: 966
    vegastech wrote: »
    I'm a little confused by this - how does the variable that tracks the current volume assist in determining the next step up in volume? The string I see below:

    SEND_STRING dvTV, "'k f ',ITOHEX(nVolume)"

    is just sending the current volume value to the TV. How does that variable get increased with the button press?
    That code snippet was just an example of the hex conversion. You will need to incriment / decriment the volume variable on the button push / hold. There are many ways of doing this as others have alluded to.
Sign In or Register to comment.