Home AMX User Forum NetLinx Studio

NI-3100 works only when the Diagnostic Net Linxs This On.

Very strange. My code runs only when the diagnosis of active Netlinxs eta. when I turn it to work.
Example: I'm clicking a button (input NXC-I / O 10) and runs a command to change the state of a relay (NXC-REL 10). all wheel when the diagnosis is active. When off, everything stops working. By Reconnect everything work again. and so on

I thought of many possibilities, but found no solution.
what did I do wrong?

System features:
- Central Controller NI-3100 - [0:1:1]
- CardFrame 1 = 12 IRs - # 25 [301:1:1] to [312:1:1]
- CardFrame 2 = 12 I/O - # 26 [313:1:1] to [324:1:1]
- CardFrame 3 = 12 Relays - # 25 [325:1:1] to [336:1:1]

All actions performed by the central one is sent SEND_STRING 0, "' Action Performed .....'"

Sorry for my English, translated by google

Comments

  • Please, anyone have any ideas?
  • mushmush Posts: 287
    Anarckos wrote: »
    Please, anyone have any ideas?

    G'day Anarckos,

    You will need to supply some code or a better description of the problem.
    What you've given so far is not enough information.

    Cheers
  • Ok...

    I will post a summary of the Code.
    OK, I have...
    DEFINE_DEVICE
    
    dvMaster		 = 0:1:1
    
    Virtual_TP_Bar	= 33001:8:1 // Virtual TP, Used to create a COMBINE_LEVELS later.
    
    TP_5200i		= 10001:0:1
    TP_5200i_BAR	= 10001:8:1 // Channel Bargraph
    
    TP_CV5_1		= 10002:0:1
    TP_CV5_1_BAR	= 10002:8:1 // Channel Bargraph
    
    TP_CV5_2		= 10003:0:1
    TP_CV5_2_BAR	= 10003:8:1 // Channel Bargraph
    
    TP_5150		= 10004:0:1
    TP_5150_BAR	= 10004:8:1 // Channel Bargraph
    
    // Dimmers
    v_DIMMER_01		= 28:1:1
    ...
    v_DIMMER_05		= 32:1:1
    
    // RELES 
    // #27 325 -> 336
    v_SLOT_RELEY_01		= 325:1:1
    ...
    v_SLOT_RELEY_12		= 336:1:1
    
    // I/O
    // #26 313 -> 324
    v_SLOT_IO_01		= 313:1:1
    ...
    v_SLOT_IO_12		= 324:1:1
    
    ...
    ...
    
    

    Variables...
    DEFINE_VARIABLE
    DEV Group_TPs_BAR[]	= {TP_5200i_BARr, TP_CV5_1_BAR, TP_CV5_2_BAR,TP_5150_BAR}
    
    INTEGER      v_DIMMER_01_Nivel_Channel_01        // Variable contains the value of the level of Channel Dimmer
    DEV            dv_Living_Light_Central = v_DIMMER_01 // Module refers to the Point of Light
    INTEGER     ch_Living_Light_Central = 1 // Canal Point of Light
    
    DEV            dv_Living_pulsator_P01	= v_SLOT_IO_01    // Card of the pulsator
    INTEGER     ch_Living_pulsator_P01	= 8 // channel Pulser
    
    INTEGER     v_TIMELINE_Living_pulsator_P01 = 1
    
    LONG v_TimePulse_Array[5]
    

    Start
    DEFINE_START
    v_TimePulse_Array[1] = 501	
    v_TimePulse_Array[2] = 2500	
    v_TimePulse_Array[3] = 60000
    v_TimePulse_Array[4] = 90000
    v_TimePulse_Array[5] = 120000
    
    SET_VIRTUAL_LEVEL_COUNT(Virtual_TP_Bar, 27) // Raises amount of TP Virtual Levels
    
    // DIMMER 01 - Channel 01
    CREATE_LEVEL dv_Living_Light_Central,ch_Living_Light_Central,v_DIMMER_01_Nivel_Channel_01
    COMBINE_LEVELS(Virtual_TP_Bar,ch_Living_Light_Central,		// TP Virtual
                     TP_5200i_BAR,ch_Living_Light_Central,	        // TP_5200i_BAR
    		 TP_CV5_1_BAR,ch_Living_Light_Central,	        //TP_CV5_1_BAR
    		 TP_CV5_2_BAR,ch_Living_Light_Central,	// TP_CV5_2_BAR
    		 TP_5150_BAR,ch_Living_Light_Central,	// TP_5150_BAR
    		  dv_Living_Light_Central,ch_Living_Light_Central)	 // Point of Light Dimming
    
    ....
    Continue for a total of 27 points Light
    ....
    

    Channel Events - Pulsator, Idea is here to Create a TIMELINE to control the time of the pulse. Short or Long.
    CHANNEL_EVENT[dv_Living_pulsator_P01,ch_Living_pulsator_P01] // IF  [v_SLOT_IO_01,8]
    {
        ON:
        {
    	SEND_STRING 0, "' - Msg ...'"
    	IF(!TIMELINE_ACTIVE(v_TIMELINE_Living_pulsator_P01))
    	{
    	    TIMELINE_CREATE(v_TIMELINE_Living_pulsator_P01, v_TimePulse_Array, 1, TIMELINE_RELATIVE,TIMELINE_ONCE)
    	}
    	ELSE
    	{
    	    TIMELINE_KILL(v_TIMELINE_Living_pulsator_P01)
    	    SEND_STRING 0, "' - Msg ....'"
    	    TIMELINE_CREATE(v_TIMELINE_Living_pulsator_P01, v_TimePulse_Array, 1, TIMELINE_RELATIVE,TIMELINE_ONCE)
    	}
        }
        OFF:
        {
    	SEND_STRING 0, "' Msg ....'"
    	TIMELINE_PAUSE(v_TIMELINE_Living_pulsator_P01)
    	
    	// Check if this is a short pulse (Pulse <= 500)
    	IF(TIMELINE_GET(v_TIMELINE_Living_pulsator_P01) < v_TimePulse_Array[1])
    	{
    	    // Yes it is short pulse
    	    SEND_STRING 0, "' - Msg ... '"
    	    // For function calls for Short Pulse
                function_Short_Pulse(....)
    	}
    	ELSE
    	{
    	    // Long Pulse
    	    SEND_STRING 0, "' - Msg ... '"
    	    // Function Points to End Long-Pulse
                function_Long_Pulse_End(....)
    	}
    	// Kill Time Line
    	IF(TIMELINE_ACTIVE(v_TIMELINE_Living_pulsator_P01))
    	{
    	    SEND_STRING 0, "' - Msg ... '"
    	    TIMELINE_KILL(v_TIMELINE_Living_pulsator_P01)
    	}
        }
    }
    

    TimeLine Event, Perform actions during the long pulse.
    TIMELINE_EVENT[v_TIMELINE_Living_pulsator_P01]
    {
        SWITCH(TIMELINE.SEQUENCE)
        {
    	CASE 1: // Long Pulse >= 501
    	{
    	    SEND_STRING 0, "'Msg ...'"
    	    //Function calls during the long pulse.
                function_Long_Pulse_BEGIN(....)
    	}
        }
    }
    
    

    Ok, this is the basic logic of my code.

    The functions, ON / OFF Commands Work ... the problem is that they work only when when I'm tracking messages by Netlinxs. Whether or when the diagnostic option is active. Immediately to shut down it stops working. I'm having to leave my notebook on the client to work. it's like the AMX depended on him to perform.

    The only thing is that in my testing, the TPs are not on the network. Only the Central CardFrame and dimmers. but I think it would not be problem.

    the points of light are actuated as follows ... Of course, before Logica has all but in the end it ends up being.

    When Dimmer:
    SEND_LEVEL dv_Living_Light_XYZ, ch_Living_Light_XYZ, 255

    When Relay:
    ON [dv_Living_Light_ABC, ch_Living_Light_ABC]

    Very strange, I think the plant was affected by solar flare heheh.
  • Note that I just got this message when the following section appearing to enter into long pulse. Do not know if it has something to do.But now I was worried.

    Line 3:: Cheap: New - Insufficient memory for alloc! Task = tinterpret) - 13:52:27
    Line 4:: Cheap: New - Error (Task = tinterpret) - 13:52:27
    Line 5: CIpTempMan: length = 4008636142 QuickCreateCharString - 13:52:27
    Line 6: CIpLibrary: Mid_String - Error - 13:52:27
    Line 7:: Cheap: New - Insufficient memory for alloc! Task = tinterpret) - 13:52:27
    Line 8:: Cheap: New - Error (Task = tinterpret) - 13:52:27
    Line 9: CIpTempMan: QuickCreateCharString length = 515942410 - 13:52:27
    Line 10: CIpLibrary: Mid_String - Error - 13:52:27
  • Anarckos wrote: »
    Note that I just got this message when the following section appearing to enter into long pulse. Do not know if it has something to do.But now I was worried.

    Line 3:: Cheap: New - Insufficient memory for alloc! Task = tinterpret) - 13:52:27
    Line 4:: Cheap: New - Error (Task = tinterpret) - 13:52:27
    Line 5: CIpTempMan: length = 4008636142 QuickCreateCharString - 13:52:27
    Line 6: CIpLibrary: Mid_String - Error - 13:52:27
    Line 7:: Cheap: New - Insufficient memory for alloc! Task = tinterpret) - 13:52:27
    Line 8:: Cheap: New - Error (Task = tinterpret) - 13:52:27
    Line 9: CIpTempMan: QuickCreateCharString length = 515942410 - 13:52:27
    Line 10: CIpLibrary: Mid_String - Error - 13:52:27

    Scary!

    Defeitinhos had some code in the above error has been fixed. but the main problem still remains! has already lost 3 pounds of hair
  • could be some failure of ni-3100 to run the code? and is using computer resources? I know that sounds illogical, but I'm trying to imagine what this place.
  • mushmush Posts: 287
    Okay, simple stuff first...

    You can't do this..
    TP_5200i = 10001:0:1
    0 is an invalid port number!

    Whenever you use SET_VIRTUAL_* it should always be followed by a rebuild event E.G;
    {
    SET_VIRTUAL_LEVEL_COUNT(Virtual_TP_Bar, 27) // Raises amount of TP Virtual Levels
    REBUILD_EVENT()
    }

    more soon...
  • mushmush Posts: 287
    You will have to send me all your code, the code you supplied compiles and doesn't throw any errors.

    Here's some ideas I had.


    Cheers
  • mush wrote: »
    You will have to send me all your code, the code you supplied compiles and doesn't throw any errors.

    Here's some ideas I had.


    Cheers

    Thank you for your mush.
    Here too complacent and the Code, without returning errors. some warnings, but is due rather to use string (CHAR).
    The Code I have is quite long, and has many comments in Portuguese. because I'm Brazilian. here we were unsupported amx for a while. so catch these things. But I'll tell you. maybe they are able to see some detail.

    Well, what I just found out with new tests, is that this problem occurs only with the I/Os. ie when I get a pulse on I/O it is understood only when the diagnosis is active. Emulate the Touch and Receive a run without the need for diagnosis to be active.

    The only difference is that with the I/O I'm creating a TIME_LINE to see if the pulse is short or long. the panel does not need to go through this option.

    Now I think that we reduce the variables. This in some detail in I/O or TIME_LINE.
  • opps te files...

  • I think I found the problem .....

    Some of my parameters are sent as a STRING (or CHAR) never quite understood that the question of texts AMX ... but okay.
    The idea was to send as parameter as follows:

    function ('Rum_IT'), but the function only received part of a parameter, something like
    'R' ... the idea of trying to pass all characters, I MID_STRING we used the ('Rum_IT', 1, LENGTH_STRING ('Rum_IT')). thinking this would all characters. was working but not nice ..

    Now I'm having to manually count the characters. Passing this way:
    function (MID_STRING ('Rum_IT', 1,6)).
    With this work.

    this could be simpler. I imagine it must have some way to send only function ('Rum_IT')... but still do not know how.

    the Stranger is that it worked with the active Dignostico .. makes no sense to me.
    but okay .. let them out.

    Thanks Mush. you was a great help. Sorry about that, but here in Brazil, we have good courses of AMX for now. looks like it will start to improve now. why I did some travel, and get these simple details.

    Thanks.
  • Anarckos wrote: »
    I think I found the problem .....

    Some of my parameters are sent as a STRING (or CHAR) never quite understood that the question of texts AMX ... but okay.
    The idea was to send as parameter as follows:

    function ('Rum_IT'), but the function only received part of a parameter, something like
    'R' ... the idea of trying to pass all characters, I MID_STRING we used the ('Rum_IT', 1, LENGTH_STRING ('Rum_IT')). thinking this would all characters. was working but not nice ..

    Now I'm having to manually count the characters. Passing this way:
    function (MID_STRING ('Rum_IT', 1,6)).
    With this work.

    this could be simpler. I imagine it must have some way to send only function ('Rum_IT')... but still do not know how.

    the Stranger is that it worked with the active Dignostico .. makes no sense to me.
    but okay .. let them out.

    Thanks Mush. you was a great help. Sorry about that, but here in Brazil, we have good courses of AMX for now. looks like it will start to improve now. why I did some travel, and get these simple details.

    Thanks.

    This was not the problem.

    Soon when you get home, I will describe. but it is solved.

    :)
  • mushmush Posts: 287
    Anarckos wrote: »
    I imagine it must have some way to send only function ('Rum_IT')... but still do not know how.

    DEFINE_FUNCTION func_ACOES_Iluminacao(CHAR vCircuito_Nome, DEV vDev_Circuito, INTEGER vCh_Circuito, CHAR vAcao) X


    DEFINE_FUNCTION func_ACOES_Iluminacao(CHAR vCircuito_Nome[highlight][][/highlight], DEV vDev_Circuito, INTEGER vCh_Circuito, CHAR vAcao[highlight][][/highlight])

    char == 1 byte == '1' (this is a CHAR)
    char[8] == 8 bytes == '12345678' (this is a CHAR array or string)
    char[] == n bytes == '1' or '1234' or '12345678' etc. (this is a CHAR array or string)

    example
    DEFINE_VARIABLE
    char cMyChar
    char cMyCharArray[] = '12345678' [highlight]or[/highlight] char cMyCharArray[8] (The size must be initialised at compile time if you do define the size of the array)
  • mushmush Posts: 287
    DEFINE_FUNCTION Cenas_Iluminacao(CHAR vCena_Nome, CHAR vAcao)
    {
    
    }
    
    Cenas_Iluminacao(MID_STRING('Cena_Living_Luz_Todas',1,LENGTH_STRING('Cena_Living_Luz_Todas')), MID_STRING('INV',1,3))
    
    WARNING: func_ACOES_Pulsadores_LIVING.axi(93): C10571: Converting type [string] to [CHAR]  
    

    Do this instead.
    DEFINE_FUNCTION Cenas_Iluminacao(CHAR vCena_Nome[], CHAR vAcao[])
    {
    
    }
    
    Cenas_Iluminacao('Cena_Living_Luz_Todas', 'OFF')
    
    >>>>--- NetLinx Compiles:  1 Files  0 Total Error(s)  0 Total Warnings(s) ---<<<<   
    

    WARNING: func_ACOES_Pulsadores_LIVING.axi(93): C10571: Converting type [string] to [CHAR]
    This is an important warning!!! You need to investigate these, especially if you are unsure why they are happening.
  • mushmush Posts: 287
    G'day Anackros,

    Do you only have one TPD4 file for all the touch panels?
    Can you please send it to me?

    Cheers
  • Tanks Mosh,


    I'm making the corrections. There are many things to fix. I never knew how to work well in String NetLinx, now became clear. Thanks.

    But I think the problem was due to DEFINE_EVENT Previous

    I was ...

    DEFINE_EVENT

    TIMELINE_EVENT [.....]
    {
    }
    CHANNEL_EVENT [.....]
    {
    }
    BUTTON_EVENT [....]
    {
    }

    It seems that the program was Considerant Only TIMELINE_EVENT. I noticed this when I was testing a Button_event, he only ran when he was high on the list of Events.

    So did the following:

    DEFINE_EVENT
    TIMELINE_EVENT [.....]
    {
    }
    DEFINE_EVENT
    CHANNEL_EVENT [.....]
    {
    }
    DEFINE_EVENT
    BUTTON_EVENT [....]
    {
    }

    This way is working. I am a little time to see if this is right.

    Layout of my touch, it was all designed by me. normally would not anyone. but send me an email that I will return with the files.
    beckerautomacao@gmail.com
  • mushmush Posts: 287
    Anarckos wrote: »
    It seems that the program was Considerant Only TIMELINE_EVENT. I noticed this when I was testing a Button_event, he only ran when he was high on the list of Events.

    So did the following:

    DEFINE_EVENT
    TIMELINE_EVENT [.....]
    {
    }
    DEFINE_EVENT
    CHANNEL_EVENT [.....]
    {
    }
    DEFINE_EVENT
    BUTTON_EVENT [....]
    {
    }

    You should not have to do this as all of your AXI files are declared under DEFINE_EVENT.
    I will look into it further and get back to you.

    Layout of my touch, it was all designed by me. normally would not anyone. but send me an email that I will return with the files.

    I've sent you an e-mail.
    If you are concerned about copyright you can make the file open to view only.
    I just wanted to use it to understand all of your level declarations and combines.

    Cheers
  • also found strange, but so is working. I have a lot to do yet. then come back to see it. I sent you by email. but he returned. I sent it again. The idea is that all buttons have the same number. but I'm still analyzing what the best method. I know I'm writing other codes. I think so it is less stressful for the plant. and cause me less problems with command operands
  • mushmush Posts: 287
    I've been looking at your code and I can't work out how it works.
    It does not work on my test system!
    How are you dealing with button presses?
    Did you send all the code?

    I like the panel design, very nice!
  • AnarckosAnarckos Posts: 41
    Code for the Touch, not ready yet. these problems consumed me time.

    Thanks, I wanted it to be unique! It took awhile, but I liked the result too!
  • AnarckosAnarckos Posts: 41
    I ended up messing me a little programming. I was actually doing all the dark without being able to play all the codes for tests. and how much that has never moved. I had planned it all by going down the water! now has to run to fix.
  • mushmush Posts: 287
    Anarckos wrote: »
    I ended up messing me a little programming. I was actually doing all the dark without being able to play all the codes for tests. and how much that has never moved. I had planned it all by going down the water! now has to run to fix.

    Hmm... maybe babelfish for the next translation.
    I do not understand most of that.
  • AnarckosAnarckos Posts: 41
    mush wrote: »
    Hmm... maybe babelfish for the next translation.
    I do not understand most of that.

    hehehe sorry ... google.
    I tried to say: I did all the programming in the dark. without being able to test. the equipment were being assembled. then created all my logic, did not work. I'm losing a lot of time to fix.

    My next investment will be in a good English course!
  • Joe HebertJoe Hebert Posts: 2,159
    Anarckos wrote:
    I will post a summary of the Code.
    OK, I have...
    Virtual_TP_Bar	= 33001:[b]8[/b]:1 // Virtual TP, Used to create a COMBINE_LEVELS later.
    
    
    A virtual device only has one port by default.
    If you need more than one port you need to use SET_VIRTUAL_PORT_COUNT()
  • AnarckosAnarckos Posts: 41
    Joe Hebert wrote: »
    A virtual device only has one port by default.
    If you need more than one port you need to use SET_VIRTUAL_PORT_COUNT()

    humm... very tanks!
Sign In or Register to comment.