First Module...Newbie

I finished P1 a month or so ago and I finally have a functioning system at home that I can play with. I downloaded the JVC LCD Duet 232 module and loaded it and the TP file on my system. However, since this is my first time using a module, can you folks give me some pointers? I was going to add some channel events for button presses (that's what the module calls for), but I can't seem to get started, other than this:
Channel_Event [dvTP,9]
{
PUSH:
{
PULSE,
}
}
What do I need to add in order to get a button press to send a command via the 232 port?
I have loaded the duet firmware on my ni-700 already.
«1

Comments

  • rfletcherrfletcher Junior Member Posts: 217
    I think you're actually looking for a button event.
    button_event[dvTP,9]
    {
        push:
        {
    
        }
        hold[]:
        {
    
        }
        release:
        {
    
        }
    }
    
    I haven't looked at that specific module, but most duet modules use channels for control. You can either turn a channel on/off, or pulse it.
    on[vdvDevice,1]
    off[vdvDevice,1]
    pulse[vdvDevice,1]
    

    The instruction file that came with the module should tell you what each channel does, and if it's an on/off type control or a pulse type control. Many modules also recognize send_commands and/or send_strings.
    send_command vdvDevice, 'something'
    send_string vdvDevice, 'something'
    

    Both the channel controls, send_commands, and send_strings go in the button_event (or in any other type of event), in the section of the event that corresponds to when you want the command to execute.

    Hope that helps.
  • vegastechvegastech Junior Member Posts: 369
    I figured that it had to be a button event...after all, I AM pressing buttons...it was just odd that the doc that came with the module was talking about channel events and not mentioning button events. I guess there are a few things simply inferred already.
  • rfletcherrfletcher Junior Member Posts: 217
    vegastech wrote: »
    I figured that it had to be a button event...after all, I AM pressing buttons...it was just odd that the doc that came with the module was talking about channel events and not mentioning button events. I guess there are a few things simply inferred already.

    I think the module documentation is referring to the type of event the module is watching for on the virtual device. I can see how it could be a bit confusing if you've never used a module before though. There were certainly some things that confused me for a bit the first time I used one. :D
  • viningvining X Member Posts: 4,354
    vegastech wrote:
    I figured that it had to be a button event...after all, I AM pressing buttons.
    True you are pushing a button on a TP which in turn triggers a button_event in your code. This is the basic communcations between the TP and the master. Now that the master has received a button push from a TP it needs to do something with it. As rfletcher pointed out earlier there are several things that can now happen in the button_event.

    1, send a string directly to a device to do something.
    2, send a command to a module to have the module send a string to a device.
    3, set a virtual channel on/off (usually pulse on so it resets to off automatically) to cause the module to send a string to the device.

    Of course not all button pushes are going to result in a string being sent to a device but instead handle logic, set flags or what have you but for the sake of this discussion let's assume that the result of a TP button push is to send a string to a device.

    Typically most newer modules will use channel_events to trigger the module to send a string. Push a button on a TP which triggers a button_event in the master and in the code for this button number you pulse a virtual channel. This pulse sets the virtual channel on then resets to off (so it can be turned on again later). Now in the module they'll use a channel_event instead of a button_event which will see the channel go on and execute the code for that channel number which in our case will send some string to our device to do something.
  • John GonzalesJohn Gonzales Junior Member Posts: 609
    Incidentally, when you're using a module you'll want to run your interaction with the physical device through the module. In other words if you have a module running and you want to send a command directly to the device, you're better off using the module's passthru command. The reason for this is that the module should queue up the commands and send them to the device when it's ready. If you communicate directly with the devcie while the module is communicating you could end up with errors/failures.

    --John
  • vegastechvegastech Junior Member Posts: 369
    In reading my previous post, I typed it like I was being sarcastic: (I figured that it had to be a button event...after all, I AM pressing buttons. ) I apologize for that. I meant it as a "Oh yeah, of course it should be! Why didn't I think of that?"

    Anyway, I have been successful in getting 232 control to work, however intermittently. I think I have forgotten to initialize the port on my NI for the proper 232 settings. Does this look right for the netlinx programming?
    DATA_EVENT[dvDVD2]LCD
    //Data Event for LCD Serial Control
    {

    ONLINE:
    {

    SEND_COMMAND dvLCD,"'SET BAUD 19200,O,8,1'"
    }
    }
  • vegastechvegastech Junior Member Posts: 369
    Actually, upon further reading of the module's .doc, it already has a communications module built-in, so I am assuming that upon processor initialization, the comm port will be initialized for the correct settings. Sound right?
  • vegastechvegastech Junior Member Posts: 369
    So let me ask this: I know that many modules to not function perfectly, but shouldn't I be able to at least get consistent, functional commands if they work the first time? Power Off and Power On seem to work intermittently, along with channels up and down. I am wondering if the strings(channel events) are indeed being sent out correctly every time I press the button. What can I do to parse the data being sent out to my tv and view it in netlinx, when it comes to a module? Can I create a buffer, upload, and drag it into diagnostics? With regard to getting more info on the module without obtaining CafeDuet, would tech support be able to look at the module and tell me what it's doing?
  • viningvining X Member Posts: 4,354
    vegastech wrote:
    but shouldn't I be able to at least get consistent, functional commands if they work the first time?
    We are talking about an AMX written module aren't we? Need I say more. :)

    Kidding aside, of course you should get consistent results, otherwise what's the point.

    You should set up your own buffer to see what's returning from the device but with duet modules you'll need to use the "PASSBACK" command otherwise you won't get anything in your buffer even if you "CREATE_BUFFER" for that device. Also use diagnostics "device notifications" to watch what's being sent to the device. There should also be some debug command you can send to the module or set a channel to turn on which will print to the diagnostics windows things the programmer felt would be worth watching.
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    If they followed the API properly, there should be an INIT command to (re)establish communications. There may also be a properties command that needs to be sent to set the appropriate parameters. The documentation should spell this out, though it may be buried in there.

    PASSBACK may or may not be implemented. Duet takes over the I/O, and standard buffers won't work, period. I don't think even direct commands to the port will work; it's going through the Java portion of the SNAPI router, and I don't think anything on the NetLinx side works unless the module specifically hooks it. If PASSBACK wasn't implemented, your only option is to physically connect to the port and monitor it.
  • vegastechvegastech Junior Member Posts: 369
    Now I'm cookin' with Gas! I THINK I was able to get Passback enabled, but I'm not sure - When I look in my notifications tab, I can see all of my button presses/releases, as well as my serial commands being output, but I only see this in regard to feedback:
    Line 61 (09:15:13):: Command From [41001:1:1]-[XCH-36]
    I had told the TV (via the module) to change to channel 36. The TV did not change, and I see this line repeating every 30 seconds:
    Line 64 (09:15:13):: String To [5001:1:1]-[!$82$80CH36$0A]
    Am I correct in assuming that this means that the TV is not responding in a timely manner, or that it is not receiving the correct code (based on perhaps an incorrect com port setting) and not functioning correctly? I find it interesting that first thing this morning I walked up to the TV, pressed the power on button on my TP, and it worked. I was able to press channel up 1 time, and then not again.

    I do have about a 25 foot run of cat5 with rj45-DB9 adapters plugging into the tv and my ni-700. Should I move my controller closer, or is there something else I can do to check the setup of the TV, perhaps?
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    You should be able to get far more than 25' with CAT5 adapters; I don't think that is the issue. If the TV is turning on, well, it can't be a cable issue. I think it's more likely the module isn't completely compatible with the TV protocol. Try sending individual numbers (3 and 6 separately, for example) rather than using XCH.
  • viningvining X Member Posts: 4,354
    We are talking a serial connection, correct? The XCH is confusing me making me think IR but I suppose the module comms are using this format to exchange serial commands.

    What TV are you trying to control? The ! (bang command) looks familiar but I don't recall what brand uses it. What's the module name? Might be easy for us to just take a look at it instead of guessing.

    Now you're using CAT-5 w/ an RJ-45 to DB9 adapter so I'll go out on a limb and say we're talking an RS232 connection. 50' is the recommended max length while some references will say 5,000 feet at a low baud of 9600 is ok. Stick with the 50' especially when using non-shielded high capacitance wire.

    Now I suppose it's possible that your TX line is properly connected but your RX line isn't. Maybe you're using too many pins. Most connection just need pins 2,3 & 5 and having other pins tied in will cause RX to fail. Now the fact that the module is sending repeatedly for what should be a single issue command would make me think that the module expects some sort of ACK (acknokledgement) response whether it be an actual ack, ok or an echo of the command sent. It's not getting one so it resends it.

    You did say the power worked occasionally but the TV didn't respond to a channel change, hmmm.... Sounds like a mix of issues..
  • vegastechvegastech Junior Member Posts: 369
    yes, it is indeed a serial connection. I only ever use pins 2,3,and 5 for serial connx due to the issues stated previously. The module I am using is for a JVC LCD, model # LT-42X898. The module is one that I pulled from the AMX website, ( http://amx.com/inconcert/ct/DevMdlDetails.asp?A=Sh&MdlNo=29972&MANNo=559&lk=28b0e6840f106e5f3dc328dea4d19445 )so I'm going out on a limb here and am hoping everything is the same for each model of TV this protocol works on (according to the jvc serial protocol pdf, found here: http://support.jvc.com/consumer/support/documents/RS-232Cver16.pdf ). At this point I am going to try basic serial string control without using the module to see what I can control. That being said, I have added this into my workspace file to initialize the serial port. does this look correct?
    DATA_EVENT[dvJVC]
    {
    ONLINE:
    {
    SEND_COMMAND dvJVC, "'SET BAUD 19200,O,8,1'"
    }
    }
    The TV requires 19200 baud, Odd parity (I rarely see this...),8 data bits, 1 stop bit, and uses ASCII for communication mode.
  • vegastechvegastech Junior Member Posts: 369
    Ok, one problem caught and fixed:

    I decided to run a terminal emulator program on my pc to capture the commands coming from my ni processor. When I use a premade null modem cable, my commands come thru exactly as I have executed them in the programming. When I use the db9-rj45 adapters and a length of cat5, everything gets jacked up. I'll have to look at the cable and/or try new adapters to see if that helps. The downside is that I still cannot get the LCD to respond to 232 strings. I was able to begin to decode the protocol-it wants both ascii and hex, so I've got that figured out (I think) to a point. I can see my strings being output, but still no joy. I guess I will call JVC in the morning to try and determine if I may have issues with the 232 port or something else that I may be missing in the code structure.
  • vegastechvegastech Junior Member Posts: 369
    OMG ITS FIXED!!!! It was the friggin db9 adapters/cat5. The Cat5 I was using was good, but everything fell into place once I used a bunch of db9 cables daisy-chained across my floor to the tv. I am happy that it works, but don't the NI controllers ONLY use pins 2,3,and 5? Why would a null modem cable (all 9 wires) cause it to work? The obvious answer is either one of the db9 adapters is bad, or my pinout is wrong. The interesting thing was that this appeared in my term. emulator software with the rj45/cat5 cable connected:
    FF FB 57 F7
    While I see this when I use the null modem cable(s):
    21 82 80 50 57 31 0A

    Does that make me a better programmer than installer? Good thing it's at my house...
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,166
    vegastech wrote: »
    OMG ITS FIXED!!!! It was the friggin db9 adapters/cat5. The Cat5 I was using was good, but everything fell into place once I used a bunch of db9 cables daisy-chained across my floor to the tv. I am happy that it works, but don't the NI controllers ONLY use pins 2,3,and 5? Why would a null modem cable (all 9 wires) cause it to work? The obvious answer is either one of the db9 adapters is bad, or my pinout is wrong. The interesting thing was that this appeared in my term. emulator software with the rj45/cat5 cable connected:
    FF FB 57 F7
    While I see this when I use the null modem cable(s):
    21 82 80 50 57 31 0A

    Does that make me a better programmer than installer? Good thing it's at my house...

    I've been doing this for many years. And it's always the same for me. There's just something about rs232 that I end up flubbing around with it before it works as advertised. I've actually just built it into the price. I always seem to end up futzing around with connections, terminations, port setup, settings on the device, programming, etc... And to be frank, it's funny how many times it just seems to start working magically for no known reason. rs232 has always been kind of a black art, in my opinion.
  • vegastechvegastech Junior Member Posts: 369
    I hate to beat a dead horse....
    But I'm still having difficulty getting a 2,3,5 wire connection to work on this JVC LCD. The premade null modem cable works fine every time (extended with additional straight thru premades at about 25 feet). I tried to disassemble the premade null cable (I have extras),and it seems that pins 1 and 6 were shorted together along with the wire from pin 4. I tried to duplicate this, but still nothing. Has anyone been able to successfully control a JVC device (Projector, etc.) via 232 with only 3 wires? JVC support knows nothing other than where the serial protocol is posted on their website.
  • viningvining X Member Posts: 4,354
    Buy some of these: http://www.easyadapters.com/products.php?cat=8&PHPSESSID=d4943586c20039f52035e3f307201483

    I got so tired of the various RJ45 - DB9 adapters with different pin outs I now usually just use these and leave them in permanently. Not to mention the earlier models that required soldering. It just isn't worth it, now if it doesn't work straight through it takes a 5 seconds to reverse pins 2 & 3 on one end.
  • vegastechvegastech Junior Member Posts: 369
    I think I'm just going to leave the premade cable in place for now. All the time i wasted trying to get it to work has really detracted from my actual programming/testing time.

    That being said, I am working on getting variables, and therefore button presses, to work. I have my passthru commands working, but is it possible to set a variable in a Switch...Case scenario? I have a Sw/Case setup for my discrete power buttons, and I want to set my nTVPWR variable to 1 when ON, and 0 when Off. Can I do this in a Sw/Case setup, or should I use a different programming style for this?
  • viningvining X Member Posts: 4,354
    You can pretty much put or do anything you want in the code for a case in a switch. Post your code when you get a chance or if you have issues or questions and the guys here on the will take a look at it.
  • arvinninoarvinnino Junior Member Posts: 17
    newbie here

    hi guys i just want to ask, can i define constant with more than i numbers?

    for example:

    DEFINE_CONSTANT

    ODD = 3, 5, 7
    SERIES = 1, 2, 3, 5, 8

    Thanks a lot
  • truetrue Junior Member Posts: 307
    arvinnino wrote: »
    hi guys i just want to ask, can i define constant with more than i numbers?

    for example:

    DEFINE_CONSTANT

    ODD = 3, 5, 7
    SERIES = 1, 2, 3, 5, 8

    Thanks a lot
    define_constant
    ODD[3] = {3, 5, 7}
    SERIES[5] = {1, 2, 3, 5, 8}
    
    define_program
    wait (10) {
        send_string 0, "'odd[1] = ', itoa(ODD[1]), '; series[3] = ', itoa(SERIES[3])"
    }
    
  • arvinninoarvinnino Junior Member Posts: 17
    another question

    How can set a specific expression for IF ELSE statement..

    for example:
    send string if "nLevelValue" is greater than or equal to 224 but not less than or equal to 192

    if i use the expression which is the last

    IF(nLevelValue >= 224)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 12',$0D,$0A"
    }

    the system will send all the strings from the beginning of the if statements that has a lower value. please see may sample. any thoughts about this?? thanks

    LEVEL_EVENT[dvMET,WHEEL_LVL]
    {
    IF([dvMET,1])
    {
    nLevelValue = LEVEL.VALUE
    SEND_LEVEL dvMET, LED_LVL, nLevelValue
    SEND_STRING 0,"'teller level is ',itoa(level.value)"

    IF(nLevelValue >= 0)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 -2',$0D,$0A"
    }
    IF(nLevelValue >= 32 )
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 0',$0D,$0A"
    }
    IF(nLevelValue >= 64)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 2',$0D,$0A"
    }
    IF(nLevelValue >= 96)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 4',$0D,$0A"
    }
    IF(nLevelValue >= 128)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 6',$0D,$0A"
    }
    IF(nLevelValue >= 160)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 8',$0D,$0A"
    }
    IF(nLevelValue >= 192)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 10',$0D,$0A"
    }
    IF(nLevelValue >= 224)
    {
    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 12',$0D,$0A"
    }
    }
    }
  • viningvining X Member Posts: 4,354
    In your code example if the nLevelValue is 0ver 224 every "IF" will fire. You'd be better off using a select active like this:
    LEVEL_EVENT[dvMET,WHEEL_LVL]
         {
         IF([dvMET,1])
    	  {
    	  nLevelValue = LEVEL.VALUE
    	  SEND_LEVEL dvMET, LED_LVL, nLevelValue
    	  SEND_STRING 0,"'teller level is ',itoa(level.value)"
    	  
    	  SELECT
    	       {
    	       ACTIVE(nLevelValue <= 32 )
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 0',$0D,$0A"
    		    }
    	       ACTIVE(nLevelValue <= 64)
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 2',$0D,$0A"
    		    }
    	       ACTIVE(nLevelValue <= 96)
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 4',$0D,$0A"
    		    }
    	       ACTIVE(nLevelValue <= 128)
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 6',$0D,$0A"
    		    }
    	       ACTIVE(nLevelValue <= 160)
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 8',$0D,$0A"
    		    }
    	       ACTIVE(nLevelValue <= 192)
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 10',$0D,$0A"
    		    }
    	       ACTIVE(nLevelValue <= 224)
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 12',$0D,$0A"
    		    }
    	       ACTIVE(nLevelValue <= 255)
    		    {
    		    SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 12',$0D,$0A"
    		    }
    	       }
    	  }
         } 
    
    This way the first to be evaluated as true will fire and the rest will not. Notice I changed the > sign to <. Otherwise only the first "ACTIVE would ever fire.

    Note if you copy & paste this code these send strings are off from the original code and need to be fixed.
  • viningvining X Member Posts: 4,354
    This might also work and is a bit shorter:
    LEVEL_EVENT[dvMET,WHEEL_LVL]
         {
         IF([dvMET,1])
    	  {
    	  SEND_LEVEL dvMET, LED_LVL, LEVEL.VALUE ;
    	  SEND_STRING 0,"'teller level is ',itoa(LEVEL.VALUE)"
    	  SEND_STRING dvBiamp,"'SET 1 FDRLVL 17 1 ',itoa(((LEVEL.VALUE % 32) * 2) -2),$0D,$0A"
    	  }
         } 
    
    Now I don't know if sending the level coming from the MET KP wheel to the MET KP display is a good idea or not. I would think the display value would be the reference for the level the wheel is sending out which would create a level loop. I would use the level value from the BiAmp device to display and act as the level reference for the wheel.
  • viningvining X Member Posts: 4,354
    vining wrote: »
    This might also work and is a bit shorter:
    Now I don't know if sending the level coming from the MET KP wheel to the MET KP display is a good idea or not. I would think the display value would be the reference for the level the wheel is sending out which would create a level loop. I would use the level value from the BiAmp device to display and act as the level reference for the wheel.

    Just so happens I was playing with this yesterday and with what I've tried so far sending the level directly from the wheel (METKP LVL 2) back to the display (METKP LVL 1) works better than sending level to my autopatch, converting the AP's response and sending back to the METKP's display.

    I used my left / right wheel scroll (btns 12,13) to set a var to qualify my level event but I also use this to block my feedback to the keypad from the autopatch. The display feedback is directly fed back to the keypad until the btn 12,13 are released and the qualifying var is set back to 0 and then the final display feedback is from the autopatch in a sense to confirm the display. I'll have to play with this some more since it does seem a bit convoluted and I ususally prefer to receive all FB from the device being controlled.

    Outof curiosity how are other folks handling this level display feedback on the MET KP6Ns?
  • arvinninoarvinnino Junior Member Posts: 17
    I have 20pcs MET 6N keypad each located on a different rooms, they are all identical:

    Button 1 of Met 6N located at room 1 is for light control, Button 1 of Met 6N located at room 2 is for light control and so on..

    Button 2 of Met 6N located at room 1 is for light control, Button 2 of Met 6N located at room 2 is for Fan control and so on..

    however for button 6 it has a common device for all to control, if keypad 1 is using button 6 the rest shouldnt be able to use their button 6 until keypad 1 press button 6 again to turn it off. the other user will know that someone is using the button 6 because the light on their button 6 is ON.

    here's what i did, for keypad 1 and i need to write this on the rest of the keypad. Is there any other way to write this? thanks for the help.

    BUTTON_EVENT[dvMET,6]
    {
    PUSH:

    [dvMET,6] = ![dvMET,6]

    IF (![dvMET,6])
    {
    ON [dvMET,6]
    ON [dvMET2,6]
    ON [dvMET3,6]
    .......
    ON[dvMET20,6]

    CALL 'Default'
    }

    ELSE
    {
    OFF [dvMET,6]
    OFF [dvMET2,6]
    OFF [dvMET3,6]
    .......
    OFF[dvMET20,6]

    CALL 'DEFAULT2'
    }
    }
  • viningvining X Member Posts: 4,354
    Here's a quick and simple way to do it
    DEFINE_VARIABLE //DEV dvMETKP_Arry[20]
         
    VOLATILE DEV dvMETKP_Arry[20] = 	
    
    	  {
    	  dvMETKP_1,  
    	  dvMETKP_2,  
    	  dvMETKP_3,
    	  
    	  //.....
    	  
    	  dvMETKP_20   
    	  } 
    	  
    DEFINE_EVENT //BUTTON_EVENT[dvMETKP_Arry,0]
    	  
    BUTTON_EVENT[dvMETKP_Arry,0]//zero will catch all button presses or use an array of buttons
         
         {
         PUSH:
    	  {
    	  STACK_VAR INTEGER nBtn ;
    	  STACK_VAR INTEGER nKP_Indx ;
    	  	    
    	  nBtn = BUTTON.INPUT.CHANNEL ; //or GET_LAST(nMETKP_BtnArry) if an array is used;
    	  nKP_Indx = GET_LAST(dvMETKP_Arry) ;
    	  
    	  SWITCH(nBtn)
    	       {
    	       CASE 1:
    		    {
    		    //do something btn 1
    		    SWITCH(nKP_Indx)
    			 {
    			 CASE 1:
    			      {
    			      //do something for KP1
    			      }
    			 CASE 2:
    			      {
    			      //do something for KP2
    			      }
    			 CASE 3:
    			      {
    			      //do something for KP3
    			      }
    			 CASE 4:
    			      {
    			      //do something for KP4
    			      }
    			      
    			 //.......
    			 CASE 20:
    			      {
    			      //do something for KP20
    			      }
    			 }     
    		    }
    	       CASE 2:
    		    {
    		    //do something btn 2
    		    }
    	       CASE 3:
    		    {
    		    //do something btn 3
    		    }
    	       CASE 4:
    		    {
    		    //do something btn 4
    		    }
    	       CASE 5:
    		    {
    		    //do something btn 5
    		    }
    	       CASE 6:
    		    {
    		    LOCAL_VAR INTEGER nKP_InCharge ;
    		    
    		    if(!nKP_InCharge || nKP_InCharge == nKP_Indx)
    			 {
    			 LOCAL_VAR INTEGER nBtn_6 ;
    			 
    			 nBtn_6  = !nBtn_6;
    			 if(nBtn_6)
    			      {
    			      ON[dvMETKP_Arry,6] ;
    			      nKP_InCharge = nKP_Indx ;
    			      
    			      //do something for on state
    			      }
    			 else
    			      {
    			      OFF[dvMETKP_Arry,6] ;
    			      nKP_InCharge = 0 ;
    			      
    			      //do something for off state
    			      }
    			 }
    		    }
    	       CASE 7:
    	       CASE 8:
    	       CASE 9:
    	       CASE 10:
    	       CASE 11:
    	       CASE 12:
    	       CASE 13:
    	       	    {
    		    //do something or nothing
    		    }
    	       DEFAULT:
    		    {
    		    //do a send string for WTF!
    		    }
    	       }
    	  }
         }
    
    I personally prefer varaible to tracking channels states since I feel it's easier to debug by dropping the var in the debug window rather that checking port status and refreshing all the time. Unless the system is so large you can't afford to waste vars that is.

    You can get rid of the swtich case for nKP_Indx if using the index in the statement directly can get the job done. Use a look up table or just an array of lighting commands indexed to match the KP indexes.

    What are you doing with button 6 anyway that makes it a first user has the use of it type of program?
  • arvinninoarvinnino Junior Member Posts: 17
    hi vining,

    i really appreciate your help. actually my program is for the 20 interview booth using biamp controlled by met 6N.

    button 1 for interviewer mic select
    button 2 for interviewee mic select
    button 3 for interviewer mute button
    button 4 for interviewee Mute button
    button 5 for paging location 1
    button 6 for paging location 2
    Jog dial for volume control

    let me attach my axs. to give you an idea on what am i talking about.
    it is not really complicated at first in fact i was able to finish programming one keypad and make it functioning, but when i used more that 1 keypad it started to get more complicated. button 1 to 4 is not a big deal because it was assign on a different device regardless on what keypad you will use, however for the button 5 and 6 there is only 1 device to control for all keypad and obviously they cannot use it at the same time.

    My problem is how can i link all button six so that if anyone use button six it will enable the rest of button 6 and others cannot use it until the first user press it again and disable the button six. im sorry for my question, this is my first module and i never thought it would be this complicated for me.
Sign In or Register to comment.