Home AMX User Forum AMX General Discussion

Help in "Hello world" program

I'm newby in AMX programming and can't understand meaning of address port, address code, channel port and channel code. As i understand channel code mean feedback (if channel feedback setup in TP4) and address port mean address, for push/release events, but what meaning of last two properties i don't understand, could anyone explain this for me please or show exact place in help.

I try to write sample project place a button on page, setup feedback in "channel", address port in "1", channel port in "1" and channel code in "2"
Then i wrote event handler:

BUTTON_EVENT[dvTP,1]
{
PUSH:
{
[dvTP,2] = ![dvTP,2]
}
}

this must programm button to work like trigger, but when i press a button nothing changed. Where did i mistaken?

Comments

  • Welcome!

    First Channel Codes are for feedback and button events.

    Address Codes are for variable text

    AMX works on the D:P:S concept Device:Port:System

    The System part is easy - each Netlinx Master is a system and has a unique system no. zero means "this system"

    Each master has different Ports - think of the connectors on the back - The RS232 connectors are ports 1-7 on a NI3100 and the first IR output is port 9

    The device part is a ID for the physical device. so the Master could be 5001, and a TP could be 10001. There are ranges of device ID's for different products. so TP2 could be 10002 etc

    to create a device in code we reference the DPS with a Name:

    dvIR1 = 5001:9:0 // 5001 (Master): Port 9 (IR Out 1): System 0 (This System)

    The first issue with your example is your waiting for TP Button 1 (channel 1) to fire the event, but your TP button is set to channel 2. In TP4 you should have Channel port =1 and channel code =1 for button #1. You don't need an address port or code.

    If you set the Channel Port to 2 then you'd need to assign your TP in Netlinx as dvTP_Port2 = 10001:2:0 rather than 10001:1:0
  • Jimweir192, thank's for quick and clear explanation. I reply when chek your advice on a real system.
  • thanks a lot, all work fine
Sign In or Register to comment.