Home AMX User Forum NetLinx Studio

first program in amx ,facing issues

hi

i just finished making my 1st program for a small auditorium that has projector,lift,screen,vol card,AMX dimmer,vcr,dvd,NI 3100,MVP 7500.

i mapped the ir files to their respective devices dvd (5001:9:0),VCR (5001:10:0)

my problem is NI3100 shows only the input led blinking when i press the buttons

the relays,ir,rs232 leds don't light up

do i have to any more device mapping,i have mapped my touch panel

Comments

  • viningvining Posts: 4,368
    Well I don't know the last time I mapped anything including IR files since I tend to send them once through IR Edit and again only if modified or the IR file in the master appears to be corrupt.

    Post your code and we'll take a look see. Since there are so many possible reasons trying to diagnose this w/o the code isn't practical.
  • HedbergHedberg Posts: 671
    Ok, since this is your first AMX program:

    Not only do you have to "map" your ir files to the proper device, you also have to use file transfer to actually load the IR file into the appropriate device.

    Can you briefly outline the steps you have taken to write, compile, and load your program and your touch panel files, perhaps with a little information about how your program handles a particular button press that is not giving you the result you expect? The reason that I ask about this is because basically you are saying that your program isn't doing anything and it's nor easy to offer an explanation as to why that might be without some more information about what you are doing.
  • here's the code

    i have defined my devices in the "main" file,which is my master.i have only one real tp ton,i created the other touch panels so i dont have to remember the number of buttons created.Is this ok.

    Also after writing the code ,i build the active system ,it shows no errors.

    i have also mapped the ir files to their respective devices dvd(5001:9:0) and vcr(5001:10:0),

    DEFINE_DEVICE

    dvChristie =5001:1:0 // serial is port 1
    dvTpChristieMVP7500 =10001:1:0

    dvExtron =5001:2:0 // serial is port 2
    dvTpExtronMVP7500 =10001:2:0

    dvAXBVol =5002:1:0 // nxc volume control card connected to icsnet
    dvTpAXBVolMVP7500 =10001:3:0

    dvScreen =5001:8:0 // relay is port 8
    dvTpScreenMVP7500 =10001:8:0

    dvLift =5001:8:0 //relay is port 8
    dvTpLiftMVP7500 =10001:11:0

    dvDVD =5001:9:0 // ir port 9
    dvTpDVDMVP7500 =10001:9:0

    dvVCR =5001:10:0 // ir port 10
    dvTpVCRMVP7500 =10001:10:0

    dvTPMain = 10001:1:0 // This should be the touch panel's main port

    vdvLightSystem = 41012:1:0 // The COMM module should use this as its duet device
    dvLightSystem = 224:1:0 // This device should be used as the physical device by the COMM module
    dvLightSystemTp = 10001:27:0 // This port should match the assigned touch panel device port

    dvTpAutomationMVP7500 =10001:12:0

    And for each device i have made a separate include file which is called from the "main" file

    #INCLUDE 'IncChristie.axi'
    #INCLUDE 'IncExtron.axi'
    #INCLUDE 'IncScreen.axi'
    #INCLUDE 'IncDVD.axi'
    #INCLUDE 'IncVCR.axi'
    #INCLUDE 'IncLift.axi'


    DEFINE_MODULE 'AMXRadia_UI' lightsystem(vdvDev, dvLightSystemTp, dvTPMain, nLightSystem, nLightSystemPages, sLightAddress)
    DEFINE_MODULE 'ModuleComponent' module(vdvDev, dvLightSystemTp, dvTPMain, nLightSystem, nModulePages)
    DEFINE_MODULE 'AMX_Radia_Comm_dr1_0_0' comm(vdvLightSystem, dvLightSystem)


    Below are my include files for each device

    //DVD player

    PROGRAM_NAME='IncDVD'

    DEFINE_VARIABLE

    INTEGER nDVDButton[]=
    {
    1

    }

    DEFINE_EVENT

    BUTTON_EVENT[dvTpDVDMVP7500,nDVDButton]
    {
    push:
    {
    pulse[dvDVD,get_last(nDVDButton)]
    }
    }

    //projector lift

    PROGRAM_NAME='IncLift'

    DEFINE_VARIABLE

    INTEGER nLiftButton[]=
    {
    4,//UP
    5,//DOWN
    6//STOP
    }

    DEFINE_MUTUALLY_EXCLUSIVE

    ([dvTpLiftMVP7500,1]..[dvTpLiftMVP7500,3])



    DEFINE_EVENT

    BUTTON_EVENT[dvTpLiftMVP7500,nLiftButton]
    {
    push:
    {
    switch(get_last(nLiftButton))
    {

    case 1:
    {
    ON[dvLift,4]
    }
    case 2:
    {
    ON[dvLift,5]
    }
    case 3:
    {
    ON[dvLift,6]
    }
    }
    }
    }

    // my extron switcher

    PROGRAM_NAME='IncExtron'

    DEFINE_VARIABLE

    INTEGER Index

    char Sbuff[40]

    INTEGER nExtronbutton[] =
    {
    1,2,3,4, // VGA

    5,6,7,8, // S- video

    9,10,11,12 //video
    }

    DEFINE_START

    create_buffer dvExtron,Sbuff

    DEFINE_EVENT

    DATA_EVENT[dvExtron]
    {
    online:
    {
    // Set Baud for Projector
    send_command dvExtron,"'SET BAUD 9600,N,8,1'"
    }
    }


    BUTTON_EVENT[dvTpExtronMVP7500,nExtronbutton]
    {
    push:
    {
    Index = GET_LAST(nExtronbutton)
    SWITCH(Index)
    {
    CASE 1:
    {
    // VGA
    send_string dvExtron,"'1!'"
    break
    }
    CASE 2:
    {
    // VGA
    send_string dvExtron,"'2!'"
    break
    }
    CASE 3:
    {
    // VGA
    send_string dvExtron,"'3!'"
    break
    }
    CASE 4:
    {
    // VGA
    send_string dvExtron,"'4!'"
    break
    }
    CASE 5:
    {
    // S-video
    send_string dvExtron,"'5!'"
    break
    }
    CASE 6:
    {
    // S-video
    send_string dvExtron,"'6!'"
    break
    }
    CASE 7:
    {
    // S-video
    send_string dvExtron,"'7!'"
    break
    }
    CASE 8:
    {
    // S-video
    send_string dvExtron,"'8!'"
    break
    }
    CASE 9:
    {
    // video
    send_string dvExtron,"'9!'"
    break
    }
    CASE 10:
    {
    // video
    send_string dvExtron,"'10!'"
    break
    }
    CASE 11:
    {
    // video
    send_string dvExtron,"'11!'"
    break
    }
    CASE 12:
    {
    // video
    send_string dvExtron,"'12!'"
    break
    }
    }
    }
    }
  • //DVD player
    
    PROGRAM_NAME='IncDVD'
    
    DEFINE_DEVICE
    
    dvDVD =5001:9:0 // ir port 9
    dvTpDVDMVP7500 =10001:9:0
    
    
    DEFINE_VARIABLE
    
    INTEGER nDVDButton[]=
             {
                1
             }
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTpDVDMVP7500,nDVDButton]
    {
    push:
             {
             pulse[dvDVD,get_last(nDVDButton)]
             }
    }
    
    

    This will only fire IR for one button on the DVD touch panel (port 9), or 10001:9:1, since you only have one channel listed in your nDVD button array.

    You can eliminate the array altogether by using the wild card:
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTpDVDMVP7500,0]  // 0 is the wild card fr any button fired on that port of the TP
    {
    push:
             {
             pulse[dvDVD,BUTTON.INPUT.CHANNEL]
             }
    }
    
    

    If your IR files are correctly mapped to their corresponding deivces and loaded to the master, you should be good to go!

    Your touch panel file for the DVD player should have the buttons properly defined, too.

    So the "play" button should be port 9, channel one, Stop: 10001:9:2... and so on, assuming your IR file codes are more or less mapped consistently with the SNAPI conventions.
  • HedbergHedberg Posts: 671
    ok, looking at your code for the DVD, if you have a button # 1 on your TP port #9 and you have properly loaded your IR file to 5001:9:0, and you have properly compiled and loaded your code to the master, and the IR file you loaded to 5001:9:0 has channel #1 properly populated (which should be 'Play', right?), then you should be getting a .5 second ir pulse from 5001:9:0 and you should see the light for 5001:9:0 blink for .5 sec..

    For your relays controlling your lift, there is confusion as to how you have actually numbered your buttons. Your variable array and your button event indicate that you have your buttons numbered 4, 5, and 6 but your mutually exclusive definition is making button numbers 1, 2, and 3 mutually exclusive. If your button numbers are 4, 5, and 6, then your relays should be turned on when you push one of those button numbers. Of course, there is no way for any of those relays to be turned off so after a while, all three relays will be stuck on.

    About your mutually exclusive: It appears that you are trying to prevent more than one relay among relays 4, 5, and 6 from being turned on at once. What you are actually doing is preventing the feedback for buttons 1, 2, and 3 from being turned on more than one at a time. Your mutually exclusive definitin should be for relays, not for touch panel buttons. i.e. [dvLift,4] [dvLift,5] [dvlift,6]

    I can't see anything wrong with your code for your Extron switcher, assuming it is a 12 input, 1 output switcher. Assuming, that is, that you have a tp port # 2 with the proper buttons (1 through 12) on it. Note that if it's properly configured that you are matching to an array index which exactly matches the number of the input that you wish to select so that you could, if you wanted, simplify your code by using the ITOA() function rather than the switch/case code. Also, in Netlinx, the 'break' is automatic and redundant. But, it looks to me as if you should be getting strings sent to port 5001:2:0 and you should be seeing the orange light for that port light when you hit buttons 1-12.

    Now about "device mapping." Device mapping in your netlinx studio project has exactly no effect on the operation of your program once it is properly loaded to your master. What device mapping is is an organization function for the programmer. The act of device mapping does not cause any IR files to be loaded unless you select the proper items in the project tree and load those items through file transfer. You don't need to map any devices at all in order to get the files properly loaded in file transfer (you can specify the devices and the files discreetly) and the act of mapping does not cause the files to load.

    So, lf you are still getting no indication that your strings are going out RS232 port 2 and you still are not getting a red flash on port 9 (second IR port) and your relays 4, 5, and 6 are not being properly activated and deactivated, it's time to look over the Netlinx studio diagnostics functionality and verify that when you push button 1 on tp port that's what the master is seeing. Also, use emulate a device and control a device to check things. With control, you can turne your relays on and off, etc. Also, use notifications to see if you are getting strings sent to the RS232 ports, etc.

    Finally, from looking at your code, it looks is if you have a very good understanding of a lot of things both about writing code in general and about how to write code for a Netlinx master in particular. I don't think you are very far from getting this to work perfectly.

    Good luck with it.
  • DarksideDarkside Posts: 345
    my problem is NI3100 shows only the input led blinking when i press the buttons
    Reading between the lines I assume there is no output LED.

    Any serial string mapped to the correct port should at least blink the LED. The output LED should always flash.

    Are you sure your NI is dev 5001?
  • You should consider placing your code inside the [ code] and [/code ] tags (without the spaces between the braces).
    it will make your post much more readable
    

    --John
  • hey guys ,

    i got it to work ,now all my led's are working

    the only change i did ,was i changed my mutually exclusive for the include files to dvlift and dvscreen instead of the touch panels

    and i added the ir channels for my dvd and vcr

    now all my led's are blinking with the corresponding buttons been pressed.

    dont know what was the problem ,maybe it got caught in some infinite loop :)

    Also i learned how to use diagnostics.

    i m so happy :)

    Thank you all for your help
Sign In or Register to comment.