New unit and not so clever programmer

Hi all I am working with an rs422 switcher which accepts quite readily direct commands such as send_string "'R",'02','04',$0D"
as a newbe I cant find the way to make this work in the format I am used to with say ...autopatch

I have attached the file .. look particularly at the section DNF .. this is where I am having the issues although I know for sure the matrix is accepting ascii I understand I am doing somthing wrong ..but I do not know what. Can some one help?
indebted
Nigel

Comments

  • HedbergHedberg Junior Member Posts: 671
    add 48

    It looks to me like this is the important line of code:

    send_string dvSWC2,"'R',(rsinput),(rsoutput),$0D"

    rsinput and rsoutput appear to be the input and output numbers that you want,
    but the switcher expects the ascii representation of these integers.

    Try this:

    send_string dvSWC2,"'R',(rsinput) + 48 ,(rsoutput) + 48 ,$0D"

    or this:

    send_string dvSWC2,"'R',ITOA(rsinput),ITOA(rsoutput),$0D"

    Also, you might check the way that rsoutput is calculated. I haven't looked at your code carefully, but it appears to me that there may be an error there.
    Sorry if I misread.

    Good luck.

    Harold
  • HedbergHedberg Junior Member Posts: 671
    Two things should be mentioned:

    1. You have a 24 output switcher. Adding 48 to the integer channel number will not give an appropriate ASCII code if the channel number is greater than 9. So, using ITOA is necessary.

    2. If you need to pad single digit channels with a zero, you can use the technique described by B Clements in the recent ITOHEX thread (I don't think the FORMAT function is available for Axcess code):
    send_string dvSWC2,"'R',Right_String(" '0',ITOA(rsinput)",2),Right_String(" '0',ITOA(rsoutput)",2) ,$0D"
    

    Harold
Sign In or Register to comment.