Home AMX User Forum NetLinx Studio

Axcent3 programming - akeyb and akeyp

Hi folks,

I'd like to be able to retrieve mainly text, entered on a touch panel using the on screen keyboard, does anyone have any ideas on how to achieve this in the Axcent code?

Many, many thanks in advance!
-Dave

Comments

  • Let's see if I still can program AXcess.... :)

    DEFINE_DEVICE
    dvPANEL = 128

    DEFINE_VARIABLE
    PANELBUFFER[255]

    DEFINE_START
    CREATE_BUFFER nPANEL,PANELBUFFER
    DUMP[50]

    DEFINE_PROGRAM
    IF(LENGTH_STRING(PANELBUFFER))
    {
    SELECT
    {
    ACTIVE(FIND_STRING(PANELBUFFER," 'KEYB-' ",1)):
    {
    DUMP = REMOVE_STRING(PANELBUFFER," 'KEYB-' ",1)
    (* now PANELBUFFER has your Keyboard Text *)
    }
    ACTIVE(FIND_STRING(PANELBUFFER," 'KEYP-' ",1)):
    {
    DUMP = REMOVE_STRING(PANELBUFFER," 'KEYP-' ",1)
    (* now PANELBUFFER has your keypad String *)
    }
    ACTIVE(1): // any other String from panel
    {
    }
    PANELBUFFER = ''
    }
    }


    Should work, but no panel and master on my desk to check at the moment....

    Regards,
  • Hi there Marc, thanks for the info :D - unfortunately I couldn't get it to work, here's what I attempted:
    DEFINE_VARIABLE
    PANELBUFFER[255]
    DUMP[50]
    
    DEFINE_START
    CREATE_BUFFER 129, PANELBUFFER
    DUMP[50]
    
    DEFINE_PROGRAM
    IF(LENGTH_STRING(PANELBUFFER))
    {
    SELECT
    {
    ACTIVE(FIND_STRING(PANELBUFFER," 'KEYB-' ",1)):
    {
    DUMP = REMOVE_STRING(PANELBUFFER," 'KEYB-' ",1)
    SEND_STRING HOSTPC,PANELBUFFER
    }
    ACTIVE(FIND_STRING(PANELBUFFER," 'KEYP-' ",1)):
    {
    DUMP = REMOVE_STRING(PANELBUFFER," 'KEYP-' ",1)
    (* now PANELBUFFER has your keypad String *)
    }
    ACTIVE(1): (*any other String from panel*)
    {
    }
    ACTIVE(1): PANELBUFFER = ''
    }
    }
    

    A few notes, device 129 is an AXP-T/S EL panel.

    I moved the 'DUMP[50]' statememt up into the Define_Variable section, but I also left it in the Define_start section where it didn't seem to error.
    'Send_String HOSTPC,PANELBUFFER' was me trying to get the keyboard text entered, to be send out through the first RS-232 port (HOSTPC).
    I had to change the // quotes to (*quote*) format.
    I had to modify the final 'PANELBUFFER = '' command as the compiler said that an ACTIVE statemenet should be before it.

    As you might of guessed I am fairly new to this language, but feel free to look at my changes and see what I've coded wrong :)

    Many thanks again for your help!!
  • SEND_STRING HOSTPC,PANELBUFFER needs to be SEND_STRING HOSTPC,DUMP

    We've assigned what was panelbuffer to DUMP, therefore you want to send DUMP to the rs232 port.

    Kevin D.
  • Spire_JeffSpire_Jeff Posts: 1,917
    shr00m-dew wrote:
    SEND_STRING HOSTPC,PANELBUFFER needs to be SEND_STRING HOSTPC,DUMP

    We've assigned what was panelbuffer to DUMP, therefore you want to send DUMP to the rs232 port.

    Kevin D.


    Actually, from what I see, KEYP- and anything the preceeds it would be assigned to DUMP and PANELBUFFER would contain the text that was entered, so SEND_STRING HOSTPC, PANELBUFFER should work.

    One thing I would do is eliminate the sending of the string to the 232 port until you have verified that the rest of your code is working, unless you have already verified that SEND_STRING HOSTPC, WHATEVER is actually communicating.

    Here is something that should show you what is happening. I keep getting an eval error when I try to compile, so I apologize. If you can figure out what I did to upset the axcent gods, the logic should work. You will need to create 2 variable text buttons on you touchpanel, but this will give you instant feedback on the touchpanel to see what is happening:
    DEFINE_VARIABLE
    PANELBUFFER[255]
    DUMP[50]
    sSEND_TO_PANEL[25]
    
    DEFINE_START
    CREATE_BUFFER 129, PANELBUFFER
    
    DEFINE_PROGRAM
    IF(LENGTH_STRING(PANELBUFFER))
    {
    	SELECT
    		{
    		ACTIVE ( FIND_STRING(PANELBUFFER,'KEYB-',1)) :
    			{
    				DUMP = REMOVE_STRING(PANELBUFFER,'KEYB-',1)
    				sSEND_TO_PANEL = LEFT_STRING(PANELBUFFER,25)
    				SEND_COMMAND dvTP,"'!T',1,sSEND_TO_PANEL"
    				SEND_COMMAND dvTP,"'!T',2,'Entry was from Keyboard'"
    				CLEAR_BUFFER PANELBUFFER
    			}
    		ACTIVE ( FIND_STRING(PANELBUFFER,'KEYP-',1)) :
    			{
    				DUMP = REMOVE_STRING(PANELBUFFER,'KEYP-',1)
    				sSEND_TO_PANEL = LEFT_STRING(PANELBUFFER,25)
    				SEND_COMMAND dvTP,"'!T',1,sSEND_TO_PANEL"
    				SEND_COMMAND dvTP," '!T' , 2 , 'Entry was from Num Pad' "
    				(* now PANELBUFFER has your keypad String *)
    				CLEAR_BUFFER PANELBUFFER
    			}
    		ACTIVE (1) : (*any other String from panel*)
    			{
    				sSEND_TO_PANEL = LEFT_STRING(PANELBUFFER,25)
    				SEND_COMMAND dvTP,"'!T',1,sSEND_TO_PANEL"
    				SEND_COMMAND dvTP," '!T' ,2, 'Other String Detected' "
    				CLEAR_BUFFER PANELBUFFER
    			
    			} 
    		}
    }
    

    Hope something here helps.

    Jeff
  • Your example code compiles error free here.
  • Spire_Jeff wrote:
    Actually, from what I see, KEYP- and anything the preceeds it would be assigned to DUMP and PANELBUFFER would contain the text that was entered, so SEND_STRING HOSTPC, PANELBUFFER should work.
    Jeff


    Doh.. Sure wish I knew what I was reading last night..

    Kevin D.
  • electroelectro Posts: 15
    OK Guys I think I found the problem, the code works flawlessly... When I removed the DEFINE_COMBINE command I had in the code, I was combining a VPT-CP, EL panel, and LC panel into one device, I'd still like to do this as I'd like the devices all to have similar functions, is there any way I can do a define_combine and have input from the devices?

    Cheers! :D
    -Dave
  • electroelectro Posts: 15
    In addition to my post about AKEYB working well, another problem has cropped up, for some reason this doesn't work on my VPT-CP (one-way) remote, I've managed to get both AKEY* and Joystick commands working from the wired touch panels, do I have to have a two-way ViewPoint in order to be able to receive AKEY* data and joystick positioning?

    Thanks for all the help!
    -Dave
  • ozgunozgun Posts: 13
    I need help

    Hello i have another problem,i want to take some commands from rs 232 port of axcent3 and just send it in different way from another rs232 device...Is this possible in axcent..I saw part of code below.can i use like this?Its easy for me in netlinx but i havent done with axcent controller yet.So i need some help.I hope you understand my duty.
    Want to take reply from one rs232 port.Comment it somehow with find and remove strings..after this send it to another rs232 port...Can anyone help me please?
    Let's see if I still can program AXcess.... :)

    DEFINE_DEVICE
    dvPANEL = 128

    DEFINE_VARIABLE
    PANELBUFFER[255]

    DEFINE_START
    CREATE_BUFFER nPANEL,PANELBUFFER
    DUMP[50]

    DEFINE_PROGRAM
    IF(LENGTH_STRING(PANELBUFFER))
    {
    SELECT
    {
    ACTIVE(FIND_STRING(PANELBUFFER," 'KEYB-' ",1)):
    {
    DUMP = REMOVE_STRING(PANELBUFFER," 'KEYB-' ",1)
    (* now PANELBUFFER has your Keyboard Text *)
    }
    ACTIVE(FIND_STRING(PANELBUFFER," 'KEYP-' ",1)):
    {
    DUMP = REMOVE_STRING(PANELBUFFER," 'KEYP-' ",1)
    (* now PANELBUFFER has your keypad String *)
    }
    ACTIVE(1): // any other String from panel
    {
    }
    PANELBUFFER = ''
    }
    }


    Should work, but no panel and master on my desk to check at the moment....

    Regards,
  • trobertstroberts Posts: 228
    Do you have access to the code running in the Axcent3? Are you connecting to the program port or a device port? If you don't have the code and your connecting to a device port, you just need to treat the Axcent 3 as any other serial device, but you wont know it's protocol unless you can document exactly what is coming out of the port at any given moment along with its baud rate.
  • ozgunozgun Posts: 13
    I have the axs code.and i will take repy from rs232 port1(not program port) and i will sned it to rs 232 port2..This is all i want.
  • trobertstroberts Posts: 228
    ozgun wrote: »
    I have the axs code.and i will take repy from rs232 port1(not program port) and i will sned it to rs 232 port2..This is all i want.

    OK, just to be clear....you are taking replies from a serial device on port 1, then saving and manipulating that devices replies and then sending the new manipulated string to another serial device on port 2....correct?

    If so, then yes, that is very possible. you'd need to create a buffer for your device on port 1 and use find_string and other buffer processing commands. Save the desired strings to a variable or several variables then add whatever you want to it, then send it out port 2.
  • ozgunozgun Posts: 13
    Absolulty yes.Also i dont want to manipulate the code..I just want to send the same code...Can you give me small example of code please..Otherwise i will break this axcent i will pay and buy new netlinx controller :)Thank you for your fast answer by the way.
  • trobertstroberts Posts: 228
    It might be a little nicer if you put this in a call, but this should work fine. This will receive a string coming into port 1 from a serial device and just send out the same code onto port 2. I have no idea why you would want to do this but here you go.

    In DEFINE_START
    CREATE_BUFFER dvPORT1,PORT1_BUFF

    In DEFINE_PROGRAM
    IF(LENGTH_STRING(PORT1_BUFF))
    {
    SEND_STRING dvPORT2,"PORT1_BUFF"
    CLEAR_BUFFER PORT1_BUFF
    }
  • mdonaldsonmdonaldson Posts: 11
    Could you use REDIRECT_STRING here?
  • trobertstroberts Posts: 228
    mdonaldson wrote: »
    Could you use REDIRECT_STRING here?

    That is a valid Axcent command, but I have never used it and I am not sure if it is used for sending or receiving strings or both. If it works great!

    From Axcess help file
    The REDIRECT_STRING(entry#,dev1,dev2) function will pass all strings from dev1 to dev2, and all strings from dev2 to dev1. Entry# specifies which of the 8 possible redirections.

    Examples:

    REDIRECT_STRING(1,RS232_1,RS232_2)

    Enables passing of strings from device RS232_1 to RS232_2.

    REDIRECT_STRING(1,0,0)

    Disables passing of strings from device RS232_1 to RS232_2.
Sign In or Register to comment.