Home AMX User Forum AMX General Discussion

quick binary question

I'm working with a Kramer 6-1 VGA Switcher that has a rather simple 232 interface. I'm linking the protocol guide below

here

I've never dealt with this before so I wanted to double check, as I don't have a model in front of me to test with. The way I'm reading it, as long as my machine number is 1 (so N6N5N4 is 000), the number I'm sending for the input I want to switch to is just that input number (i.e., 00000011 for input 3, 00000101 for input 5).

If thats the case, do I just send it in decimal or hex? something like
send_string dvVGASwitch,"$06"

or

send_string dvVGASwitch,"6"

Will both of those work? If sending it in decimal works, can I do this?
button_event [dvTP,dvSwitchBtns]
{
    push:
    {
        send_string dvVGASwitch,"button.input.channel-38"
    }
}

assuming dvSwitchBtns is an array of 6 buttons from 39 to 44, which should switch the VGA switch to inputs 1-6 respectively?

Thanks

Comments

  • mpullinmpullin Posts: 949
    Jeff wrote:
    I'm working with a Kramer 6-1 VGA Switcher that has a rather simple 232 interface. I'm linking the protocol guide below

    If thats the case, do I just send it in decimal or hex? something like
    send_string dvVGASwitch,"$06"
    
    or
    
    send_string dvVGASwitch,"6"
    

    Will both of those work? If sending it in decimal works, can I do this?
    It doesn't say the protocol is ASCII so they're looking for 6, not 36. send_string dvDEV, "$06" should be ok.
    Jeff wrote:
    button_event [dvTP,dvSwitchBtns]
    {
        push:
        {
            send_string dvVGASwitch,"button.input.channel-38"
        }
    }
    

    assuming dvSwitchBtns is an array of 6 buttons from 39 to 44, which should switch the VGA switch to inputs 1-6 respectively?

    Thanks
    Yes, that should work, although personally I think it would be less of a headache if you did this:
    send_string dvDEV,"GET_LAST(dvSwitchBtns)"
    
    Works no matter what the button channels are, as long as they are in the array in the right order.
  • Will all work.
  • JeffJeff Posts: 374
    Thanks a bunch. You're right about the get_last, at the moment its using button.input.channel because I just stacked the button events, I haven't gotten around to actually creating the array, which I need to do.

    Also, in my original example, I had the 6 by itself in double quotes, but not single. Thats decimal, not ASCII, right? Just want to make sure

    J
  • mpullinmpullin Posts: 949
    Jeff wrote:
    Also, in my original example, I had the 6 by itself in double quotes, but not single. Thats decimal, not ASCII, right? Just want to make sure
    Right, single quotes is a string literal (read: ascii) while double quotes is an expression.
  • Jeff wrote:
    I had the 6 by itself in double quotes, but not single. Thats decimal, not ASCII, right?

    Decimal, in the sense of binary!
Sign In or Register to comment.