Home
Remote control of PG4UW, user`s manual
Contents
1. 27 Remote control of PG4UW user s manual When we want to use multiprogramming remote control following command line parameters are useful to automatically enable remote control communication in Pg4uw 1 Pg4uw exe usb 1 192 00123 enableremote autoanswer 2 Pg4uw exe usb 2 192 00124 enableremote autoanswer Remotelb dll remote control with multiprogramming published functions Following description presents purpose of each remote control function in multiprogramming mode For more particular description of function declarations and parameters please see the file remotemulticlient pas If the remote Server application is written in C language there is necessary to write appropriate header h file to make functions from library remotelb dll available in C C project The Pascal unit file remotemulticlient pas shows function declarations and parameters This can be used for writing C C header file 5 1 General functions for Client Server remote control connection establishing and connection parameters setting To see the usage of following functions and procedures the example of multiprogramming remote control application MultiDemo is available The example is placed in the directory where Pg4uw program is installed in the subdirectory lt Pg4uw_inst_dir gt remotectrl programs MultiDemo The complete path can look like this C Program Files Manufacturer_sw Programmer remotectrl programs MultiDemo procedure CreateServerAn
2. 0 find out current operation progress q pos TCP_KEYWORD_PROGRESS CMDline if q gt 0 then begin tmpstr copy CMDline q length TCP_KEYWORD_PROGRESS 1 length CMDline q pos tmpstr if q gt 0 then tmpstr trim copy tmpstr 1 q 1 else tmpstr unknown val tmpstr progress errcode if errcode 0 then device_progress index progress progress else device_progress index progress 0 end if q gt 0 find out current programmer status Ready or Not found Demo mode q pos TCP_CMD_PROGRAMMER_READY_STATUS CMDline if q gt 0 then begin tmpstr copy CMDline q length TCP_CMD_PROGRAMMER_READY_STATUS length CMDline q pos tmpstr if q gt 0 then tmpstr trim copy tmpstr 1 q 1 else tmpstr trim tmpstr if tmpstr TCP_KEY_PROGRAMMER_READY then device_progress index pgm_status true programmer is Ready else device_progress index pgm_status false programmer is in Demo mode end if q gt 0 refresh status indicators if formMultiPanel lt gt nil then if device_progress index opcode integer otnone then with formMultiPanel do begin Set_progressbar_value index device_progress index progress device_progress index busy reset result flag if no operation is active device_result index oprNone formMultiPanel SetLEDcolors index device_progress index busy device_result index end with end procedure proced
3. TCP_CMD_PROGRAMMER_READY_STATUS TCP_KEY_PROGRAMMER_NOTFOUND Example 2 send request to client SEND_CMD_GetProgStatus processing the response from client procedure Process_KEYWORD_OPTYPE CMDline ansistring var tmpstr string progress errcode q integer begin find out current operation type q 1 pos of TCP_KEYWORD_OPTYPE tmpstr copy CMDline q length TCP_KEYWORD_OPTYPE 1 length CMDline q pos tmpstr if q gt 0 then tmpstr trim copy tmpstr 1 q 1 else tmpstr unknown set cur op type val tmpstr q errcode if errcode 0 then device_progress opcode q else device_progress opcode 0 find out current operation progress q pos TCP_KEYWORD_PROGRESS CMDline if q gt 0 then begin tmpstr copy CMDline q length TCP_KEYWORD_PROGRESS 1 length CMDline q pos tmpstr if q gt 0 then tmpstr trim copy tmpstr 1 q 1 else tmpstr unknown val tmpstr progress errcode if errcode 0 then device_progress progress progress else device_progress progress 0 end if q gt 0 find out current programmer status Ready or Not found Demo mode q pos TCP_CMD_PROGRAMMER_READY_STATUS CMDline if q gt 0 then begin tmpstr copy CMDline q length TCP_CMD_PROGRAMMER_READY_STATUS length CMDline q pos tmpstr if q gt 0 then tmpstr trim copy tmpstr 1 q 1 else tmpstr trim tmpstr if tmpstr
4. TCP_KEY_PROGRAMMER_READY then begin device_progress programmer_present true programmer is Ready if device_progress programmer_ready lt gt programmer_is_busy then device_progress programmer_ready programmer_ready_yes end 17 Remote control of PG4UW user s manual else begin device_progress programmer_present false programmer is in Demo mode device_progress programmer_ready programmer_ready_no end end if q gt 0 procedure SEND_CMD_Quest_is_Client_Ready stdcall Procedure sends question to Client if the Client is Ready Client sends ready yes no status message to Server The ready status command received from Client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Client is ready when no device operation is currently running and main Client s window is not hidden by any modal dialogs in Client Example Request from server SEND_CMD_Quest_is_Client_Ready Answer from client codes for server to client ready question TCP_CMD_CLIENT_READY_ANSWER clienprogramisreadyanswer TCP_KEY_CLIENT_READY_YES isready TCP_KEY_CLIENT_READY_NO isnotready answer will be in followed form TCP_CMD_CLIENT_READY_ANSWER TCP_KEY_CLIENT_READY_YES or TCP_CMD_CLIENT_READY_ANSWER TCP_KEY_CLIENT_READY_NO procedure SEND_CMD_PROCESS_CMDLINE cmdparams PChar stdcall Procedure
5. Very good feature of PG4UWcmd exe is its return code according to command line parameters operation result in PG4UW 6 3 Return values of PG4UWcmd exe If the command line parameters processed in PG4UW were successful the Exitcode or ErrorLevel of PG4UWcmd exe is zero Otherwise the ExitCode value is number 1 or more Return value of program PG4UWcmd exe can be tested in batch files Following executive command line parameters are available to use with PG4UWcmd exe Prj lt file_name gt Loads project file Parameter lt file_ name gt means full or relative project file path and name Loadfile lt file_name gt Loads file Parameter lt file_name gt means full or relative path to file that has to be loaded File format is detected automatically Program switch Forces start of Program device operation automatically when program is starting or even if program is already running Also one of following optional switches can be used 1 switch noquest forces start of device programming without question 2 switch noanyquest forces start of device programming without question and after operation on device is completed program doesn t show Repeat operation dialog and goes directly into main program window Examples 1 Program 2 Program noquest 3 Program noanyquest Saveproject lt file_name gt The command is used to save currently selected device type buffer contents and configuration to project file Comma
6. begin tmpstr trim copy CMDline length TCP_KEYWORD_CINDEX 1 length CMDline tmpstr trim copy tmpstr 1 pos tmpstr 1 if not Str2int tmpstr index then exit q pos CMDline if q gt 0 then CMDline trim copy CMDline q 1 length CMDline else CMDline end if pos TCP_KEYWORD_CINDEX LowerCase CMDline 1 CMD program is busy if CompareText CMDline TCP_CMD_PROG_IS_BUSY 0 then Process_CMD_PROG_IS_BUSY etc processing of other commands end procedure ProcessProcByFIFO This procedure is used for receiving info and commands from CLient Pg4uw app The procedure can be used when no callback procedure is defined in calling of procedure CreateServerAndMakeListenToClients Callback proc is not defined by setting its value to nil const MAX_ITERATIONS 3 proc_iterations integer 0 var received_cmd PChar begin if proc_iterations gt MAX_ITERATIONS then exit inc proc_iterations try get command from FIFO received_cmd GetCommandStringFromFIFO while received_cmd lt gt nil do begin if there was command received from FIFO call the process proc to process the command intServerProcessProc received_cmd try to get next command from FIFO received_cmd GetCommandStringFromFIFO end while finally if proc_iterations gt 0 then dec proc_iterations end try end procedure CreateServerAndMakeListenToClients nil CallbackProcPtr nil Wri
7. or log window of Server application If it is defined as nil no write to log events will be used onClientConnectProc TProc optional callback procedure is called as event when Client is connected to Server If it is defined as nil no on client connect event will be used onClientDisconnectProc TProc optional callback procedure is called as event when Client is disconnected from Server If it is defined as nil no on client disconnect event will be used 28 Remote control of PG4UW user s manual vPort PChar defines port for TCP communication default is telnet Server does not have address defined itself Internally Server has defined address 0 0 0 0 which means that Server accepts Clients from all interfaces function GetlfClientAppWithOrdNumExists index integer BOOL stdcall Function is used by Server application Function returns true if Client with index number is connected to Server otherwise returns false function GetlfAnyClientAppIlsConnectedToServer BOOL stdcall Function is used by Server application Function returns true if at least one Client is connected to Server otherwise returns false 5 2 Procedures used for sending basic types of commands from remote Server to PG4UW Client procedure SEND_CMD_BringToFront_CINDEX index integer stdcall Procedure is used to send message bringtofront to Client with index specified by parameter index When Client receives th
8. pinsnumber PChar stdcall Procedure is used to send message autoseldevice to Client with index specified by parameter index When Client receives the message it starts autoselect device operation Parameter pinsnumber can be used to specify the pin number of device which helps more reliable detection of device type If parameter pinsnumber is blank Pchar autoselect operation tries to detect inserted device pin number automatically The Client sends currently selected device to Server but not result of autoselect detection success Example Server request 34 Remote control of PG4UW user s manual SEND_CMD_EPROMFLASH_AutoSelect_CINDEX 1 device pins detected automatically SEND_CMD_EPROMFLASH_AutoSelect_CINDEX 1 48 48 pins device Answer from client client send currently selected device codes for operations result TCP_CMD_AUTSEL_EPRFLSH_RESULT autoseldeviceresult answer will be in followed form TCP_CMD_AUTSEL_EPRFLSH_RESULT manufacturer device name procedure SEND_CMD_LoadProject_CINDEX index integer prjname PChar stdcall Procedure is used to send message loadproject to Client with index specified by parameter index When Client receives the message it tries to load project file specified by parameter prjname The Client sends load project result to Server The result command received from client can be processed by Server application in pr
9. PC system requirements for remote control application Microsoft Windows XP Professional PC Pentium III 600 128 MB of RAM 10 MB of free disk space 8 2 System requirements for application PG4UW when using remote control function Minimum PC system requirements Microsoft Windows 98 2000 XP or later PC Pentium 4 256 MB of RAM 200 MB of free disk space LPT printer port for programmers connected via LPT port USB port ver 1 1 or later for programmers connected via USB port Recommended PC system requirements Microsoft Windows XP Professional PC Pentium Core 2 Duo 512 MB of RAM 1000 MB of free disk space LPT printer port supporting EPP ECP modes for programmers connected via LPT port USB port ver 1 1 or later for programmers connected via USB port 8 3 Common requirements Both remote control program and PG4UW program need network adapter with TCP protocol support installed The network adapter can be virtual Microsoft loopback adapter or real network adapter network card with proper drivers installed When using remote control program and PG4UW program on the same computer there is no need to have real network adapter network card installed When using remote control program and PG4UW program on the remote computers real network adapter network card has to be installed on each computer 51 Remote control of PG4UW user s manual Installation of virtual networ
10. control written in Pascal and C languages Examples are described in the chapter III of this manual Example 1 Server request SEND_CMD_CloseApp_CINDEX 1 Answer from client client send no answer Example 2 Procedure sends remote command SEND_CMD_CloseApp_CINDEX to Site with index siteindex Procedure also checks the Site is not busy If the Site is busy currently running device operation the procedure shows warning message and does not perform the close command procedure SiteCloseSiteApp siteindex integer const MAX_TIMEOUT_FOR_DISCONNECT 8000 ms var start_time DWORD begin check index range if siteindex lt 1 or siteindex gt MAX_SITE_COUNT then exit check if Site is Ready and not busy if ChecklfTheSitelsBusy siteindex true then begin ShowMessage Format Sorry the Site d is busy now Operation can not be started immediately 13 10 Please try again later siteindex exit end if ChecklfTheSitelsBusy siteindex true if GetIfClientAppWithOrdNumExists siteindex true then 33 Remote control of PG4UW user s manual try write info about disconnecting of Sites to Log window Write ToLogwindowProc Disconnecting Sites wait please SEND_CMD_CloseApp_CINDEX siteindex application processmessages wait for disconnecting of Site start_time GetTickCount while GetlfClientAppWithOrdNumExists siteindex true do begin sleep 100
11. line parameter when starting each Pg4uw on remote computer For more details look at remoteaddr lt address gt command line parameter description Remote operation command for Load project is sent to Pg4uw applications by SEND_CMD_LoadProject_CINDEX remote command so when using this for Sites running on different remote computer the project file specified in the command must exist and be accessible on remote computer under the same project file path and name Command Load project does not transfer any data of project file It transfers just project file name Each Site must have its unique number even if the Sites are connected and running on different computers The valid numbers are from 1 to 16 In the future the range will be extended to higher values Order number of Site and serial number of Site is specified by command line parameter usb lt index gt lt programmer serial number gt Remote computer must be connected to server computer via network supporting TCP IP protocol Also firewalls must be configured to allow network access of both remote control application and Pg4uw applications Default port used for communication is telnet port value 23 All other remote control commands are used in the same way as for Pg4uw clients running on the local computer with remote control program Situation when running Sites on more computers localhost and remote computer simultaneously is shown on following picture P
12. operation_code otNone otRunApp otblankCheck otReadDevice otVerifyDevice otProgramDevice otEraseDevice otPlayPlayer otLoadProject otStop otSelfTest otSelfTestPlus codes for current status information TCP_KEYWORD_OPTYPE optype TCP_KEYWORD_PROGRESS progress TCP_CMD_PROGRAMMER_READY_STATUS programmerreadystatus TCP_KEY_PROGRAMMER_NOTFOUND notfound TCP_KEY_PROGRAMMER_READY_ ready TCP_KEYWORD_OPTYPE operation_code TCP_KEYWORD_PROGRESS device_progress TCP_CMD_PROGRAMMER_READY_STATUS TCP_KEY_PROGRAMMER_READY or TCP_KEYWORD_OPTYPE operation_code TCP_KEYWORD_PROGRESS device_progress TCP_CMD_PROGRAMMER_READY_STATUS TCP_KEY_PROGRAMMER_NOTFOUND Example 2 send request to client SEND_CMD_GetProgStatus_CINDEX 1 processing the response from client 36 Remote control of PG4UW user s manual procedure Process_KEYWORD_OPTYPE index integer CMDline ansistring var tmpstr string progress errcode q integer begin find out current operation type q 1 pos of TCP_KEYWORD_OPTYPE tmpstr copy CMDline q length TCP_KEYWORD_OPTYPE 1 length CMDline q pos tmpstr if q gt 0 then tmpstr trim copy tmpstr 1 q 1 else tmpstr unknown set cur op type val tmpstr q errcode if errcode 0 then device_progress index opcode q else device_progress index opcode
13. programmer serial number gt index specifies unique index that will be used with the instance of Pg4uw The index allows to distinguish each instance of Pg4uw when sending remote control commands from remote control software Index is defined as number in range 1 to 16 The index value can also be considered to be Site number programmer serial number specifies serial number of programmer which has to be used with the instance of Pg4uw application The programmer with specified serial number will be searched on USB ports by the instance of Pg4uw There is allowed to use one programmer serial number in one Pg4uw instance only at the same time Note In case that you are using our multiprogramming system programmer serial number mean site serial number To obtain site serial number please do following steps run PG4UWMC press Search button in main menu in dialog Search for Programmers select proper programmer type and press Search button in Programmers activity log you can see site serial numbers for each site Example We want to use multiprogramming with two programmers that have serial numbers 192 00123 and 192 00124 The procedure to run two instances of Pg4uw is following 1 the first instance for programmer with s n 192 00123 in command line we specify Pg4uw exe usb 1 192 00123 2 the second instance for programmer with s n 192 00124 in command line we specify Pg4uw exe usb 2 192 00124
14. remote control implementation ccceeceeseeseeeteceeeeeeeceesneeeeseneeeenees 24 Del SVNCNFONOUS mode sstinin chill slic us eva dat ly aa aah dah cela sae dat MU adap bala dd ea vee howe ate 24 FZ ASVACHVONOUS moderieren sg E A tin EE E a A E AE E 24 4 Remote control examples source files ne snesneeseeseesseeseeseessesetsstsseesressessressesseesresseeseresse 25 4 1Source files written in Borland Delphi PAscall ccccccccccscecsceeseeeseteneeeeeteeetenseeeennseeees 25 4 2Source files written C suitable for Borland C Builder and Microsoft Visual C Fs eit buco TEA EEE TE Lt lacs Saas ed et rs ad acl gen aid EAE dni ben De el int Sed Be 25 4 3Source files written in Microsoft Visual Basic 6 ccccccccceesceeseeeeecteseeeeeeeeenseeeeenaseeens 25 4 4Source files written in Microsoft Visual Basic 2002 2003 2005 NET cccccccccceseeees 25 5 Using remote control with multiply programmers multiprogramming cceeee 27 5 1 General functions for Client Server remote control connection establishing and connection parameters SOLIS sni iein aTe E A E ARETE E a a 28 5 2Procedures used for sending basic types of commands from remote Server to PG4UW META I EET R E R A AE E A E E IA A A SEE 29 6 Remote command line control of PG4UW u eee eeeeeeesseessssssssssssssssssssssssssssssssssssssssesees 41 6 1 Configuration command line parameter S sonessenseaeeneensiesoeseseiesesersriesesresreeseeessee 4 6 2Executi
15. timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND_CMD_RBUFFER_CINDEX will return error code If TimeOut is 0 function SEND_CMD_RBUFFER_CINDEX will wait for client response until client is responding for max time 3 seconds Return values are 0 OK data was sent successfully 1 address parameter bufadadr is out of range 39 Remote control of PG4UW user s manual 2 sent buffer data size parameter bufsize is out of range 3 timeout occurred client is not responding 4 TCP communication object does not exist or not connected 5 unknown error function SEND_CMD_WBUFFER_EX_CINDEX index integer buffindex integer bufadadr longint bufptr pointer bufsize integer timeout integer integer stdcall Function is used to write specified block of data to main device buffer of remote client Pg4uw program The function is very similar to function SEND _CMD_WBUFFER_CINDEX The only difference is one more parameter buffindex which is used to specify buffer to be used for writing data Parameters used are index index of Client programmer Site buffindex specifies the order of buffer where data will sent the main buffer has index 1 The first secondary buffer has index 2 etc Please note the secondary buffer s is are available for some kinds of devices onl
16. 8 running on the server computer do not need IP address to be specified Sites 9 to 16 running on remote computer require IP address of server computer be specified in command line For more details look at examples bellow Examples Example of using command line parameters for Pg4uw applications started on server computer For Site 1 Pg4uw exe usb 1 469 00016 enableremote autoanswer For Site 2 Pg4uw exe usb 2 469 00018 enableremote autoanswer For Site 3 Pg4uw exe usb 3 469 00051 enableremote autoanswer Numbers 469 00016 469 00018 and 469 00051 are example serial numbers of programmer Sites Example of using command line parameters for Pg4uw applications started on remote computer For Site 9 Pg4uw exe usb 9 469 00078 enableremote autoanswer remoteaddr 192 168 0 10 For Site 10 Pg4uw exe usb 10 469 00079 enableremote autoanswer remoteaddr 192 168 0 10 For Site 11 Pg4uw exe usb 11 469 00123 enableremote autoanswer remoteaddr 192 168 0 10 Numbers 469 00078 469 00079 and 469 00123 are example serial numbers of programmer Sites Server computer has IP address 192 168 0 10 These command line parameters are enough to use for successful connection to remote control program Tip We recommend to use also Load project command line parameter prj lt prj_name gt when starting Pg4uw programs Project loading from command line parameter saves time because Pg4uw does not need to select default device a
17. CheckDevice Example Server request SEND_CMD_EraseDevice Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone 13 Remote control of PG4UW user s manual answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD TREND ORE TCP_KEYWORD_OPRESULT_FAIL Tee ChB OPRET TCP_KEYWORD_OPRESULT_HWERR TCR CtD GORESUIS TCP_KEYWORD_OPRESULT_NONE procedure SEND_CMD_RepeatLastDevOperation stdcall Procedure is used to send lastly used device operation command to Client For example if lastly used command is SEND_CMD_ProgramDevice the Call of procedure SEND_CMD_RepeatLastDevOperation will be the same as call of SEND_CMD_ProgramDevice Example Server request SEND_CMD_RepeatLastDevOperation Answer from client client send operation result procedure SEND_CMD_ Stop stdcall Procedure is used to send message stopoperation to Client When Client receives the message it stops current device operation If no operation is running the stopoperation command does nothing Other function of stopoperation is closing message window s in Client application Example Server request SEND_CMD_Stop Answer from client client send no answer procedure SEND_CMD_Selec
18. F0004H 21H writebufferex INDEX ADDR1 B11 B12 B13 B14 B1N ADDR2 B21 B22 B23 B24 B2M Command writebufferex is used to write block of Bytes to Pg4uw main buffer at specified address The command is very similar to command writebuffer except one more parameter INDEX The INDEX parameter specifies the order of buffer where data will sent The main buffer has index 1 The first secondary buffer has index 2 etc Please note the secondary buffer s is are available for some kinds of devices only e g Microchip PIC16F628 The kind of buffer indexed by parameter buffindex depends on order of buffer in application Pg4uw in dialog View Edit buffer For example device Microchip PIC16F628 has additional buffer with label Data EEPROM This buffer can be accessed for data write s by this function when buffindex 2 is specified Example 1 writebufferex 1 7F F800 12 AB C5 D4 7E 80 The command is equivalent to command writebuffer 1 7FF800 12 AB C5 D4 7E 80 described in section about command writebuffer Example 2 PONDS on writebufferex 2 2F 12 AB C5 D4 7E 80 The command writes 6 Bytes 12H ABH C5H D4H 7EH 80H to secondary buffer with index 2 at address 2FH The addressing looks like following the first Byte at the lowest address Buffer Address Data 00002FH 12H 000030H ABH 000031H C5H 000032H D4H 000033H 7EH 000034H 80H 6 4 Basic rules for using of executive command line parameters p
19. Good TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD TOD SOBRE SU TCP_KEYWORD_OPRESULT_FAIL Tee Cub OPRESUET TCP_KEYWORD_OPRESULT_HWERR EUD OPPE SUT TCP_KEYWORD_OPRESULT_NONE procedure SEND_CMD_EraseDevice_CINDEX index integer stdcall Procedure is used to send message erasedevice to Client with index specified by parameter index When Client receives the message it starts device Erase operation In the end of operation Client sends operation result to Server Other properties of PG4UW behaviour are same as for command procedure SEND_CMD_BlankCheckDevice Example Server request SEND_CMD_EraseDevice_CINDEX 1 Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD or TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_FAIL or TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_HWERR or TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_NONE procedure SEND_CMD_RepeatLastDevOperation_CINDEX index integer stdcall Procedure is used to send lastly used device operation com
20. MD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD or 12 Remote control of PG4UW user s manual TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_FAIL or TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_HWERR or TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_NONE procedure SEND_CMD_ProgramDevice stdcall Procedure is used to send message programdevice to Client When Client receives the message it starts device Program operation In the end of operation Client sends operation result to Server Other properties of PG4UW behaviour are same as for command procedure SEND_CMD_BlankCheckDevice Example Server request SEND_CMD_ProgramDevice Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD OP Oi OPRESULT TCP_KEYWORD_OPRESULT_FAIL Toe BHD OBRESULE TCP_KEYWORD_OPRESULT_HWERR TEP TVD OPRESULT TCP_KEYWORD_OPRESULT_NONE procedure SEND_CMD_EraseDevice stdcall Procedure is used to send message erasedevice to Client When Client receives the message it starts device Erase operation In the end of operation Client sends operation result to Server Other properties of PG4UW behaviour are same as for command procedure SEND_CMD_Blank
21. ND _CMD_RBUFFER_EX_CINDEX will wait for client response until client is responding for max time 3 seconds Return values are 0 OK data was sent successfuly 1 address parameter bufadadr is out of range 2 sent buffer data size parameter bufsize is out of range 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 unknown error 6 Remote command line control of PG4UW 6 1 Configuration command line parameters The remote control function of Pg4uw application s needs the remote control feature enabled This can be done by one of two ways 1 enabling remote control by checking check box Enable program remote control in Pg4uw s General options dialog The dialog is accessible by menu command Options General options Remote control options are placed in that dialog at page Remote control 2 enabling remote control by using command line parameter enableremote autoanswer It is recommended to use remote control command line parameter instead of manual remote control options setting The command line parameter has format enableremote autoanswer The optional part autoanswer is required for multiprogramming remote control controlling more than one instance of Pg4uw at the same time and is optional for single programming remote control The autoanswer option modifies behavior of Pg4uw application as following when the option is not u
22. Proc lt gt nil the function GetCommandStringFromF IFO is not usable and it will always return value nil 2 The FIFO buffer has size 128 items It means it can store maximally of 128 commands received from Client Pg4uw So it is recommended to call function GetCommandStringFromFIFO_CINDEX periodically to pop commands from FIFO and prevent FIFO buffer from getting full If the number of commands received is greater than capacity of FIFO memory the newly coming commands are ignored Of course the Client does not send commands or information to Server application without requiring them from Server So reading commands from FIFO has sense in cases the Server sends commands to Client 3 Commands received by function GetCommandStringFromFIFO_CINDEX are in form 38 Remote control of PG4UW user s manual of null terminated strings The type of null terminated string is known as PChar in Pascal language char in C C A null terminated string is a zero based array of characters that ends with NULL 0 since the array has no length indicator the first NULL character marks the end of the string function SEND_CMD_WBUFFER_CINDEX index integer bufaddr longint bufptr pointer bufsize integer timeout integer integer stdcall Function is used to write specified block of data to main device buffer of remote client Pg4uw program Parameters used are index index of Client programmer Site bufaddr buffer addres
23. ProgStatus stdcall Procedure is used to send message getprogstatus to Client When Client receives the message it sends its current status info to Server The status info command received from Client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Status info contains four basic info status data busy status current device operation type current device operation progress For more information see the example unit Example 1 Server request SEND_CMD_GetProgStatus Answer from client client current status information operation_code enumeration type operation_code otNone otRunApp otblankCheck otReadDevice otVerifyDevice 16 Remote control of PG4UW user s manual otProgramDevice otEraseDevice otPlayPlayer otLoadProject otStop otSelfTest otSelfTestPlus codes for current status information TCP_KEYWORD_OPTYPE optype TCP_KEYWORD_PROGRESS progress TCP_CMD_PROGRAMMER_READY_STATUS programmerreadystatus TCP_KEY_PROGRAMMER_NOTFOUND notfound TCP_KEY_PROGRAMMER_READY ready answer will be in followed form TCP_KEYWORD_OPTYPE operation_code TCP_KEYWORD_PROGRESS device_progress TCP_CMD_PROGRAMMER_READY_STATUS TCP_KEY_PROGRAMMER_READY or TCP_KEYWORD_OPTYPE operation_code TCP_KEYWORD_PROGRESS device_progress
24. Remote control of PG4UW user s manual Remote control of PG4UW user s manual Version 1 28 Date June 28th 2012 Preface There exist more reason why to control the programmer not by PG4UW software directly but from other software Therefore we provide a remote controlling capability of PG4UW software The remote control feature allows to be PG4UW software flow controlled by other application either using BAT file commands or using DLL file This manual describes basic features of remote control capability of PG4UW control program and also explain how to implement the remote control functions available in the PG4UW remotelb dill library file Remote control of PG4UW user s manual Table of Contents 1 Basic facts about remote COntrOl cle ec eccccccccccccccccecececccscececseecsceeusanescesceeuuanseesceeauens 3 2 Published functions in library remotelb dll eee ee ceccesceeeneeeseeceseceseeeseeeeenseeeeseneeeeneaeees 4 2 1General functions for Client Server remote control connection establishing and connection parameters setting eeecssecccccceeeeseesennececeeeeeseeeennneeeeceeeeseesseaneeeeeeeeseeeeeeteeeeeeeeeeeess 4 2 2Procedures used for sending basic types of commands from remote Server to PG4UW ST ee ats PRTC TE eC PRT EE ee ee REET REMT DS SERERE ERE PRE RC OIAE NRE A Are neem orn EA IEE 8 2 3Constants used by remote control COMMUNICATION ccccccececeeseeeseeeeeeeteeetseeneeenseeenees 23 3 Short example of
25. UW user s manual procedure SEND_CMD_GetProjectFileChecksum prjname PChar stdcall Procedure is used to send message getprojectfilechecksum to Client When Client receives the message it tries to compute CRC 32 of project file specified by parameter prjname The Client sends result to Server The result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients procedure SEND_CMD_LoadFile fname PChar stdcall Procedure is used to send message loadfile to Client When Client receives the message it tries to load file specified by parameter fname The Client sends load file result to Server The result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Example Server request SEND_CMD_LoadFile C test bin Answer from client client send file load result codes for Load file project result TCP_CMD_LOAD_FILE_PRJ_RESULT loadresult TCP_FILE_LOAD_GOOD frgood TCP_FILE_LOAD_ERROR frerror TCP FILE LOAD CANCELLED frcancelled Hanswer will be in followed form TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_GOOD or TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_ERROR or TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_CANCELLED procedure SEND_CMD_Get
26. application MessageBox Pchar There are no Pg4uw applications connected 13 10 13 10 Please use the Connect programmer button to run 13 10 and connect Pg4uw application PChar caption mb_ok MB_ICONWARNING end procedure example of procedure for processing client answer procedure Process_CMD_OPRESULT CMDline ansistring var tmpstr string btn_run_visible boolean begin enable write commands to log but if pointer Write ToLogwindowProc in CreateServerAndMakeListenToClients is nil following line has no effect EnableWriteEventsToLog true tmpstr copy CmdLine length TCP_CMD_OPRESULT 1 length CmdLine remember device result if tmpstr TCP_KEYWORD_OPRESULT_GOOD then begin device_op_result oprGood inc statist_rec good inc statist_rec total end if tmpstr TCP_KEYWORD_OPRESULT_GOOD else if tmpstr TCP_KEYWORD_OPRESULT_FAIL then begin device_op_result oprFail inc statist_rec fail inc statist_rec total end else if tmpstr TCP_KEYWORD_OPRESULT_FAIL else if tmpstr TCP_KEYWORD_OPRESULT_HWERR then begin device_op_result oprHWError 11 Remote control of PG4UW user s manual inc statist_rec fail inc statist_rec total end else if tmpstr TCP_KEYWORD_OPRESULT_HWERR then else device_op_result oprNone end procedure SEND_CMD_ReadDevice stdcall Procedure is used to send message readdevice to Client When Client rece
27. application processmessages check also timeout if GetTickCount start_time gt MAX_TIMEOUT_FOR_DISCONNECT then break end while finally write info about Sites disconnection completion to Log window Write ToLogwindowProc Sites successfuly disconnected end try end procedure SEND_CMD_SelectDevice_CINDEX index integer devmanuf devname PChar stdcall Procedure is used to send message selectdevice to Client with index specified by parameter index When Client receives the message it tries to select specified device Device is specified by parameters devmanuf and devname Parameters are not case sensitive The Client sends select device result to Server The result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Example To select device Intel TE28F160C3B TSOP48 call Server request SEND_CMD_SelectDevice_CINDEX 1 Intel TE28F160C3B TSOP48 Answer from client client send operation result codes for operations result TCP_CMD_SELECT_DEVICE_RESULT selectdeviceresult TCP_SELECT_DEVICE_GOOD good TCP_SELECT_DEVICE_ERROR error answer will be in followed form TCP_CMD_SELECT_DEVICE_RESULT TCP_SELECT_DEVICE_GOOD or TCP_CMD_SELECT_DEVICE_RESULT TCP_SELECT_DEVICE_ERROR procedure SEND_CMD_EPROMFLASH_AutoSelect_CINDEX index integer
28. aption mb_ok MB_ICONWARNING exit end if device_progress index busy else begin the first step is to send commands Stop operations two times SEND_CMD_Stop Application ProcessMessages Sleep 250 wait SEND_CMD_Stop Application ProcessMessages Sleep 250 wait the next step is to send commands Close aplication SEND_CMD_CloseApp Application ProcessMessages Sleep 250 wait btnConnectProg enabled true end if device_progress busy if Sender is Close button let s close remote control application disconnect_was_Successful true end procedure Remote control of PG4UW user s manual procedure SEND_CMD_BlankCheckDevice stdcall Procedure is used to send message blankcheck to Client When Client receives the message it starts device Blank check operation In the end of operation Client sends operation result to Server Operation result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Client PG4UW can accept and start blankcheck command only when no operation is currently running in PG4UW If PG4UW is running some operation the blankcheck command will be ignored To receive the current status of programmer use command SEND_CMD_GetProgStatus described later When last device operation differs from currently selected device operation we have to send co
29. arameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND _CMD_RBUFFER_EX will return error code If TimeOut is 0 function SEND_CMD_RBUFFER_EX will wait for client response until client is responding for max time 3 seconds Return values are 0 OK data was sent successfuly 1 address parameter bufadadr is out of range 2 sent buffer data size parameter bufsize is out of range 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 unknown error function SEND_CMD_SaveFile filename PChar fileformat integer timeout integer integer stdcall Function is used to write buffer content of remote client Pg4uw to specified file at specified file format Parameters used are filename name of file where buffer data have to be saved fileformat can be one of following values FILEFORMAT_BINARY binary file format FILEFORMAT_INTELHEX IntelHex file format FILEFORMAT_MOTOROLA Motorola file format 21 Remote control of PG4UW user s manual FILEFORMAT_ASCIISPACE ASCII Space file format timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND_CMD_SaveFile will return error code If TimeOut is 0 funct
30. ations were successful PG4UWcmd exe returns 0 otherwise returns value 1 or more aARWNS Example 2 PG4UWcmd exe program noanyquest prj c emproject eprj The operations are the same as in Example 1 just Load file operation is replaced by Load project file c emproject eprj command Example 3 Using PG4UWcmd exe in batch file and testing return code of PG64UWcmd exe rem beginning of batch echo off rem Call application with wished parameters PG4UWcmd exe program noanyquest prj c emproject eprj rem Detect result of command line execution rem Variable errorlevel is tested value 1 or greater means the error occured if errorlevel 1 goto FAILURE echo Command line operation was successful goto BATCHEND FAILURE echo Command line operation error s BATCHEND echo echo This is end of batch file or continue pause Example 4 Let s assume the Pg4uw control program is running and has user selected device We need to load required data to Pg4uw device buffer and save the selected device settings and buffer content to project file Data required for device are stored in file c 15001 25001 file_10 bin Project file will be stored at c projects project_10 eprj Following command line parameters should be specified to realize wished operation PG4UWcma exe oadfile c 15001 25001 file_10 bin saveproject c projects project_10 eprj When Pg4uw receives the commands it will do foll
31. buffer from Pg4uw remote client to memory region specified by pointer parameter bufptr The function is very similar to function SEND_CMD_RBUFFER_CINDEX The only difference is one more parameter buffindex which is used to specify buffer to be used for reading data from 40 Remote control of PG4UW user s manual Parameters used are index index of Client programmer Site buffindex specifies the order of buffer where data will sent the main buffer has index 1 The first secondary buffer has index 2 etc Please note the secondary buffer s is are available for some kinds of devices only e g Microchip PIC16F628 The kind of buffer indexed by parameter buffindex depends on order of buffer in application Pg4uw in dialog View Edit buffer For example device Microchip PIC16F628 has additional buffer with label Data EEPROM This buffer can be accessed for data write s by this function when buffindex 2 is specified bufaddr buffer start address in Pg4uw from data has to be read bufptr pointer to memory block of data where data has to be copied bufsize number of bytes which have to be read from Pg4uw buffer valid values are from 1 to 256 bytes timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND _CMD_RBUFFER_EX_CINDEX will return error code If TimeOut is 0 function SE
32. cessfully connected False BAD programmer is not found or no response received timeout occurs function GetCommandStringFromFIFO_CINDEX index integer PChar stdcall Function is used to read next remote received information or control command from Client Pg4uw application with index specified by parameter index The commands received from client are stored internally in remotelb dll in FIFO buffer User can access the FIFO sequentially by this function Each call of this function will pick the oldest command from FIFO buffer and decrements internal FIFO counter by 1 If the number of items in FIFO is 0 function will return value nil Return values are If the function succeeds the return value is pointer to command string read from FIFO If the function fails the return value is nil Function fails if it is called while FIFO buffer of commands is empty or FIFO does not exist This function is especially useful when user does not use callback functions in server remote control application In such case the commands received from Pg4uw Client can be read by using function GetCommandStringFromFIFO_CINDEX More details about using the function can be seen in remote control examples Notes 1 The function is active only when callback procedure pointer specified by parameter vProcessProc in remote control initialization procedure CreateServerAndMakeListenToMultiClients is nil If there is specified callback procedure vProcess
33. dMakeListenToMultiClients MultiClientWMode BOOL vProcessProc TProcWithPChar vWriteToLogProc TProcWithPChar onClientConnectProc TProc onClientDisconnectProc TProc vPort PChar stdcall Procedure creates Server communication object with defined parameters and starts waiting for Client s This procedure is used by Server application remote control program Input parameters are MultiClientvode BOOL this parameter should be always true for multiprogramming mode vProcessProc TProcWithPChar define pointer to optional callback procedure which will be called every time Server receives message s from Pg4uw Clients This is usual way to receive information or commands from remote Pg4uw Client If vVProcessProc is defined as nil no on client command received event will be used Then the only way how to receive information and commands from Client is reading of commands explicitly by calling of special function GetCommandStringFromFIFO_CINDEX For more details please take a look at description of function GetCommandStringFromFIFO_CINDEX vWriteToLogProc TProcWithPChar define pointer to optional callback procedure which is useful especially during debugging of Server program Procedure is called when any of basic Client Server communication events occures Communication events are connect disconnect Client Server send message to Client receive message from Client Procedure can contain user defined write to memo
34. dard installation of Pg4uw Program Multidemo is windows based application written in Borland Delphi programming environment There is available also version of Multidemo written in Microsoft Visual Studio NET Complete sources of this program are included too 7 2 Basic description of Multidemo application Program Multidemo is included with commented sources written for Borland Delphi 6 or newer The main conception of the program is to make control of one or more Pg4uw applications communication between Multidemo and Pg4uw applications is made by TCP IP protocol on port telnet value 23 Multidemo acts as server and Pg4uw applications act as clients Multidemo can control Pg4uw running on the same computer localhost and also on different remote computer connected together by network with TCP IP support remote control commands are send received in form of strings to simplify the usage of remote control we made library remotelb dll which contains functions and procedures to send commands from server to Pg4uw clients status information received from Pg4uw is proceed in server Multidemo remote control program by following scheme Pg4uw status information strings are stored in internal FIFO in library remotelb dll Communication between client server is made mostly asynchronously To make request of information from Pg4uw remote control program has to send command procedure SEND_CMD_GetProgStatus_CINDEX index to all connected Pg4uw a
35. e message it tries to make BringToFront operation BringToFront operation is basically activation of Client application window Example Server request SEND_CMD_BringToFront_CINDEX Answer from client client send no answer procedure SEND_CMD_ShowMainForm_CINDEX index integer stdcall Procedure is used to send message showmainform to Client with index specified by parameter index When Client receives the message it makes Show command for main window of the Client application The message does nothing if the main window of Client application is already visible Please use this command only in situations when no operation is currently running in the Client application Example Server request SEND_CMD_ShowMainForm_CINDEX 1 Answer from client client send no answer procedure SEND_CMD_HideMainForm_CINDEX index integer stdcall Procedure is used to send message hidemainform to Client with index specified by parameter index When Client receives the message it makes Hide command for main window of the Client application Also Client s icon placed on taskbar will be hidden and small icon appears on the tray panel The message does nothing if the main window of Client application is already hidden Please use this command only in situations when no operation is currently running in the Client application 29 Remote control of PG4UW user s manual Example Server request SEND_CMD_HideMai
36. edure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Example Server request SEND_CMD_LoadFile_CINDEX 1 C test bin 35 Remote control of PG4UW user s manual Answer from client client send file load result codes for Load file project result TCP_CMD_LOAD_FILE_PRJ_RESULT loadresult TCP_FILE_LOAD_GOOD frgood TCP_FILE_LOAD_ERROR frerror TCP_FILE_LOAD_CANCELLED frcancelled answer will be in followed form TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_GOOD or TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_ERROR or TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_CANCELLED procedure SEND_CMD_GetProgStatus_CINDEX index integer stdcall Procedure is used to send message getprogstatus to Client with index specified by parameter index When Client receives the message it sends its current status info to Server The status info command received from Client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Status info contains four basic info status data busy status current device operation type current device operation progress For more information see the example unit Example 1 Server request SEND_CMD_GetProgStatus_CINDEX 1 Answer from client client current status information operation_code enumeration type
37. erted device pin number automatically The Client sends currently selected device to Server but not result of autoselect detection success Example Server request SEND_CMD_EPROMFLASH_AutoSelect device pins detected automatically SEND_CMD_EPROMFLASH_AutoSelect 48 48 pins device Answer from client client send currently selected device codes for operations result TCP_CMD_AUTSEL_EPRFLSH_RESULT autoseldeviceresult answer will be in followed form TCP_CMD_AUTSEL_EPRFLSH_RESULT manufacturer device name procedure SEND_CMD_LoadProject prjname PChar stdcall Procedure is used to send message loadproject to Client When Client receives the message it tries to load project file specified by parameter prjname The Client sends load project result to Server The result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Example Server request SEND_CMD_LoadProject C test epr Answer from client client send project load result codes for Load file project result TCP_CMD_LOAD_FILE_PRJ_RESULT loadresult TCP_FILE_LOAD_GOOD frgood TCP_FILE_LOAD_ERROR frerror Hanswer will be in followed form TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_GOOD or TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_ERROR 15 Remote control of PG4
38. f Pg4uw app is not busy if device_progress busy then begin f application MessageBox Pchar Programmer is still busy 13 10 13 10 Please wait to complete current operation on running programmer or use Stop command 13 10 to stop current operation 10 Remote control of PG4UW user s manual PChar caption mb_ok MB_ICONWARNING exit end btnRun enabled false btnLoadSelectedPrj enabled false btnLoadSelectedFile enabled false check what device operation has to be started AppOpType MCsettingsRec app_user_devop_array when last device operation differs from currently selected device operation we have to send command STOP to close Repeat wait dialog in Pg4uw if AppOpType lt gt otRunApp then if lastrunop lt gt AppOpType then begin lastrunop AppOpType SEND_CMD_Stop application processmessages sleep 350 end if lastrunop lt gt AppOpType now let s send wished command to Pg4uw case AppOpType of otNone otRunApp SEND_CMD_BringToFront otblankCheck SEND_CMD_BlankCheckDevice otReadDevice SEND_CMD_ReadDevice otVerifyDevice SEND_CMD_VerifyDevice otProgramDevice SEND_CMD_ProgramDevice otEraseDevice SEND_CMD_EraseDevice otStop SEND_CMD_Stop else SEND_CMD_BringToFront unknown operation do Bring to front only end case sleep 100 wait application processmessages sleep 20 wait end if GetifAnyClientApp sConnectedToServer else
39. fsize is out of range 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 unknown error function SEND_CMD_RBUFFER_EX buffindex integer bufadadr longint bufptr pointer bufsize integer timeout integer integer stdcall Function is used to read specified region of main device buffer from Pg4uw remote client to memory region specified by pointer parameter bufptr The function is very similar to function SEND_CMD_RBUFFER The only difference is one more parameter buffindex which is used to specify buffer to be used for reading data from Parameters used are buffindex specifies the order of buffer where data will sent the main buffer has index 1 The first secondary buffer has index 2 etc Please note the secondary buffer s is are available for some kinds of devices only e g Microchip PIC16F628 The kind of buffer indexed by parameter buffindex depends on order of buffer in application Pg4uw in dialog View Edit buffer For example device Microchip PIC16F628 has additional buffer with label Data EEPROM This buffer can be accessed for data write s by this function when buffindex 2 is specified bufaddr buffer start address in Pg4uw from data has to be read bufptr pointer to memory block of data where data has to be copied bufsize number of bytes which have to be read from Pg4uw buffer valid values are from 1 to 256 bytes timeout the timeout p
40. fter starting 48 Remote control of PG4UW user s manual 7 1 Sequence of steps is recommended when starting multiprogramming system Be sure the programmer Sites on both computers are connected to USB ports and have correctly installed USB drivers Information about hardware installation of programmers is available in programmer manuals Start remote control program server application When remote control program RCP is started it waits for Clients Pg4uw When client with proper index is started it will automatically connect to RCP After establishing connection between client server remote control commands can used Start Sites 1 to 8 with proper indexes and serial numbers of Sites specified Starting of Sites 1 to 8 can be performed automatically by remote control program or manually by running Pg4uw 1 to Pg4uw 8 with proper parameters in command line There can be started the same Pg4uw exe application for each Site The only difference will be in command line parameters Start Sites 9 to 16 on remote computer Sites can be started manually by running Pg4uw 9 to 16 with suitable command line parameters Of course Pg4uw must be installed on the remote computer When sites are connected the remote control program should detect new clients connected and can make suitable indication of this information This sequence can be practically tested with remote control demonstration program Multidemo included in stan
41. guration Ver 1 08 March 28th 2006 added description of remote control examples added in the form of source files added description of remote command functions SEND_CMD_ShowMainForm SEND_CMD_HideMainForm and SEND _CMD_CloseApp Ver 1 07 March 6th 2006 start of using the version history list added description of new remote command function SEND_CMD_SaveFile 54 Remote control of PG4UW user s manual END of documentation 55
42. hen Client receives the message it starts device Verify operation In the end of operation Client sends operation result to Server Other properties of PG4UW behaviour are same as for command procedure SEND_CMD_BlankCheckDevice Example Server request SEND_CMD_VerifyDevice_CINDEX 1 Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD Top bile PRESU TCP_KEYWORD_OPRESULT_FAIL Tee CUD ERE wie TCP_KEYWORD_OPRESULT_HWERR Tepe OPRESUEE TCP_KEYWORD_OPRESULT_NONE procedure SEND_CMD_ProgramDevice_CINDEX index integer stdcall Procedure is used to send message programdevice to Client with index specified by parameter index When Client receives the message it starts device Program operation In the end of operation Client sends operation result to Server Other properties of PG4UW behaviour are same as for command procedure SEND_CMD_BlankCheckDevice Example 31 Remote control of PG4UW user s manual Server request SEND_CMD_ProgramDevice_CINDEX 1 Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD opr
43. icture 1 Typical configuration of remote controlled multiprogramming system running on two computers Computer 1 IP 192 168 0 10 Computer 2 Remote control programy Network TCP IP A TCP IP Y Network A A Network adapter adapter Programmer Sites A KAKA KRAAKAAAA A USB USB gt Pg4uw 1 lt q gt Site 1 Site 9 lt q gt Pg4uw 9 lt q gt Pg4uw 10 lt gt Pg4uw 2 lt q gt Site 10 lt gt Site 3 Site 11 q gt Pg4uw 11 q gt Site 4 Site 12 lt TCP protocol gt Site 5 ll Site 13 lt gt Site 6 Site 14 lt gt Site 7 Site 15 lt The example of IP address for Computer 1 is 192 168 0 10 Computer 1 is also server computer because Remote control program is running on it 47 Remote control of PG4UW user s manual Description of command line parameter remoteaddr lt address gt When we want to control programmer Sites Pg4uw clients by remote control program server the Pg4uw must know address of server computer This address can be specified by command line parameter when starting Pg4uw The default value is localhost It means that Pg4uw programs running on the same computer as remote control program there is no need to specify the address Address is required for Pg4uw applications running on different computer only If we take configuration from Picture 1 we can tell that Sites 1 to
44. ientConnectionlsClosed boolean stdcall Function returns true if Client connection status is Closed otherwise returns false Function is used by PG4UW Client application Server application should not use this procedure function ServerHasConnectedClient boolean stdcall Function is used by Server application Function returns true if Client is connected to Server otherwise returns false procedure EnableWriteEventsToLog value boolean stdcall Procedure is used by Client and Server applications The purpose of the procedure is to block calls of procedure vWriteToLogProc defined as parameter of procedures CreateClienthndMakeConnectionToServer and CreateServerAndMakeListenToClients function GetCurrentPort PChar stdcall Function is used by Client and Server applications Function returns the value of current port for example 2020 telnet etc Remote control of PG4UW user s manual function GetCurrentAddr PChar stdcall Function is used by Client applications Function returns the value of current address for example localhost or 127 0 0 1 192 168 0 10 For Server the function returns always value 0 0 0 0 procedure ClientServerProcessMessages stdcall Procedure is used to quickly build a working message pump It loops through message processing until all messages are processed This function is very similar to TApplication ProcessMessage The procedure is suitable especially if your ap
45. ined as nil no write to log events will be used onClientConnectProc TProc optional callback procedure is called as event when Client is connected to Server If it is defined as nil no on client connect event will be used onClientDisconnectProc TProc optional callback procedure is called as event when Client is disconnected from Server If it is defined as nil no on client disconnect event will be used vPort PChar defines port for TCP communication default is telnet Remote control of PG4UW user s manual Server does not have address defined itself Internally Server has defined address 0 0 0 0 which means that Server accepts Clients from all interfaces Code example callback method procedure intServerProcessProc CMDline ansistring procedure handles one line of message from client var begin end tmpstr string index q integer CMDline trim CMDline now try to obtain client index from CMDline not used in single programming mode if pos TCP_KEYWORD_CINDEX LowerCase CMDline 1 then begin tmpstr trim copy CMDline length TCP_KEYWORD_CINDEX 1 length CMDline tmpstr trim copy tmpstr 1 pos tmpstr 1 if not Str2int tmpstr index then exit q pos CMDline if q gt 0 then CMDiine trim copy CMDline q 1 length CMDline else CMDline end if pos TCP_KEYWORD_CINDEX LowerCase CMDline 1 CMD program is busy if Compa
46. ion SEND_CMD_ SaveFile will wait for client response until client is responding for max time of 15 seconds Return values are 0 OK data was saved to file successfully Error return codes 1 unsupported incorrect file format 2 file save error 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 file save error or unknown error function SEND_CMD_GetDev_Checksum timeout integer pchecksum LPDWORD integer stdcall Function sends command get device checksum to Pg4uw client application Function is waiting for client s response Parameters used are timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout the function will return error code If TimeOut is 0 function will wait for client response until client is responding for max time 10 seconds pchecksum address of variable for checksum value points to a 32 bit DWORD variable that receives the checksum value Return values are 0 OK checksum was received successfuly 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 unknown error Checksum returned by function SEND_CMD_GetDev_Checksum in the variable referenced by pointer pchecksum is the same checksum value as checksum displayed in main window of Pg4uw co
47. is currently running in the Client application Remote control of PG4UW user s manual Example Server request SEND_CMD_HideMainForm Answer from client client send no answer procedure SEND_CMD_CloseApp stdcall Procedure is used to send message closeapp to Client When Client receives the message it makes Close command for main window of the Clients application The Close command can be properly performed when no operation is currently running in the Client application Please use the SEND_CMD_CloseApp command when no operation on device is running and no modal dialogs are shown To ensure that no operation is currently running command SEND_CMD_GetProgStatus can be used Also commands SEND_CMD_ Stop for operation stopping can be used For more details see enclosed examples of remote control written in Pascal and C languages Examples are described in the chapter III of this manual Example 1 Server request SEND_CMD_CloseApp Answer from client client send no answer Example 2 procedure Tformsimpledemo btnDisconnectProgClick Sender TObject begin if not ServerHasConnectedClient then btnConnectProg enabled true else check if Pg4uw app is not busy if device_progress busy then begin if application MessageBox Pchar Programmer is still busy 13 10 13 10 Please wait to complete current operation on running programmer or use Stop command 13 10 to stop current operation PChar c
48. is used to send message cmdlineparams to Client When Client receives the message it starts processing of received parameters The procedure is used for internal purposes Please do not use the SEND_CMD_PROCESS_CMDLINE function SEND_CMD_GetProgrammerConnectedStatus BOOL stdcall Function is suitable to detect if the programmer is successfully connected and present in Pg4uw application Function sends command get programmer connection status to client application and waits for client response timeout is 3 seconds Function has no parameters Return values are True OK programmers is successfully connected False BAD programmer is not found or no response received timeout occurs function GetCommandStringFromFIFO PChar stdcall Function is used to read next remote received information or control command from connected Client Pg4uw application The commands received from client are stored internally in remotelb dll in FIFO buffer User can access the FIFO sequentially by this function Each call of this function will pick the oldest command from FIFO buffer and decrements internal FIFO counter by 1 If the number of items in FIFO is 0 function will return value nil Return values are 18 Remote control of PG4UW user s manual If the function succeeds the return value is pointer to command string read from FIFO If the function fails the return value is nil Function fails if it is called while FIFO buffer of c
49. ives the message it starts device Read operation In the end of operation Client sends operation result to Server Other properties of PG4UW behaviour are same as for command procedure SEND_CMD_BlankCheckDevice Example Server request SEND_CMD_ReadDevice Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD TOR CHB OPRESUER TCP_KEYWORD_OPRESULT_FAIL eee TCP_KEYWORD_OPRESULT_HWERR Tee GHD CORRES TCP_KEYWORD_OPRESULT_NONE procedure SEND_CMD_VerifyDevice stdcall Procedure is used to send message verifydevice to Client When Client receives the message it starts device Verify operation In the end of operation Client sends operation result to Server Other properties of PG4UW behaviour are same as for command procedure SEND_CMD_BlankCheckDevice Example Server request SEND_CMD_VerifyDevice Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_C
50. k adapter example for Windows XP aOnakRWN gt N click Start menu select Settings item select Control panel in Control panel window click on Add Hardware in Add Hardware Wizard dialog click on button Next on question Have you already connected this hardware on computer select option Yes have already connected the hardware and click on button Next in the list of available hardware select the item Add a new hardware device and click on button Next on question What do you want the wizard to do select option Install the hardware that manually select from list Advanced and click button Next from the list Common hardware types select item Network adapters and click button Next from left panel Manufacturer select Microsoft from right panel Network adapter select Microsoft Loopback adapter and click button Next on the confirmation click button Next again the adapter is installed Now you can configure the adapter to support TCP protocol Configuration is made in the same way as for real network cards 52 Remote control of PG4UW user s manual 9 Version history of this documentation Ver 1 28 June 28th 2012 added note about programmer serial number into chapter 5 Using remote control with multiply programmers multiprogramming Ver 1 27 June 14th 2011 added restrictions about Using remote control with multiply programmers mu
51. ltiprogramming Ver 1 26 April 5th 2011 added source code examples Ver 1 25 March 03rd 2011 added information about new remote control function SEND_CMD_GetProjectFileChecksum and minimal requirements modification Ver 1 24 August 5th 2010 section Using remote control with multiply programmers multiprogramming Restrictions section added BeeHive204 and BeeProg2 programmers Ver 1 23 January 9th 2009 added restrictions about Using remote control with multiply programmers multiprogramming Ver 1 22 November 15th 2007 added information about new multiprogramming remote control example sources MultiDemo VB NET for Microsoft Visual Studio NET Ver 1 21 September 17th 2007 added information about Remote control of Pg4uw applications running on different computer s added information about new command line parameter startvisible Ver 1 20 July 26th 2007 added information about command line parameter enableremote autoanswer Ver 1 19 March 15th 2007 added information about new remote control examples written in Microsoft Visual Basic NET Ver 1 18 February 22nd 2007 added Note 3 about null terminated strings in description of functions GetCommandStringFromFIFO and GetCommandStringFromFIFO_CINDEX Ver 1 17 February 15th 2007 added information about new command line parameter Demo added information about new remo
52. mand to Client with index specified by parameter index For example if lastly used command is SEND_CMD_ProgramDevice the call of procedure SEND_CMD_RepeatLastDevOperation will be the same as Call of SEND_CMD_ProgramDevice procedure SEND_CMD_Stop_CINDEX index integer stdcall 32 Remote control of PG4UW user s manual Procedure is used to send message stopoperation to Client with index specified by parameter index When Client receives the message it stops current device operation If no operation is running the stopoperation command does nothing Other function of stopoperation is closing message window s in Client application Example Server request SEND_CMD_Stop_CINDEX 1 Answer from client client send no answer procedure SEND_CMD_CloseApp_CINDEX index integer stdcall Procedure is used to send message closeapp to Client with index specified by parameter index When Client receives the message it makes Close command for main window of the Clients application The Close command can be properly performed when no operation is currently running in the Client application Please use the SEND_CMD_CloseApp command when no operation on device is running and no modal dialogs are shown To ensure that no operation is currently running command SEND_CMD_GetProgStatus can be used Also commands SEND_CMD_Stop for operation stopping can be used For more details see enclosed examples of remote
53. mmand STOP to close Repeat wait dialog in Pg4uw Example 1 Server request SEND_CMD_BlankCheckDevice Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD GOP CB OPRESUEE TCP_KEYWORD_OPRESULT_FAIL qe OPRESA TCP_KEYWORD_OPRESULT_HWERR Tee Bib OBRESULE TCP_KEYWORD_OPRESULT_NONE Example 2 procedure Tformsimpledemo btnRun_zalClick Sender TObject const lastrunop TAppOperationType otNone var AppOpType TAppOperationType begin check if appication is running and ready to go and when it is ready allow remote control Start operation command send to Pg4uw if ServerHasConnectedClient then begin check if last project or file load operation was successfull if load_file_result lt gt frgood then begin application MessageBox Operation Run can not be performed because last project or file load was not successful 13 10 13 10 Please use button Select Project file to select wished project file to load and then use 13 10 command button Load Selected Project file to make project load PChar caption mb_ok MB_ICONWARNING exit end if load_file_result lt gt frgood check i
54. motelb dll contains also set of functions which can be used for remote control of multiply programmers at the same time Functions are very similar to normal functions except that they have one additional parameter index of Client programmer that has to be addressed by the remote command send from server remote control Master application Restrictions multiprogramming feature is available for programmers programming sites connected via USB port only therefore multiprogramming remote control can not be used for programmers connected to PC via LPT port remote control for multiprogramming BeeHive4 BeeHive204 N x BeeProg N x BeeProg2 is available for ISP programming only for example implementation of programmers into ATE machines For automated off line multiprogramming programming in ZIF socket customer can use BeeHive204AP programmer Remote control of BeeHive204AP programmer s is done by remote control of PG64UWMC software Ask us for details if you need it remotelb dll is not thread save therefore if you write multithread application use please critical section Multiprogramming uses individual Pg4uw exe applications running instances for each of programmer used To allow running of more than one instance of Pg4uw exe at the same time special command line parameters have to be specified when starting each of Pg4uw exe instance Command line parameter syntax is following Pg4uw exe usb lt index gt lt
55. n Server application should not use this procedure procedure CreateServerAndMakeListenToClients vProcessProc TProcWithPChar vWriteToLogProc TProcWithPChar onClientConnectProc TProc onClientDisconnectProc TProc vPort PChar stdcall Procedure creates Server communication object with defined parameters and starts waiting for Client s This procedure is used by Server application remote control program Input parameters are vProcessProc TProcWithPChar define pointer to optional callback procedure which will be called every time Server receives message s from Pg4uw Client This is usual way to receive information or commands from remote Pg4uw Client If vVProcessProc is defined as nil no on client command received event will be used Then the only way how to receive information and commands from Client is reading of commands explicitly by calling of special function GetCommandStringFromFIFO For more details please take a look at description of function GetCommandStringFromF IFO vWriteToLogProc TProcWithPChar define pointer to optional callback procedure which is useful especially during debugging of Server program Procedure is called when any of basic Client Server communication events will occure Communication events are connect disconnect Client Server send message to Client receive message from Client Procedure can contain user defined write to memo or log window of Server application If it is def
56. n cycle for Client response The Server waits for Client messages indirectly by using Events Procedure which handles messages from Client must be defined in parameter vProcessProc when creating Server communication object by calling procedure CreateServerAndMakeListenToClients Events are used both in synchronous and asynchronous modes Procedure which handles messages from Client must be defined in parameter vProcessProc when creating Server communication object by calling procedure CreateServerAndMakeListenToClients To create remote control Server application remote control functions have follow order as described bellow 1 create Server object for remote TCP communication and start listening CreateServerAndMakeListenToClients ServerProcessProc Write ToLogwindowProc onClientConnectProc onClientdisconnectProc PChar remote_ctrl_settings Client_Server_Port 2 run PG4UW Client application 3 when Server receives message that client is connected Server can send commands SEND_CMD_ It is recommended to ask Client if it is ready by SEND_CMD_Quest_is_Client_Ready If Client responds answer TCP_KEY_CLIENT_READY_YES it means Client is ready to receive executive commands for example Load project Program device and so on 4 when closing Server application call the MakeClientServertCloseConnectionAndFree procedure 24 Remote control of PG4UW user s manual 4 Remote control examples source files Remote control exam
57. nForm_CINDEX 1 Answer from client client send no answer procedure SEND_CMD_BlankCheckDevice_CINDEX index integer stdcall Procedure is used to send message blankcheck to Client with index specified by parameter index When Client receives the message it starts device Blank check operation In the end of operation Client sends operation result to Server Operation result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Client PG4UW can accept and start blankcheck command only when no operation is currently running in PG4UW If PG4UW is running some operation the blankcheck command will be ignored To receive the current status of programmer use command SEND_CMD_GetProgStatus described later Example 1 Server request SEND_CMD_BlankCheckDevice_CINDEX 1 Answer from client client send operation result codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWError TCP_KEYWORD_OPRESULT_NONE oprNone answer will be in followed form TCP_CMD_OPRESULT TCP_KEYWORD_OPRESULT_GOOD TCP CHB OPRET TCP_KEYWORD_OPRESULT_FAIL E OREST TCP_KEYWORD_OPRESULT_HWERR ePOS OPREDE TCP_KEYWORD_OPRESULT_NONE Example 2 procedure SiteStartDeviceProgramming sitei
58. nd Saveproject is equivalent to user selected command Save project in Pg4uw control program Close 42 Remote control of PG4UW user s manual Parameter Close has sense together with Program parameter only and makes program to close automatically after device programming is finished successfully Close always Parameter Close always has sense together with Program parameter only and makes program to close automatically after device programming is finished no matter if device operation was successful or not Demo Parameter Demo is very useful when no programmer hardware is available and user wants to remote control Pg4uw software anyway If the parameter is specified Pg4uw application will not make search for programmers connected It automatically selects suitable programmer and sets its state to Not connected Parameter Demo can be used with other command line parameters and we recommend to use file or buffer parameters only Parameter Program switch will not work when Demo parameter is specified Eprom_Flash_Autoselect xx Forces automatic select EPROM or FLASH type by reading of electronic ID from the chip inserted currently in ZIF socket of programmer Optional parameter xx means pins number of device in ZIF this time are valid 28 or 32 pins only and it is required just for older programmers without insertion test capability For others programmers the xx parameter can be omitted because is ig
59. ndex integer begin check index range if siteindex lt 1 or siteindex gt MAX_SITE_COUNT then exit check if Site is Ready and not busy if CheckifTheSitelsBusy siteindex true then begin ShowMessage Format Sorry the Site d is busy now Operation can not be started immediately 13 10 Please try again later siteindex exit end if ChecklfTheSitelsBusy siteindex true preventively send command Stop only when current operation detected on Site is different from operation Blank check device if TAppOperationType device_progress siteindex opcode lt gt otblankCheck then 30 Remote control of PG4UW user s manual begin SEND_CMD_Stop_CINDEX siteindex application processmessages sleep 250 end if there can be send one of following commands SEND_CMD_BringToFront_CINDEX index SEND_CMD_BlankCheckDevice_CINDEX index SEND_CMD_ReadDevice_CINDEX index SEND_CMD_VerifyDevice_CINDEX index SEND_CMD_ProgramDevice_CINDEX index SEND_CMD_EraseDevice_CINDEX index SEND_CMD_Stop_CINDEX index SEND_CMD_LoadProject_CINDEX index PChar PRJstr send command Program device to Site client Pg4uw SEND_CMD_BlankCheckDevice_CINDEX index application processmessages sleep 0 end procedure SEND_CMD_VerifyDevice_CINDEX index integer stdcall Procedure is used to send message verifydevice to Client with index specified by parameter index W
60. nguage char in C C A null terminated string is a zero based array of characters that ends with NULL 0 since the array has no length indicator the first NULL character marks the end of the string function SEND_CMD_WBUFFER bufaddr longint bufptr pointer bufsize integer timeout integer integer stdcall Function is used to write specified block of data to main device buffer of remote client Pg4uw program Parameters used are bufaddr buffer address in Pg4uw where data have to be written bufptr pointer to memory block of data which have to be sent to Pg4uw bufsize number of bytes which have to be sent to Pg4uw valid values are from 1 to 256 bytes timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND _CMD_WBUFFER will return error code If TimeOut is 0 function SEND_CMD_WBUFFER will wait for client response until client is responding for max time 3 seconds Return values are 0 OK data was sent successfuly 1 address parameter bufaddr is out of range 2 sent buffer data size parameter bufsize is out of range 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 unknown error function SEND_CMD_RBUFFER bufaddr longint 19 Remote control of PG4UW user s manual bufptr pointer buf
61. nored Examples Eprom_Flash_Autoselect Eprom_Flash_Autoselect 32 writebuffer ADDR1 B11 B12 B13 B14 B1N ADDR2 B21 B22 B23 B24 B2M Command writebuffer is used to write block of Bytes to Pg4uw main buffer at specified address Write buffer command has one block of data required and other block s of data marked with optional Please do not use spaces or tabs in the command Buffer address is always defined as Byte address it means that for buffer organisation x16 the address AAAAx16 in buffer has to be specified in command writebuffer as 2 AAAA x8 Example 1 Mritebuffer 7 FF800 12 AB C5 D4 7E 80 Writes 6 Bytes 12H ABH C5H D4H 7EH 80H to buffer at address 7FF800H The addressing looks like following the first Byte at the lowest address Buffer Address Data 7FF800H 12H 7FF801H ABH 7FF802H C5H 7FF803H D4H 7FF804H 7EH 7FF805H 80H Example 2 Mritebuffer 7 FF800 12 AB C5 D4 7E 80 FF0000 AB CD EF 43 21 sequen Feceam nearer Writes two blocks of data to buffer The first block of data 6 Bytes 12H ABH C5H D4H 7EH 80H are written 43 Remote control of PG4UW user s manual to buffer at address 7FF800H in the same way as in Example 1 The second block of data 5 Bytes ABH CDH EFH 43H 21H are written to buffer at address FFOOOOH The addressing looks like following the first Byte at the lowest address Buffer Address Data FF0000H ABH FF0001H CDH FF0002H EFH FF0003H 43H F
62. ntrol program in table Addresses The checksum means sum of current data in main buffer of Pg4uw by following rules e the checksum is calculated by summing the contents of buffer data from address Buffer Start to address Buffer End Buffer Start and Buffer End addresses are displayed in table Adresses in the main program window of Pg4uw e the checksum value is displayed in 32 bit hexadecimal number format e any carry bits exceeding 32 bits are neglected e buffer data are summed byte by byte irrespective of current buffer view mode x8 x16 x1 organisation 22 Remote control of PG4UW user s manual 2 3 Constants used by remote control communication Following constants define command codes and status codes used by remote communication in the direction Client gt Server These constants can be tested by Server application in receive message Event handle procedure by which Server can recognize which commands Client sent to Server For practical use of the constants see the example Server application Pascal source code Constants are defined in unit RemoteConst pas commands Client gt Server TCP_KEYWORD_OPTYPE optype TCP_KEYWORD_OPBUSY opbusy TCP_KEYWORD_PROGRESS progress TCP_KEYWORD_OPRESULT opresult codes for operation results TCP_CMD_OPRESULT opresult TCP_KEYWORD_OPRESULT_GOOD oprGood TCP_KEYWORD_OPRESULT_FAIL oprFail TCP_KEYWORD_OPRESULT_HWERR oprHWEr
63. ocedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Example Server request SEND_CMD_LoadProject_CINDEX 1 C test eprj Answer from client client send project load result codes for Load file project result TCP_CMD_LOAD_FILE_PRJ_RESULT loadresult TCP_FILE_LOAD_GOOD frgood TCP_FILE_LOAD_ERROR frerror Hanswer will be in followed form TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_GOOD or TCP_CMD_LOAD_FILE_PRJ_RESULT TCP_FILE_LOAD_ERROR procedure SEND_CMD_GetProjectFileChecksum_CINDEX index integer prjname PChar stdcall Procedure is used to send message getprojectfilechecksum to Client with index specified by parameter index When Client receives the message it tries to compute CRC 32 of project file specified by parameter prjname The Client sends result to Server The result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients procedure SEND_CMD_LoadFile_CINDEX index integer fname PChar stdcall Procedure is used to send message loadfile to Client with index specified by parameter index When Client receives the message it tries to load file specified by parameter fname The Client sends load file result to Server The result command received from client can be processed by Server application in proc
64. ommands is empty or FIFO does not exist This function is especially useful when user does not use callback functions in server remote control application In such case the commands received from Pg4uw Client can be read by using function GetCommandStringFromFIFO_CINDEX More details about using the function can be seen in remote control examples Notes 1 The function is active only when callback procedure pointer specified by parameter vProcessProc in remote control initialization procedure CreateServerAndMakeListenToMultiClients is nil If there is specified callback procedure vProcessProc lt gt nil the function GetCommandStringFromFIFO is not usable and it will always return value nil 2 The FIFO buffer has size 128 items It means it can store maximally of 128 commands received from Client Pg4uw So it is recommended to call function GetCommandStringFromFIFO_CINDEX periodically to pop commands from FIFO and prevent FIFO buffer from getting full If the number of commands received is greater than capacity of FIFO memory the newly coming commands are ignored Of course the Client does not send commands or information to Server application without requiring them from Server So reading commands from FIFO has sense in cases the Server sends commands to Client 3 Commands received by function GetCommandStringFromFIFO are in form of null terminated strings The type of null terminated string is known as PChar in Pascal la
65. osophy is remote application that controls PG4UW acts as Server PG4UW acts as Client 2 the communication between PG4UW and remote Server is realized by set of commands available in DLL library remotelb dll 3 communication is asynchronous and it uses events to handle received messages from PG4UW 4 the order of starting PG4UW and Server application is not important but better way is to start the Server application as the first and PG4UW Client the second 5 communication between PG4UW and remote control program is made via TCP protocol this allows the PG4UW to be installed on one computer and remote control application to be installed on another computer and these computers will be connected together via network 6 remote control library remotelb dll is written in Borland Delphi Pascal and is usable by Borland Delphi Pascal many C C environments and also environments with other programming languages for example Microsoft Visual Basic 6 Default TCP communication settings for remote control are Port telnet Address 127 0 0 1 or localhost Address setting applies for PG4UW Client only Port setting applies for PG4UW Client and also for Server application Default settings allows to use remote control on one computer address localhost PG4UW Client and remote control Server have to be installed on the same computer Note If firewall is installed on system firewall can display warning message when remote control Server o
66. owing procedures 1 loads data file_c 15001 25001 file_10 bin 2 saves the currently selected device settings and buffer data to project file c projects project_10 eprj 45 Remote control of PG4UW user s manual If the result of operations performed is OK Pg4uwcmd application will return ExitCode or ErrorLevel value 0 If there are some errors can not load file or save to project file Pg4uwcmd application will return ExitCode value equal or greater than 1 Note When using the above commands user must be sure the Pg4uw is not performing any device operation for example device programming If the Pg4uw is busy it will refuse the commands and returns error status ExitCode equal or greater than value 1 46 Remote control of PG4UW user s manual 7 Remote control of Pg4uw applications running on different computer s Remote control can be used to control Pg4uw applications running on the same computer localhost and also Pg4uw applications running on remote computer that is connected to server computer by network Server computer is computer on which remote control program is running Following specials must be taken to consideration for Pg4uw aplications running on remote computer 1 2 Sites Pg4uw applications can not be started directly from remote control program server They can be started manually on the computer where they are installed Address of server computer must be specified by command
67. parameter buffindex which is used to specify buffer to be used for writing data Parameters used are buffindex specifies the order of buffer where data will sent the main buffer has index 1 The first secondary buffer has index 2 etc Please note the secondary buffer s is are available for some kinds of devices only e g Microchip PIC16F628 The kind of buffer indexed by parameter buffindex depends on order of buffer in application Pg4uw in dialog View Edit buffer For example device Microchip PIC16F628 has additional buffer with label Data EEPROM This buffer can be accessed for data write s by this function when buffindex 2 is specified bufaddr buffer address in Pg4uw where data have to be written bufptr pointer to memory block of data which have to be sent to Pg4uw bufsize number of bytes which have to be sent to Pg4uw valid values are from 1 to 256 bytes timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND _CMD_WBUFFER_EX will return error code If TimeOut is 0 function SEND_CMD_WBUFFER_EX will wait for client response until client is responding for max time 3 seconds Return values are 20 Remote control of PG4UW user s manual 0 OK data was sent successfuly 1 address parameter bufaddr is out of range 2 sent buffer data size parameter bu
68. ples are available in the subdirectory remotectrl programs placed in the directory where Pg4uw control program is installed The typical path to remote control examples looks like this c Program Files Manufacturer_sw Programmer remotectri programs The Start Menu link to the examples is created also during installation of Pg4uw if the Create Start Menu shortcut option is checked during installation Remote control examples are in the form of source files written in Pascal and C languages Source files are placed in the following subdirectories 4 1 Source files written in Borland Delphi Pascal Pg4uwcmd demonstration of remote control usage from Windows console application and command line Pg4uwrem remote control usage from remote Windows GUI application demonstrates basic remote control commands RemoDemo remote control usage from remote Windows application demonstrates implementation of Handler operator for automation of device programming MultiDemo demonstration of multiprogramming remote control more Pg4uw applications more programmers running on one computer at the same time 4 2 Source files written C suitable for Borland C Builder and Microsoft Visual C Pg4uwcmd vc demonstration of remote control usage from Windows console application and command line RemoDemo bc remote control usage from remote Windows application demonstrates implementation of Handler operator for automation of device prog
69. plication has no TApplication object Forms unit not referenced at all 2 2 Procedures used for sending basic types of commands from remote Server to PG4UW Client procedure SEND_CMD_BringToFront stdcall Procedure is used to send message bringtofront to Client When Client receives the message it tries to make BringToFront operation BringToFront operation is basically activation of Client application window Example Server request SEND_CMD_BringToFront Answer from client client send no answer procedure SEND_CMD_ShowMainForm stdcall Procedure is used to send message showmainform to Client When Client receives the message it makes Show command for main window of the Client application The message does nothing if the main window of Client application is already visible Please use this command only in situations when no operation is currently running in the Client application Example Server request SEND_CMD_ShowMainForm Answer from client client send no answer procedure SEND_CMD_HideMainForm stdcall Procedure is used to send message hidemainform to Client When Client receives the message it makes Hide command for main window of the Client application Also Client s icon placed on taskbar will be hidden and small icon appears on the tray panel The message does nothing if the main window of Client application is already hidden Please use this command only in situations when no operation
70. pplications clients To pick the information received from Pg4uw clients function GetCommandStringFromFIFO_CINDEX index must be called for each connected client Pg4uw in remote control program Program Multidemo uses procedure ProcessProcByFIFO index to receive and process received information from Pg4uw client with index index Procedure ProcessProcByFIFO index uses following functions function GetCommandStringFromFIFO_CINDEX index to receive info from Pg4uw procedure intServerProcessProc received_cmd is used to decode received information string and process decoded information 49 Remote control of PG4UW user s manual 6 To ensure all received information to be proceed ProcessProcByFIFO index is called periodically in timer OnTimer event Recommended interval of timer tick event is 100 1000ms Calling of both important routines is made in timer event In the first timer tick SEND_CMD_GetProgStatus_CINDEX index is called for all connected Pg4uw In the second timer tick received information is proceed by ProcessProcByFIFO index for all connected Pg4uw And this sequence is repeated periodically 50 Remote control of PG4UW user s manual 8 System requirements 8 1 System requirements for remote control program Minimum PC system requirements for remote control application Microsoft Windows 98 2000 XP or later PC Pentium 233 32 MB of RAM 10 MB of free disk space Recommended
71. r Client is starting When firewall is showing warning with question asking to allow or deny network access for remote Server or Client please select Allow option otherwise remote control will not work Of course you can specify in firewall options more strict rights to allow remote Server Client access on specified address and port only Remote control of PG4UW user s manual 2 Published functions in library remotelb dll Following description presents purpose of each function For more particular description of function declarations and parameters please see the file RemoteCtrl pas If the remote Server application is written in C language there is necessary to write appropriate header h file to make functions from library remotelb dll available in C C project The Pascal unit file RemoteCtrl pas shows function declarations and parameters This can be used for writing C C header file 2 1 General functions for Client Server remote control connection establishing and connection parameters setting To see the usage of following functions and procedures see the example application PG4UWrem especially Pascal unit remoteform pas procedure CreateClientandMakeConnectionToServer vProcessProc TProcWithPChar vWriteToLogProc TProcWithPChar vPort vAddr PChar stdcall Procedure creates Client communication object with defined parameters and tries to connect to Server This procedure is used internally in PG4UW Client applicatio
72. ramming sources written for Borland C Builder only because forms are used here 4 3 Source files written in Microsoft Visual Basic 6 Pg4uwcmd VB amp demonstration of remote control usage from Windows console application and command line RemoDemo VB6 remote control usage from remote Windows application demonstrates implementation of Handler operator for automation of device programming 4 4 Source files written in Microsoft Visual Basic 2002 2003 2005 NET Pg4uwcemd VB NET demonstration of remote control usage from Windows console application and command line RemoDemo VB NET remote control usage from remote Windows application demonstrates implementation of Handler operator for automation of device programming MultiDemo VB NET demonstration of multiprogramming remote control more Pg4uw applications more programmers running on one computer at the same time 25 Remote control of PG4UW user s manual Information In the beginning of 2007 Borland tm company released free version of their well known Delphi programming environment under name Turbo Delphi It can be downloaded from http www borland com web site Free registration on Borland site is also required for download Turbo Delphi Our remote control examples for Delphi Pascal are fully compatible with the Borland Turbo Delphi 26 Remote control of PG4UW user s manual 5 Using remote control with multiply programmers multiprogramming Library re
73. reText CMDline TCP_CMD_PROG_IS_BUSY 0 then Process_CMD_PROG_IS_BUSY etc processing of other commands procedure ServerProcessProc CMDline PChar stdcall This procedure is used like callback procedure it handles one or more lines of messages from client by sequential calls of intServerProcessProc Each line of string represents one message More lines in string mean more commands const var begin CRLF 13 10 tmpline tmpstr ansistring q integer tmpline CMDline more commands can be cumulated into one packet each command is at one line repeat q Pos CRLF tmpline if q gt 0 then begin tmpstr copy tmpline 1 q 1 delete tmpline 1 q length CRLF 1 end else tmpstr tmpline if tmpstr lt gt then intServerProcessProc tmpstr until q 0 end procedure CreateServerAndMakeListenToClients ServerProcessProc CallbackProcPtr nil Write ToLogwindowProc nil onClientConnectProc nil onClientdisconnectProc PChar remote_ctrl_settings Client_Server_Port Remote control of PG4UW user s manual Code example non callback method procedure intServerProcessProc CMDline ansistring procedure handles one line of message from client var tmpstr string index q integer begin CMDline trim CMDline now try to obtain client index from CMDline not used in single programming mode if pos TCP_KEYWORD_CINDEX LowerCase CMDline 1 then
74. rogram PG4UWcmd exe must be located in the same directory as program PG4UW exe if PG4UW exe is not running when PG4UWcmd exe is called it will be automatically started command line parameters are not case sensitive command line parameters can be used when first starting of program or when program is already running if program is already running then any of command line operation is processed only when program was not busy no operation was currently executing in program Program must be in basic state i e main program window focused no modal dialogs displayed no menu commands opened or executed order of processing command line parameters when using more parameters together is defined firmly as following step1 Load project Prj step2 Load file Loadfile step3 EPROM FLASH autoselect 44 Remote control of PG4UW user s manual step4 Program device Program switch step5 Close of control program Close only together with parameter Program Examples Example 1 PG4UWcmd exe program noanyquest loadfile c empfile hex Following operations will perform start PG4UW exe if not already running load file c empfile hex start program device operation without questions PG4UWcmd exe is still running and periodically checking status of PG64UW exe when device programming completes PG4UWcmd exe is closed and is returning ExitCode depending on load file and device programming results in PG4UW exe When all oper
75. ror TCP_KEYWORD_OPRESULT_NONE oprNone codes for Load file project result TCP_CMD_LOAD_FILE_PRJ_RESULT loadresult TCP_FILE_LOAD_GOOD frgood TCP_FILE_LOAD_ERROR frerror TCP_FILE_LOAD_CANCELLED frcancelled codes for Select device result TCP_CMD_SELECT DEVICE RESULT selectdeviceresult TCP_SELECT_DEVICE_GOOD good TCP_SELECT_DEVICE_ERROR error I codes for Auto Select of EPROM FLASH device TCP_CMD_AUTSEL_EPRFLSH_RESULT autoseldeviceresult not used yet codes for server to client ready question TCP_CMD_CLIENT_READY_ANSWER clienprogramisreadyanswer TCP_KEY_CLIENT_READY_YES isready TCP_KEY_CLIENT_READY_NO isnotready codes for command line params result TCP_CMD_PROCESS CMDL_RESULT cmdlineparamsresult TCP_CMD_PROCESS_CMDL_GOOD good TCP_CMD_PROCESS_CMDL_ERROR error 23 Remote control of PG4UW user s manual 3 Short example of remote control implementation There are two basic ways how to use remote control synchronous mode asynchronous mode 3 1 Synchronous mode In synchronous mode when Server is sending any command to Client Server will wait in cycle for Client response The Server jumps inside cycle until 1 Server receives wished message from Client or 2 Server receives user break request 3 2 Asynchronous mode In asynchronous mode when Server is sending any command to Client Server will not wait i
76. s in Pg4uw where data have to be written bufptr pointer to memory block of data which have to be sent to Pg4uw bufsize number of bytes which have to be sent to Pg4uw valid values are from 1 to 256 bytes timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND_CMD_WBUFFER_CINDEX will return error code If TimeOut is 0 function SEND_CMD_WBUFFER_CINDEX will wait for client response until client is responding for max time 3 seconds Return values are 0 OK data was sent successfuly 1 address parameter bufadadr is out of range 2 sent buffer data size parameter bufsize is out of range 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 unknown error function SEND_CMD_RBUFFER_CINDEX index integer bufaddr longint bufptr pointer bufsize integer timeout integer integer stdcall Function is used to read specified region of main device buffer from Pg4uw remote client to memory region specified by pointer parameter bufptr Parameters used are index index of Client programmer Site bufaddr buffer start address in Pg4uw data are read from this address bufptr pointer to memory block where data has to be copied bufsize number of bytes which have to be read from Pg4uw buffer valid values are from 1 to 256 bytes
77. sed program Pg4uw does not display dialog Repeat after device operation is complete It means the Pg4uw closes Info window displayed during device operation and stay in main Pg4uw window focused when the option is used program Pg4uw makes Repeat dialog remaining display after device operation is complete This allows to see the device operation result in Info window and also in remote control application To close Repeat dialog from remote control command SEND_CMD_Stop can be used When just repeating of device operation is needed there can be send remote command of current device operation No SEND_CMD_Stop command is needed 41 Remote control of PG4UW user s manual Tip If you wish to start Pg4uw application in visible state not hidden even if parameter enableremote autoanswer is used use also additional command line parameter startvisible 6 2 Executive command line parameters PG4UW accept set of commands from the command line command line parameters The remote control can be achieved also by this command line parameters but more efficient way is to use special tool PG4UWcmd exe which has many advantages The main advantage is size of the PG4UWcmd which result the calling of PG4UWecmd results a much faster response than calling of PG4UW directly Program PG4UWcmd exe can be used to 1 start PG4UW application with specified command line parameters 2 force command line parameters to PG4UW that is already running
78. size integer timeout integer integer stdcall Function is used to read specified region of main device buffer from Pg4uw remote client to memory region specified by pointer parameter bufptr Parameters used are bufadadr buffer start address in Pg4uw data are read from this address bufptr pointer to memory block where data has to be copied bufsize number of bytes which have to be read from Pg4uw buffer valid values are from 1 to 256 bytes timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND CMD _RBUFFER will return error code If TimeOut is 0 function SEND_CMD_RBUFFER will wait for client response until client is responding for max time 3 seconds Return values are 0 OK data was sent successfully 1 address parameter bufaddr is out of range 2 sent buffer data size parameter bufsize is out of range 3 timeout occurred client is not responding 4 TCP communication object does not exist or not connected 5 unknown error function SEND_CMD_WBUFFER_EX buffindex integer bufaddr longint bufptr pointer bufsize integer timeout integer integer stdcall Function is used to write specified block of data to main device buffer of remote client Pg4uw program The function is very similar to function SEND _CMD_WBUFFER The only difference is one more
79. tDevice devmanuf devname PChar stdcall Procedure is used to send message selectdevice to Client When Client receives the message it tries to select specified device Device is specified by parameters devmanuf and devname Parameters are not case sensitive The Client sends select device result to Server The result command received from client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Example To select device Intel TE28F160C3B TSOP48 call Server request SEND_CMD_SelectDevice Intel TE28F160C3B TSOP48 Answer from client client send operation result codes for operations result TCP_CMD_SELECT_DEVICE_RESULT selectdeviceresult 14 Remote control of PG4UW user s manual TCP_SELECT_DEVICE_GOOD good TCP_SELECT_DEVICE_ERROR error answer will be in followed form TCP_CMD_SELECT_DEVICE_RESULT TCP_SELECT_DEVICE_GOOD or TCP_CMD_SELECT_DEVICE_RESULT TCP_SELECT_DEVICE_ERROR procedure SEND_CMD_EPROMFLASH_AutoSelect pinsnumber PChar stdcall Procedure is used to send message autoseldevice to Client When Client receives the message it starts autoselect device operation Parameter pinsnumber can be used to specify the pin number of device which helps more reliable detection of device type If parameter pinsnumber is blank Pchar autoselect operation tries to detect ins
80. te ToLogwindowProc nil onClientConnectProc nil onClientdisconnectProc PChar remote_ctrl_settings Client_Server_Port procedure MakeClientConnectionToServer FailedErrDisplay boolean stdcall Procedure tries to connect Client to Server The procedure is used internally in PG4UW Client application Server application should not use this procedure Remote control of PG4UW user s manual procedure MakeClientDisconnectionFromServer stdcall Procedure tries to disconnect Client from Server The procedure is used internally in PG4UW Client application Server application should not use this procedure procedure MakeClientServertCloseConnectionAndFree stdcall Procedure is used for Client and Server applications to close connection and free TCP Client Server communication object The Client and Server applications call this routine automatically when they closed procedure SendOperationResultToServer op_result TOpResultForRemote stdcall Procedure is used by Client applications for sending messages to Server Server application should not use this procedure procedure SendLineToServer line PChar stdcall Procedure is used by Client applications for sending messages to Server Server application should not use this procedure function ClientServerObjectExists boolean stdcall Function returns true if Client Server object already exists otherwise returns false Function does not test connection status function Cl
81. te control functions GetCommandStringFromFIFO and GetCommandStringFromFIFO_CINDEX added new information about callback procedure parameters especially parameter vProcessProc used in procedures CreateServerAndMakeListenToClients and CreateServerAndMakeListenToMultiClients Ver 1 16 December 6th 2006 added information about new command line parameter close always changed execution order of command line parameters prj and loadfile 53 Remote control of PG4UW user s manual Prj command is executed before loadfile command Ver 1 15 November 16th 2006 added information about new command line parameter saveproject Ver 1 14 October 18th 2006 added information about new remote control examples written in Microsoft Visual Basic 6 Ver 1 13 September 29th 2006 added additional information about Eprom_Flash_Autoselect command line parameter Ver 1 12 August 24th 2006 added information about new multiprogramming remote control example sources MultiDemo added description of new remote command function SEND_CMD_GetProgrammerConnectedStatus Ver 1 11 July 12th 2006 added description of new remote command function SEND_CMD_GetDev_Checksum Ver 1 10 June 5th 2006 added new chapter about Using remote control with multiply programmers multiprogramming Ver 1 09 April 10th 2006 modified Recommended PC system requirements to more powerful confi
82. ure SEND_CMD_Quest_is_Client_Ready_CINDEX index integer stdcall Procedure sends question to Client if the Client is Ready Client sends ready yes no status message to Server The ready status command received from Client can be processed by Server application in procedure defined by pointer parameter vProcessProc in procedure CreateServerAndMakeListenToClients Client is ready when no device operation is currently running and main Client s window is not hidden by any modal dialogs in Client Example 37 Remote control of PG4UW user s manual Request from server SEND_CMD_Quest_is_Client_Ready_CINDEX 1 Answer from client codes for server to client ready question TCP_CMD_CLIENT_READY_ANSWER clienprogramisreadyanswer TCP_KEY_CLIENT_READY_YES isready TCP_KEY_CLIENT_READY_NO_ isnotready answer will be in followed form TCP_CMD_CLIENT_READY_ANSWER TCP_KEY_CLIENT_READY_YES or TCP_CMD_CLIENT_READY_ANSWER TCP_KEY_CLIENT_READY_NO function SEND_CMD_GetProgrammerConnectedStatus_CINDEX index integer stdcall Function is suitable to detect if the programmer Site with index index is successfully connected and present in Pg4uw application associated with the Site Function sends command get programmer connection status to client Pg4uw application and waits for client response timeout is 3 seconds Function has no parameters Return values are True OK programmers is suc
83. ve Command line PAVAMETHELS ccccccececceseeene ete e tee eeeeteaeceeeceseeeaeeseseenseeennaaeeees 4 6 3Return values of PF GAO W CW CXC isto a eh Ui ee pis EDR las TORR aA a ve e ERTLN 42 6 4Basic rules for using of executive command line PATAMECHELS ccccccceceeeeeeetteeeeeteeees 44 7 Remote control of Pg4uw applications running on different computer s ceeeeeeneees 46 7 1Sequence of steps is recommended when starting multiprogramming system 48 7 2Basic description of Multidemo application c cccccccccccccccecsctecseeeeeteeeeeeteseeesesenseseeeeaes 48 amp SV Stem requirements cot sas sche xeasavd dar ehazsaseasescaitens A EE S seus EE AEE AAE EEES aS 50 8 amp 1System requirements for remote control PYOQTAML cccccccceceeeeteseteneeteseeeneeenseeneeensees 50 8 2System requirements for application PG4UW when using remote control function 50 id Common FRG UIFENICNIS onneen a A pus N EE AE A E N id eich vata 50 9 Version history of this documentation s se sesessesseseeesseseesssesresetssresessesstesressesseesresseesressee 52 Remote control of PG4UW user s manual 1 Basic facts about remote control Remote control of PG4UW control program allows to control some functions of PG4UW application by other application This is very suitable feature for integrating programmer to mass production handler system or other useful application Remote control main features are 1 Remote control phil
84. y e g Microchip PIC16F628 The kind of buffer indexed by parameter buffindex depends on order of buffer in application Pg4uw in dialog View Edit buffer For example device Microchip PIC16F628 has additional buffer with label Data EEPROM This buffer can be accessed for data write s by this function when buffindex 2 is specified bufaddr buffer address in Pg4uw where data have to be written bufptr pointer to memory block of data which have to be sent to Pg4uw bufsize number of bytes which have to be sent to Pg4uw valid values are from 1 to 256 bytes timeout the timeout parameter specifies the amount of time in milliseconds to wait for a response from the remote client If client is not answering during the time specified by timeout function SEND_CMD_WBUFFER_EX_CINDEX will return error code If TimeOut is 0 function SEND_CMD_WBUFFER_EX_CINDEX will wait for client response until client is responding for max time 3 seconds Return values are 0 OK data was sent successfuly 1 address parameter bufaddr is out of range 2 sent buffer data size parameter bufsize is out of range 3 timeout occured client is not responding 4 TCP communication object does not exist or not connected 5 unknown error function SEND_CMD_RBUFFER_EX_CINDEX index integer buffindex integer bufaddr longint bufptr pointer bufsize integer timeout integer integer stdcall Function is used to read specified region of main device
Download Pdf Manuals
Related Search
Related Contents
Cobra Electronics MICROTALK CXR925C User's Manual Kenwood DDX7036BT GPS Receiver User Manual Mobility mode d`emploi 長期優良住宅先導的モデル事業 ・・ 賃貸住宅補修履歴データベース構築 Istruzioni per l`uso MASTERtorque LUX M9000 L - 1.008 Bestron ACM800Z coffee maker Manual del usuario - tienda.www.telematiconline.net Manuel de l`utilisateur HP ZR2240W User's Manual Installation Manual - Astal Security Technologies Copyright © All rights reserved.
Failed to retrieve file