Home

PTQ ADM Dev Guide - ProSoft Technology

image

Contents

1. ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access or user pressed Esc to exit program Example ADMHANDLE adm handle ADM INTERFACE interface ptr ADM INTERFACE interface interface ptr amp interface ADM ProcessDebug adm handle interface ptr Page 102 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DAwWriteSendCtl Syntax int ADM DAWriteSendCtl ADMHANDLE adm handle ADM INTERFACE adm interface ptr int app port int marker Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure which contains structure pointers needed by the function app port Application serial port referenced marker Flow control symbol to output to the data analyzer screen Description This function may be used to send a transmit flow control symbol to the data analyzer screen The control symbol will appear between two angle brackets R lt R gt CS adm handle must be a valid handle returned from ADM Open Valid values for marker are RTSOFF lt R gt RTSON lt R gt CTSRCV lt CS gt Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS adm handle does not have access MVI ERR B
2. eseeeeenem en 154 ADM GetVersionlNi O aieiaa a ae e aa AREE a E A a aa A E ETERA 154 ADM SetGonsolePOtt e aea a ie to ai a aa TE aa ET RYE ee E ds 155 ADM SetConsoleSpeed c ccceccceceeeceeeeeeeeeeeceeeeeceaeeeeaaeseeneeseeeeeeeaeseeaaesganeeseaeeeeaesseaaeeseneesaas 156 9 9 ADM APERAM FULCLUORS e txcecsc tiit ot Ph ERES ERE aoc ER vovee degen CREAR AAE xk TH nied 157 ADM MET BU TER III TO TIT LTLTEMM 157 ADM BRAM Getlnt 5 1t e EINER an ut cea bisa evece NIEE OON Don OI auc FOR edes 158 ADM RAM Gol Ong m 159 ProSoft Technology Inc Page 7 of 239 February 20 2013 Contents PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM RAM GetFloat eet o etit ear etie E sab a a 160 ADM RAM GetDouble ccccccccccessesecesececsessaaeceeeeececeeseasececeeseeesesaeaeceeeeseseseaaeaeseseeeesersnaees 161 ADM_RAM_ Geet a E EEE EE A 162 ADM Get BP Data Exchange ssssssssssessees eene nennen nnne nent erret rnnt enne 163 10 Backplane API Functions 165 10 1 Backplane API Initialization Functions 167 MVIbp Ope ietecist sets a n IA DLL LA LA DL ELM case ue 167 MV IDB ClOS6 2272 sect cct tiers elio eL eA LLL eee cet db 168 10 2 Backplane API Configuration Functions sees 169 MV lbp GetlO Gonflg 2 1 nite iden aid adan Dee epos gine dr eee Dee Lie aiaiai adak 169 MV lbp SetlOContig s
3. ProSoft Technology Inc Page 41 of 239 February 20 2013 Configuring the Processor with Unity Pro PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 3 If the MEDIA dropdown list does not contain the connection method you wish to use click the COMMUNICATION PARAMETERS button in the PLC area of the dialog box This action opens the PLC Communication Parameters dialog box PLC Communication Parameters Request failure recovery Number of tries E EX Timeout ms 3000 fiz g Driver Settings Cancel Help 4 Click the DRIVER SETTINGS button to open the SCHNEIDER Drivers management Properties dialog box SCHNEIDER Drivers management Properties MODBUS SERIAL Driver MODBUS Tet XWAYTes DRIVERS Manager PLC USB Driver SETUP Drivers Manager V2 1 IE14 Drivers System info 2 installed drivers Windows NT V5 1 Build 2600 MODBUS m Extended info Service Pack 3 Winsock V2 2 Install update DLLs XWAY V6 1 23 5 Uninstall this driver Net amp ccess V1 0 8 14 OK 5 Click the INSTALL UPDATE button to specify the location of the Setup exe file containing the drivers to use You will need your Unity Pro installation disks for this step Driver installation update Insert the driver installation disk in the selected device then click OK Cancel A Nsetup exe Browse Browse Install the driver from 6 Click
4. 400003 i 400004 17 i 400005 3 i 400006 15 i 400007 2 i 400008 49 L 400009 i 400010 0 400020 24576 i 400021 5 l 400022 7 12 Verify that values shown are cycling starting from address 400065 and up 13 In the PLC Configuration window open the TEMPLATES menu and then choose SAVE TEMPLATE AS Name the template ptqclock and then click OK to save the template 14 In the PLC Configuration window open the ONLINE menu and then choose DISCONNECT At the disconnect message click YES to confirm your choice At this point you have successfully Created and downloaded a Quantum project to the PLC Preset values in data registers that will later be monitored in the ProTalk module You are now ready to complete the installation and setup of the ProTalk module ProSoft Technology Inc Page 29 of 239 February 20 2013 Configuring the Processor with Concept PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 30 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with ProWORX C Programmable Network Interface Module for Quantum Developer Guide 3 Configuring the Processor with ProWORX When you use ProWORX 32 software to configure the processor use the example SAF file provided on the ProTalk Solutions CD ROM Important Note ProWORX software does not report whether the PTQ modul
5. 6 Click ALL and then click DOWNLOAD If a message box appears indicating that the controller is running click YES to shut down the controller The Download Controller dialog box displays the status of the download as shown in the following illustration Download Controller 1 x v Gonfiguratior F TEC program sections No Up nformation 984 ladder logic All Downloading extended memory files Registers 6x 3360 of 98303 TN 7 When the download is complete you will be prompted to restart the controller Click YES to restart the controller Page 26 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Configuring the Processor with Concept Developer Guide 2 5 Verify Successful Download The final step is to verify that the c onfiguration changes you made were received successfully by the module and to make some adjustments to your settings 1 In the PLC Configuration window open the ONLINE menu and then choose ONLINE CONTROL PANEL This action opens the Online Control Panel dialog box Online Control Panel Controller Executive ID is 883 Version 0120 IEC 0260 Stop controller Clear controller x Time of Day clock clock not set m Constant sweep settings Invoke constant sweep register for target scan time target scan time ms Invoke singl
6. Project Browser Tg Structural view QY Station B amp q Configuration Bog 1 Local Bus E Oy 1 Local Quantu mou 1 40 xBF m Derived Data Types m Derived FB Types Fly Variables amp FB instant Gy Elementary Variables j f 9 Derived variables Gy I0 Derived Variables 3 SS 7 R Cancel Hardware catalog x I Description ISI Help Local Quantum Drop HL I Local Quantum Drop Local Quantum Drop Analog E Analog Communication El Communication _ Se E Counting MOCRP 93X00 RIO HEAD 908 E Discrete 140 EIA 921 00 AS4 1 CHANNEL E Expert 140 NOE 311 00 QUANTUM SY MAX ETHERNET MODULE E Motion 140 NOE 351 00 QUANTUM SY MAX ETHERNET MODULE 140 NOE 77100 ETHERNET TCP IP BASIC WEB SERVER MI T i J Local Bus RIO Bus 140 NOE 77101 ETHERNET TCP IP BASIC WEB SERVER 140 NOE 771 10 ETHERNET TCP IP CONFIGURABLE WEB 140 NOE 771 11 ETHERNET TCP IP CONFIGURABLE WEB 140 NOM 2XX 00 MN1 MB 140 NWM 100 00 FACTORYCAST HMI WEB SERVER MODULE 140 XBE 100 00 EXPANDER NOM type generic module ProfiBus DP DPV1 Master Module Page 38 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Unity Pro C Programmable Network Interface Module for Quantum Developer Guide 2 Next enter the module personality value The correct value f
7. sse enne nennen nens 61 7 5 1 HardWale c uit nt ERIBRRR T ae ERRERRREYURE RS EAREERSEETRERE S sS FREKRRE S 61 7 5 2 SO TtWaIGzuii deii E EINER 62 8 Setting Up Your Development Environment 63 8 1 Setting Up Your Compiler sssssseeee eee 64 1 1 Configuring Digital Mars C 8 49 sssssssssssesseseneeeen nene nne 64 2 Configuring Borland C4 5 02 ssssssssssssssseeeeeneeeen nennen nennen 74 8 2 Creating a ROM Disk Image sssssssssseeee ener enne nns 82 8 2 1 WINIMAGE Windows Disk Image Builder seeene 82 8 3 Downloading a ROM Disk Image seen 84 8 3 1 MAII dg 84 8 4 PTQ System BIOS Setup 5 eere wee eid eene ee dara ke er a nnda 85 8 5 Transferring Files to and from the Module with HyperTerminal 87 8 5 1 Required Hardware dere ae ede te dera i AN ne dcs 87 8 5 2 Required Software rode rice ie cee cr eve eee a Y aed vae ety baee 87 8 5 3 Connecting to the Module sssssssssssesee eene enne nns 88 8 5 4 Enabling the Console isnin eee Eee dede da Ya edad aiii 89 8 5 5 Installing RY exe and SY exe sess 93 8 5 6 Downloading Files From a PC to the ADM Module sse 94 8 5 7 Uploading files from the ADM module to a PC 95 8 6 Debugging Strategies seesseessessissssesee estne nennen nnn tnn nnne nnne 95 9 Application
8. Page 230 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Support Service amp Warranty C Programmable Network Interface Module for Quantum Developer Guide Internet Web Site www prosoft technology com support E mail address support prosoft technology com Asia Pacific Tel 603 7724 2080 E mail asiaoc prosoft technology com location in Malaysia Languages spoken include Chinese English Asia Pacific Tel 86 21 5187 7337 x888 E mail asiapc prosoft technology com location in China Languages spoken include Chinese English Europe Tel 33 0 5 34 36 87 20 location in Toulouse E mail support EMEA prosoft technology com France Languages spoken include French English Europe Tel 971 4 214 6911 location in Dubai UAE E mail mea prosoft technology com Languages spoken include English Hindi North America Tel 1 661 716 5100 location in California E mail support prosoft technology com Languages spoken include English Spanish Latin America Tel 1 281 2989109 Oficina Regional E Mail latinam prosoft technology com Languages spoken include Spanish English Latin America Tel 52 222 3 99 6565 location in Puebla Mexico E mail soporte prosoft technology com Languages spoken include Spanish Brasil Tel 55 11 5083 3776 location in Sao Paulo E mail brasil prosoft technology com Languages spoken include Portuguese English 14 2 Warra
9. See Also ADM SetBtStatus page 152 ProSoft Technology Inc Page 151 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM SetBtStatus Syntax int ADM SetBtStatus ADMHANDLE adm handle ADM INTERFACE adm interface ptr int pass cnt Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to E structures pass cnt Counter from user code to indicate module health This counter 7 could be updated in the main loop of the program Description This function writes status data to the processor at word 202 in the input image and to the database at location 6670 The data is written in the following order pass_cnt in the ADM_INTERFACE structure ADM_PRODUCT structure ADM_PORT_ERRORS structure 1 time for each application port ADM_BLK_ERRORS structure CurErr port 1 from ADM_PORT structure LastErr port 1 from ADM_PORT structure CurErr port 2 from ADM_PORT structure LastErr port 2 from ADM_PORT structure Return Value ADM_SUCCESS The function has completed successfully ADM_ERR_NOACCESS adm_handle does not have access ADM_ERR_NOTSUPPORTED This function is not supported on this platform Example ADMHANDLE adm_handle ADM INTERFACE interfa
10. 5 1 Install the ProTalk Module in the Quantum Rack 46 5 1 1 Verify Jumper Settings sssssssssssseseeseeeene entente enses 46 5 1 2 Inserting the 1454 9F connector ssesssessseeeneeeeeen nennen nnns 46 5 1 3 Install the ProTalk Module in the Quantum Rack ssseseeee 47 5 1 4 Cable Connection Ssi ep Y ac cte ah la e EROR E eode Yee de aru e rcp dta 48 6 Introduction to PTQ ADM 53 6 1 Operating Systelm ou cip een ced ecd eite ade ce Eee Gen eel eee 54 ProSoft Technology Inc Page 5 of 239 February 20 2013 Contents PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 7 Understanding the PTQ ADM API 55 7 1 AP ibraties 5 Ro RERO EROR UD RE 56 7 1 1 Calling Convention sesssssssssssssseen enne enne nennen 56 7 1 2 HeaderFile iiber ip ace ace bet testes Ir acere date bots 56 7 1 3 Multithreading Considerations ssssssseeeeseeeeeenen nennen 56 7 2 Development Tools pairo pirea i aean aAA a AKA EE a a EAR AE 57 7 3 Theory of Operation ener nnne enses treni 58 7 3 1 BADM ADPI iiie teo teet etaed ha ace ate pendet e epum fone ee tato bete a 58 7 3 2 ADM API ArchitectUre sec 12 1 iei tre topic Pee EE eher ne B PERRA ER dien 58 7 3 3 PTQ Big I O Backplane Model Theory of Operation sssssssss 58 7 4 BLiCLLIMA ELE 60 7 5 RS 485 Programming Note
11. In This Chapter Install the ProTalk Module in the Quantum Rack seeeees 46 After you complete the following procedures the ProTalk module will actively be transferring data bi directionally with the processor ProSoft Technology Inc Page 45 of 239 February 20 2013 Setting Up the ProTalk Module PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 5 1 Install the ProTalk Module in the Quantum Rack 5 1 1 Verify Jumper Settings ProTalk modules are configured for RS 232 serial communications by default To use RS 422 or RS 485 you must change the jumpers The jumpers are located on the back of the module as shown in the following illustration Setup Jumper E 4 Do not move this jumper l unless instructed to do so by AppPot o o ProSoft Technical Support e App Port 2 6 5 1 2 Inserting the 1454 9F connector Insert the 1454 9F connector as shown Wiring locations are shown in the table 4 Config Debug Port t oo Ethernet Port 1454 9F s installed on Hi Port 1 Port 1 o 44 Pont 2 Page 46 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up the ProTalk Module C Programmable Network Interface Module for Quantum Developer Guide 5 1 3 Install the ProTalk Module in the Quantum Rack 1 Place the Module in the Quantum Rack The ProTalk module must be placed
12. Information for Concept Version 2 6 Users 14 Information for ProTalk Product Users 3 Input Image 234 Inserting the 1454 9F connector 46 Install the ProTalk Module in the Quantum Rack 46 47 Installing MDC Configuration Files 14 Installing RY exe and SY exe 93 Introduction to PTQ ADM 53 L Library 234 LIMITED WARRANTY 231 Linked Library 234 Local I O 234 Long 234 Module 234 Multithreading Considerations 56 Mutex 234 MVI Suite 234 MVI46 235 MVI56 235 MVI69 235 MVI71 235 MVI94 235 MVIbp Close 167 168 MVIbp ErrorString 183 MVIbp GetConsoleMode 186 MVIbp GetlOConfig 169 172 MV Ibp_GetModulelnfo 182 MV lbp_GetProcessorStatus 188 MVIbp GetSetupMode 187 MVIbp GetVersionlnfo 181 MVIbp Open 167 168 MVIbp ReadOutputlmage 175 176 MVlbp_ReceiveMessage 177 180 MVlbp_SendMessage 178 179 MVIbp SetConsoleMode 190 MVlIbp SetlOConfig 170 171 175 176 178 180 MVIbp SetModuleStatus 185 MVlIbp SetUserLED 184 MVIbp Sleep 189 MVIbp WaitForlnputScan 173 174 MVIbp WaitForOutputScan 173 174 MVIbp Writelnputlmage 175 176 MVIsp Close 194 197 MVIsp Config 198 MVIsp_Getch 208 209 215 217 219 MVIsp GetCountUnread 219 MVIsp GetCountUnsent 218 MVIsp GetCTS 204 MVIsp GetData 216 219 MVIsp GetDCD 206 MVIsp GetDSR 205 MVIsp_GetDTR 202 203 MVIsp_GetLineStatus 207 MVIsp GetRTS 2
13. P iW Global Data KB m NN Open Dialog Battery Coil Seaments Timer Register Time of Day 400007 Config Extensions r ASCII Data Protection Disabled Number of Messages 0 Peer Cop Disabled Message Area Size 0 Hot Standby Disabled s F Page 18 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Concept C Programmable Network Interface Module for Quantum Developer Guide 4 Inthe CPU Executive pane use the scroll bar to locate and select the PLC to configure PLC Family Quantum 7 586 IEC 32Bit 2500K CHS 984 Eg IMIO CHS CPU Executive m IEC 140 CPU 213 04 Runtime Enable IEC Heap Size KB 140 CPU 434 12 po gt Memory Size Global Data KB ID 4 gt omoa m 5 Click OK This action opens the PLC Configuration dialog box populated with the correct values for the PLC you selected Br Concept CACONCEPTXTESTPR untitled File Configure Project Online Options Window Help D spme fe sa wal 8 S ee 8 2 e a Bl Sal a r PLC 4 Type 140 CPU 53414 Available Logic Area 65535 Bl PLC Memory Partition IEC Enabled IEC Heap Size 300 B Summary PLE Memory Partition Loadables Coils 000001 001536 Number installed o Config Extensions Discrete Inputs 100001 100512 B 1 0 Map Input Regist
14. PLC Page 234 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Glossary of Terms C Programmable Network Interface Module for Quantum Developer Guide CompactLogix MVI46 MVI46 is sold by ProSoft Technology under the MVI46 ADM product name MVI56 MVI56 is sold by ProSoft Technology under the MVI56 ADM product name MVI69 MVI69 is sold by ProSoft Technology under the MVI69 ADM product name MVI71 MVI71 is sold by ProSoft Technology under the MVI71 ADM product name MVI94 MVI94 and MVI94AV are the same modules The MVI94AV is now sold by ProSoft Technology under the MVI94 ADM product name O Originator A client that establishes a connection path to a target Output Image Table of output data sent to nodes on the network P Producer A source of data PTO Pulse Train Output PTQ Suite The PTQ suite consists of line products for Schneider Electronics platforms Quantum ProTalk S Scanner A DeviceNet node that scans nodes on the network to update outputs and inputs Side connect Refers to the electronic interface or connector on the side of the PLC 5 to which modules connect directly through the PLC using a connector that provides a fast communication path between the module and the PLC 5 ProSoft Technology Inc Page 235 of 239 February 20 2013 Glossary of Terms PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Q
15. amp state MVI SUCCESS if state ON printf CTS is ON n else printf CTS is OFF n Page 204 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp GetDSR Syntax int MVIsp GetDSR int comport int state Parameters comport Port for which DSR is requested state Pointer to int for desired state Description This function allows the state of the DSR signal to be determined comport must be previously opened with MVIsp Open The current state of the DSR signal is copied to the int pointed to by state Return Value MVI SUCCESS The DSR state was read successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer Example int state if MVIsp GetDSR COM1 amp state MVI SUCCESS if state ON printf DSR is ON n else printf DSR is OFF n ProSoft Technology Inc Page 205 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp GetDCD Syntax int MVIsp GetDCD int comport int state Parameters comport Port for which DCD is requested state Pointer to int for desired state Description This function allows the state of the DCD signal to be determined comport must b
16. unsigned short ADM DBGetRegs ADMHANDLE adm handle unsigned short offset const unsigned short count unsigned short buff Parameters adm handle Handle returned by previous call to ADM Open offset Character offset into database where the buffer starts count Number of integers to retrieve buff Register buffer to receive integers Description This function copies a buffer of registers in the database to a register buffer adm_handle must be a valid handle returned from ADM_Open Return Value Returns NULL if not successful Returns buff if successful Example ADMHANDLE adm handle unsigned short offset const unsigned short reg_count unsigned short reg_buff ADM DBGetRegs adm handle offset reg_count reg_buff See Also ADM DBSetRegs page 128 ProSoft Technology Inc Page 127 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetRegs Syntax int ADM DBSetRegs ADMHANDLE adm handle unsigned short offset const unsigned short count unsigned short buff Parameters adm handle Handle returned by previous call to ADM Open offset Character offset into database where the buffer starts count Number of integers to write buff Register buffer from which integers are copied Description This function copies a buffer of registers to the database adm_handl
17. 2 7Mb Program MB MB P166 CPU 512Kb Program PCMCIA Ethemet TC P266 CPU 1Mb Program PCMCIA Ethemet TCP P266 CPU Hot Standby 1Mb Program PCMCIA Cancel 2 Next add a power supply to the project In the Project Browser expand the Configuration folder and then double click the 1 LOCALBUS icon This action opens a graphical window showing the arrangement of devices in your Quantum rack 4 Unity Pro XL No name gt File Edit View Services Tools Build PLC Debug Window Help Bu m B zh 7 Project Browser Tg structural view Gy Station Q Configuration 1 Local Bus Eoo Oy 1 Local Quantur sq 1 40 xeF i Derived Data Types L3 Derived FB Types Gy Variables amp FB instant Elementary Variables Derived Variables By Io Derived Variables B Flementam FR Instan Y l gt Hardware catalog Local Quantum Drop Analog Communication Counting 1 Discrete Expert Motion KII aD EA toca eus FOES Bus 25 B ds 140 CPU 651 60 02 00 b ST T T Build A Imsostexoon J User eros Jy SeactiReslace J Ready HMI RAW mode OFFLINE MODBUSO1 1 Page 36 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Configuring the Processor with Unity Pro Developer Guide 3 Select the rack position for the power s
18. Building an Existing Borland C 5 02 ADM Project 1 Start Borland C 5 02 then click Project gt Open Project from the Main Menu File Name Directoiies ADM IDEJ v c adm sample Cancel es Lotes E ADM f SAMPLE 3 ine C3 lib Viewer Drives Defaut Viewer c bd Network List Files of Type Project files ide pri m 2 From the Directories field navigate to the directory that contains the project CAadm sample 3 Inthe File Name field click on the project name adm ide 4 Click OK The Project window appears D lib admapi 1ib 1lib D lib cipapi lib lib D lib avibpspi lib 1ib D lib aviscapi lib 1ib D lib vispsepi lib 1ib D conndrv c c D debugprt c c D nvicfg c c D main_app c c 5 Click Project gt Build All from the Main Menu to create the exe file The Building ADM window appears when complete amp Building ADM Complete e xl Status Success Running Program C BC5 BINMtlink exe Command line C 4DM SAMPLE ADM r p Information Elapsed Time 2 531 Seconds Statistics Total Current Lines 17535 0 Warnings 0 0 Errors 0 0 6 When Success appears in the Status field click OK ProSoft Technology Inc Page 75 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum T
19. Example set console to 115200 baud ADM SetConsoleSpeed COM1 1152001 See Also ADM SetConsolePort page 155 Page 156 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide 9 9 ADM API RAM Functions ADM RAM GetString Syntax char huge ADM RAM GetString ADMHANDLE adm handle char huge mydata char Topic Parameters adm handle Handle returned by previous call to ADM Open mydata Pointer return from ADM RAM Find Section Topic Pointer to name of a variable Description ADM RAM GetsString tries to find the Topic name passed to the function in the file Return Value Pointer to the string found in the file or NULL if the sub section is not found Example cptr char ADM RAM GetString adm handle tptr Module Name if cptr NULL strcpy module name No Module Name else if strlen cptr gt 80 cptr 80 0 strcpy module name cptr if module name strlen module name 1 lt 32 module name strlen module name 1 0 ProSoft Technology Inc Page 157 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM RAM Cetlnt Syntax unsigned short ADM RAM GetInt ADMHANDLE adm handle char huge mydata char
20. February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM Close Syntax int ADM Close ADMHANDLE adm handle Parameters adm handle Handle returned by previous call to ADM Open Description This function is used by an application to release control of the API adm handle must be a valid handle returned from ADM Open IMPORTANT After the API has been opened this function should always be called before exiting the application Return Value ADM SUCCESS API was closed successfully ADM ERR NOACCESS adm handle does not have access Example ADMHANDLE adm handle ADM Close adm handle See Also ADM Open page 100 ProSoft Technology Inc Page 101 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 9 3 ADM API Debug Port Functions ADM ProcessDebug Syntax int ADM ProcessDebug ADMHANDLE adm handle ADM INTERFACE adm interface ptr Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to i i structures Description This function provides a module user interface using the debug port adm handle must be a valid handle returned from ADM Open Return Value
21. Maximum Queue Size By default the API sets the UART s internal receive fifo size to 8 characters to permit greater reliability at higher baud rates In certain serial protocols this buffering of characters can cause character timeouts and can be changed or disabled to meet these requirements Most applications should set the fifosize to the default RXFIFO DEFAULT Either MVIsp OpenAlt or MVIsp Open must be called before any of the other API functions can be used ProSoft Technology Inc Page 195 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Return Value MVI SUCCESS Port was opened successfully MVI ERR REOPEN Port is already open MVI ERR NODEVICE UART not found for port Example MVISPALTSETUP altsetup altsetup baudrate BAUD 9600 altsetup parity PARITY NONE altsetup wordlen WORDLENS altsetup stopbits STOPBITS1 altsetup txquesize DEFQSIZE altsetup rxquesize DEFQSIZE 2 if MVIsp OpenAlt COM1 amp altsetup MVI SUCCESS printf Open failed n else printf Open succeeded Nn See Also MVIsp Open page 193 Page 196 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp Clos
22. These errors will manifest themselves as Previous Definition Different function name Level 1 errors are non fatal and the executable will build and run The architecture of the ADM libraries will cause two or more of these errors to appear when the executable is built This is a normal occurrence If you are building existing code written for a different compiler you may have to replace calls to run time functions with the Digital Mars equivalent Refer to the Digital Mars documentation on the Run time Library for the functions available 8 1 2 Configuring Borland C 5 02 The following procedure allows you to successfully build the sample ADM code supplied by ProSoft Technology using Borland C 5 02 After verifying that the sample code can be successfully compiled and built you can modify the sample code to work with your application Note This procedure assumes that you have successfully installed Borland C 5 02 on your workstation Downloading the Sample Program The sample code files are located in the ADM TOOL PTQ ZIP file This zip file is available from the CD ROM shipped with your system or from the www prosoft technology com web site One the file is unzipped you can find the sample code files in ADM TOOL PTQNSamplesV Page 74 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide
23. Topic Parameters adm handle Handle returned by previous call to ADM Open mydata Pointer return from ADM RAM Find Section Topic Pointer to name of a variable Description ADM RAM Getlnt tries to find the Topic name passed to the function in the file Return Value Value of type Integer found under the Topic name or 0 if the sub section is not found Example module err offset ADM RAM GetInt adm handle tptr Baud Rate if module err offset 0 module err offset gt module max regs 61 module err offset 1 module err freq 0 else module err freq 500 Page 158 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM RAM GetLong Syntax unsigned long ADM RAM GetLong ADMHANDLE adm handle char huge mydata char Topic Parameters adm handle Handle returned by previous call to ADM Open mydata Pointer return from ADM RAM Find Section Topic Pointer to name of a variable Description ADM RAM GetLong tries to find the Topic name passed to the function in the file Return Value Value of a type Long found under the Topic name or 0 if the sub section is not found Example module err offset ADM RAM GetLong adm handle tptr Baud Rate if module err offset 0 module err offset gt module max regs 61 modul
24. W Ene reletetney 3 Importarit INOLICO epo ee M En e n EE era e PER e BR Te EE ease Ve T ETA 4 1 Start Here 11 1 1 Hardware and Software Requirements 12 1 1 1 Package Contents c etr perte canet t a are Po ft eg f 12 1 1 2 Recommended Compact Flash CF Cards sse 13 1 2 Information for Concept Version 2 6 Users sse 14 1 2 1 Installing MDC Configuration Files 14 2 Configuring the Processor with Concept 17 2 1 Create a New Project sssssssssssssssssssses eene enne nnns entren nennen et nrn nennen 18 2 2 Add the PTQ Module to the Project ssssssseeeeeneeen ens 20 2 3 Set up Data Memory in Project ssssssssssseseeeneeeen eene 22 24 Download the Project to the Processor 24 2 5 Verify Successful Download sse nnne 27 3 Configuring the Processor with PFoWORX 31 4 Configuring the Processor with Unity Pro 35 4 1 Create a New Project sesssssssssssssssseseenene enne intet ernst nnns nnne enne 36 4 2 Add the PTQ Module to the Project ssssseeeeen ens 38 4 3 Build tlie Project 2 i pro e shade S IIo nete P O aS OE 40 4 4 Connect Your PC to the Processor eene 41 4 4 1 Connecting to the Processor with TCPIP ssssssssseeeeeeenneenen 43 4 5 Download the Project to the Quantum Processor 44 5 Setting Up the ProTalk Module 45
25. interfac call b ADM BtFun See Also ptr amp interface ackplane transfer logic c adm handle interface ptr verbose ADM BtOpen page 146 Page 150 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM SetStatus Syntax int ADM SetStatus ADMHANDLE adm handle ADM INTERFACE adm interface ptr int pass cnt Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to structures pass cnt Counter from user code to indicate module health This counter could be updated in the main loop of the program Description This function writes status data to the database at the location set by Error Status Pointer in the module configuration The data is written in the following order pass cnt in the ADM INTERFACE structure ADM PRODUCT structure ADM PORT ERRORS structure 1 time for each application port ADM BLK ERRORS structure Return Value ADM SUCCESS The function has completed successfully ADM ERR NOACCESS adm handle does not have access Example ADMHANDLE adm handle ADM INTERFACE interface ptr int pass cnt ADM INTERFACE interface interface ptr amp interface ADM SetStatus adm handle interface ptr interface pass cnt
26. 86 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 8 5 Transferring Files to and from the Module with HyperTerminal You can transfer individual files to and from the Compact Flash drive on the ADMNET module using the utilities RY exe Receive Ymodem and SY exe Send Ymodem These two programs work with a terminal client for example HyperTerminal on your desktop PC to connect to the module and transfer files RY exe and SY exe are included in the sample ADM TOOL zip file for your hardware platform inRAx ProLinx or ProTalk Important The embedded operating system in the ADM ADMNET module restricts file names to eight DOS legal characters or fewer with a three character extension For more information on creating filenames in the proper format refer to pages 17 through 20 of the DOS 6 XL Reference manual 8 5 1 Required Hardware You can connect directly from your computer s serial port to the serial port on the module to send upload or receive download files ProSoft Technology recommends the following minimum hardware to connect your computer to the module 80486 based processor Pentium preferred megabyte of memory At least one UART hardware based serial communications port available USB based virtual UART systems USB to serial port adapters often do not fu
27. ADM C Programmable Setting Up the ProTalk Module C Programmable Network Interface Module for Quantum Developer Guide RS 422 RS 422 Application Port Cable DB 9 Male RS 422 Device TxD RxD TxD RxD Signal Signal Common Common RxD 2 L ne RxD c two RS 485 and RS 422 Tip If communication in the RS 422 RS 485 mode does not work at first despite all attempts try switching termination polarities Some manufacturers interpret and A B polarities differently ProSoft Technology Inc Page 51 of 239 February 20 2013 Setting Up the ProTalk Module PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 52 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Introduction to PTQ ADM C Programmable Network Interface Module for Quantum Developer Guide 6 Introduction to PTQ ADM In This Chapter Operating System essere nennen rnnt 54 This document provides information needed for the development of application programs for the PTQ ADM Serial Communication Module The PTQ suite of modules is designed to allow devices with a serial port to be accessed by a Quantum PLC The ProTalk module is the platform used ProTalk modules are programmable to accommodate devices with unique serial protocols Included in this document is information about the available software API libraries and t
28. ADM DBNOR Byte 139 ADM DBOpen 109 110 111 ADM DBOR Byte 138 ADM DBSetBit 113 114 ADM DBSetBuff 125 126 ADM DBSetByte 115 116 ADM DBSetDFloat 123 124 ADM DBSetFloat 121 122 ADM DBSetLong 119 120 ADM DBSetRegs 127 128 ADM DBSetString 129 130 ADM DBSetWord 117 118 ADM DBSwapDWord 132 ADM DBSwapWord 131 ADM DBXNOR Byte 143 ADM DBXOR Byte 142 ADM DBzZero 111 ADM Get BP Data Exchange 163 ADM GetDBOptr 133 ADM GetDBint 135 ADM GetDBlptr 134 ADM GetVersionInfo 154 ADM Open 100 101 ADM ProcessDebug 102 ADM RAM GetChar 162 ADM RAM GetDouble 161 ADM RAM GetFloat 160 ADM RAM Getlnt 158 ADM RAM GetLong 159 ADM RAM GetString 157 ADM ReadBtCfg 149 ADM SetBtStatus 151 152 ADM SetConsolePort 155 156 ADM SetConsoleSpeed 155 156 ADM SetLed 153 ADM SetStatus 151 152 ADM StartTimer 144 145 API 233 API Libraries 56 Application Development Libraries 97 B Backplane 233 Backplane API Configuration Functions 169 Backplane API Direct I O Access 175 Backplane API Functions 165 Backplane API Initialization Functions 167 Backplane API Messaging Functions 177 Backplane API Miscellaneous Functions 181 Backplane API Synchronization Functions 173 BIOS 233 Build the Project 40 Building an Existing Borland C 5 02 ADM Project 15 Building an Existing Digital Mars C 8 49 ADM P
29. Development Libraries 97 9 1 ADM ABI FUnGLlOrns s s eiecti teret tette Pert tee bete tete Pen ritate 98 9 2 ADM API Initialization Functions eeeeeennnnm nnn 100 ADM ODOM ete 100 ADM GOS S scot E A EE E betel avteaecacetiy Ses A E tebstatetslavitsthe dy 101 9 3 ADM API Debug Port Functions eeeeene enne 102 RDM ProcessDoebug s tiec ette eet ee t tetro eta eto eeu Lade te b ee n ANTENN 102 ADM DAWtFiteSendGll petet Int tr p ete tere este er pet Iota tet 103 ADM DAWfEFiteBecvGl ettet p teer etate ec ee Tert edere reg As 104 ADM JDAWtEfiteSendDala certet p eter teles er pet foit vede tete 105 ADM DAWirItehecvData edet teet ise ade iid 106 ADM GornPrint r tte bt debet t tore tbe teretes e pe iste te rsen 107 ADM GheckDBPOTCt u diet ese tee ette De a e etd tc ape Peto po rsen 108 9 4 ADM API Database Functions eeesseseeeeneeeene nennen 109 ADM DBOpe ni 53 dd itunes heit f dd agens eL dakia danai taadaa dado 109 ADMEDBGIOSG 23 4 6a tti ea tia nee ad titio cabe e EE es 110 Page 6 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Contents C Programmable Network Interface Module for Quantum Developer Guide ADM DBZoero 2 ae otiam rte deiode taedet nte tae apa te E chet 111 ADM DBGeIBIL 3 1 meto diesratets ien son at tests esu ds 112 ADMDBSeSIBIL 2 42 0 ete deat eden at eet
30. February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide 11 1 Serial Port API Initialization Functions MVIsp Open Syntax int MVIsp Open int comport BYTE baudrate BYTE parity BYTE wordlen BYTE stopbits Parameters comport Communications Port to open baudrate Baud rate for this port parity Parity setting for this port wordlen Number of bits for each character stopbits Number of stop bits for each character Description MVIsp Open acquires access to a communications port This function must be called before any of the other API functions can be used comport specifies which port is to be opened The valid values for the module are COM corresponds to PRT1 COM corresponds to PRT2 and COM3 corresponds to PRT3 ProSoft Technology Inc Page 193 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum baudrate is the desired baud rate The allowable values for baudrate are shown in the following table Baud Rate Value BAUD 110 BAUD 150 BAUD 300 BAUD 600 BAUD 1200 BAUD 2400 BAUD 4800 BAUD 9600 BAUD 19200 BAUD 28800 BAUD 38400 10 BAUD 57600 11 BAUD_115200 12 Valid values for parity are PARITY NONE PARITY ODD PARITY EVEN PARITY MARK and PARITY SPACE wordlen sets the word le
31. February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 22 Click Memory Models from the Topics field and ensure that the options match those shown in the following screen Project Settings Compiler Code Generation Header Files Windows Prolog E pilog Output Warnings Debug Information Link er Packing amp Map File Definitions Segments Imports E ports Resource Compiler 23 Click Linker from the Topics field and ensure that the options match those shown in the following screen Project Settings Compiler Code Generation Header Files Memory Models Code Optimizations Windows Prolog E pilog Output Warnings Debug Information Packing amp Map File KEE ME nia Orel Definitions Segments Imports E ports Resource Compiler Make Generate port Library ANGrMmetts Page 72 of 239 ProSoft Technology Inc February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 24 Click Packing amp Map File from the Topics field and ensure that the options match those shown in the following screen Project Settings x Target Build Option Sets Directories cane j p Packing ode Generation Header Files Win Pack IV Pack Code e
32. Mars C 8 49 and then click Project New from the Main c E amp DM TOOL MVI E SAMPLES E MVI56 S amples E MVIBE ADM o MVISSADM Se Z 2 Select the path and type in the Project Name 3 Click Next Add files to project 4 nitial settings E B C EE O Unicode 4 Inthe Platform field choose DOS 5 f included in your build ProSoft Technology Inc February 20 2013 In the Project Settings choose Release if you do not want debug information Page 67 of 239 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 6 Click Next 1 Name project File Name Directories 2 Set project type MVISG4DM Senalln C oN AmE adm serali 56adm si DEF Eck MVI564DM Serialln C E gt ADM TOOL MVI E SAMPLES E MVI56 SAMPLES Eg MVISE ADM E gt MVI56 ADM SERI Drives gc z 4 Initial settings a H Bemave Select All Unselect Al ma T i Im you would like to add existing files to the project add them here When done press Next 7 Select the first source file necessary for the project 8 Click Add 9 Repeat this step for all source files needed for the project 10 Repeat the same procedure for all library files lib needed for the project 11 Choose Libraries lib from the List Files of Type field to view all library files E
33. Model No Exceptions BGI fi x a ange Altemate Startup Diagnostic N Type in the Project Path and Name The Target Name is created automatically In the Target Type field choose Application exe In the Platform field choose DOS Standard In the Target Model field choose Large Ensure that Emulation is checked in the Math Support field oo kh Ww Page 76 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 7 Click OK A Project window appears TE Project c adm sample my_pra ml xj O v ny proj exe exe D iTA S A 8 Click on the cpp file created and press the Delete key Click Yes to delete the cpp file 9 Right click on the exe file listed in the Project window and choose the Add Node menu selection The following window appears amp Add to Project List Look in Cy SAMPLE e amp mertES 21x m My Computer YAGI e File name my proi cep hd My Network P Files of type C source cpp c Cancel 10 Click source file then click Open to add source file to the project Repeat this step for all source files needed for the project 11 Repeat the same procedure for all library files lib needed for the project ProSoft Technology Inc Page 77 of 2
34. Open timeout specifies the number of milliseconds that the function will wait for the output scan to occur Return Value MVI SUCCESS The output scan has occurred MVI ERR NOACCESS handle does not have access MVI ERR TIMEOUT The timeout expired before an output scan occurred MVI ERR BADCONFIG The data connection is not open Example MVIHANDLE Handle int ECS Wait here until output scan 50ms timeout rc MVIbp WaitForOutputScan Handle 50 if rc MVI ERR TIMEOUT printf Output scan did not occur within 50ms Nn else printf Output scan has occurred Mn See Also MVIbp WaitForlnputScan page 173 Page 174 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide 10 4 Backplane API Direct I O Access MVIbp ReadOutputlmage Syntax int MVIbp ReadOutputImage MVIHANDLE handle WORD buffer WORD offset WORD length Parameters handle Handle returned by previous call to MVIbp Open buffer Pointer to buffer to receive data from output image offset Word offset into output image at which to begin reading length Number of words to read Description MVIbp ReadOutputlmage reads from the module s output image handle must be a valid handle returned from MVIbp Open buffer must point to a buffer of at least length words in size offset s
35. be called often until MVI SUCCESS is returned As soon as MVI SUCCESS is returned action should be taken on the data Once this is completed a call to MVIbp Writelnputlmage should be made Page 58 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Understanding the PTQ ADM API C Programmable Network Interface Module for Quantum Developer Guide The lock is not returned to the PLC until the call to MVIbp Writelnputlmage is made The program time between a successful MVIbp ReadOutputlmage and the call to MVibp Writelnputlmage is added to the PLC scan time It is recommended to keep this time to a minimum to avoid unduly lengthening the PLC scan time PLC Writes Output Image This time is added to the PLC Scan If SUCCESS then Copy data to buffer and go to This time is added MVIbp Writelnputlmage to the PLC Scan Total PLC Scan Time PLC program logic executes during this time Other processing must occur during this time in order to not lengthen the PLC scan time PLC Writes Output Image ProSoft Technology Inc Page 59 of 239 February 20 2013 Understanding the PTQ ADM API PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 7 4 Database The database functions of the ADM API allow the creation of a database in memory to store data to be accessed via the backplane interface and the application ports The database consists
36. be integrated irta the Quantum platform The module acts as a gateway between the DNP network and the Quartum processor The data transfer from the Quantum processor is asynchronous fromthe actions on the DNP network Databases are user defined and stored in the module to hold the data required by the protocol The PTQ DNPSNET module is a powerful communication interace for Quantum platform processors Developed under license from Schnelder Electric the module Incorporates proprietary backplane technology that enables powerful data accesso the Quantum processor Functional Specificetions Hardware Specifications DNP Subset Detnition zl 2 3 Setup Data Memory in Project 1 Inthe list of options on the left side of the PLC Configuration dialog box double click SPECIALS E Concept C CONCEPT TESTPR J untitled File Configure Project Online Options Window Help Cc lots Fs ta 93 e 8 e e 8 B0 A rPLC B Summary 3 J E B PLC Selection Type 140 CPU 534 14 Available Logic Area 65535 B PLC Memory Partition EG Enabled REIR aio 300 PLC Memory Partition 7 pLoadabes Coils 000001 001536 Number installed 0 Discrete Inputs 100001 100512 Input Registers 300001 300512 B Segment Scheduler Holding Registe400001 401872 EB Modbus Port Settings ASCII Specials Segment Scheduler Battery Coil es Segments 32 Timer Register
37. byte at offset Description This function ORs a byte in the database with a byte long bit mask adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle int offset unsigned char bval 0x55 ADM DBOR Byte adm handle offset bval Page 138 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBNOR Byte Syntax int ADM DBNOR Byte ADMHANDLE adm handle int offset unsigned char bval Parameters adm handle Handle returned by previous call to ADM Open offset Byte offset into database bval Bit mask to be NORed with the byte at offset Description This function NORs a byte in the database with a byte long bit mask adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle int offset unsigned char bval 0x55 ADM DBNOR Byte adm handle offset bval ProSoft Technology Inc Page 139 of 23
38. character is returned by MVIsp GetData This function attempts to retrieve characters from the reception queue and return values correspond accordingly timeout specifies the amount of time in milliseconds to wait If timeout is TIMEOUT ASAP the function will return immediately if the queue is empty If timeout is TIMEOUT FOREVER the function will not return until an array of bytes is retrieved from the reception queue successfully If the timeout elapses before the termination character or len bytes are received MVI ERR TIMEOUT is returned When MVIsp GetData returns it writes to the int pointed to by len the number of bytes retrieved len is written for successfully retrieved bytes as well as timeouts Page 216 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide Return Value MVI SUCCESS bytes were retrieved successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM invalid pointer MVI ERR TIMEOUT timeout elapsed before bytes retrieved Example BYTE data 10 int nny nn 10 if MVIsp GetData COM1 data amp nn 1000L MVI SUCCESS printf d bytes were received n nn See Also MVIsp Gets page 214 MVIsp_Getch page 209 MVIsp PutData page 212 ProSoft Technology Inc Page 217 of 239 February 20 2013 Serial Port Library Fu
39. enter the PTQ ADM module Configuration menu System BIOS Setup Custom Configuration C 1998 General Software Inc All rights reserved Console on Port 1 gt Disabled Compact Flash CHS Mode Console Baud Rate 19200 m e CE M Tab to select or to modify lt Esc gt to return to main menu 6 Onthe BIOS configuration menu use the Tab key to navigate through the menu options and then use the 4 key to toggle the choices The options to change are o Console on Port 1 change to Enabled o Console Baud Rate change to 57600 7 Press Esc to return to the Main Menu 8 Press Esc again to apply your changes and reboot the module 9 Remove the module from the rack and disable the Setup jumper To communicate with the module in Console mode ProSoft Technology Inc Page 91 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 1 Change the connection settings in HyperTerminal from 19200 to 57600 and then reconnect to the module COM1 Properties L2 1x1 Port Settings Bits per second EX SU x Data bits 8 Parity None x Stop bits 1 x Flow control None Restore Defaults 2 Press Esc to exit the program and return to the command prompt MVI DOS v1 08 Copyright c 1999 20
40. following steps are designed to ensure that the processor is able to transfer data successfully with the PTQ module As part of this procedure you will use Concept configuration software from Schneider Electric to create a project add the PTQ module to the project set up data memory for the project and then download the project to the processor Important Note Concept software does not report whether the PTQ module is present in the rack and therefore is not able to report the health status of the module when the module is online with the Quantum processor Please consider this when monitoring the status of the PTQ module ProSoft Technology Inc Page 17 of 239 February 20 2013 Configuring the Processor with Concept Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum 2 1 Create a New Project This phase of the setup procedure must be performed on a computer that has the Concept configuration software installed 1 From your computer choose START PROGRAMS CONCEPT V2 6 XL EN CONCEPT This action opens the Concept window 2 Open the File menu and then choose NEW PROJECT This action opens the PLC Configuration dialog box Concept C CONCEPT TESTPRJ untitled File Configure Project Online Options Window Help Distal ts e le e 8 5 5 ee 8 cei e ea S15 e iijece Configuration C xl a PLE B EB PLC Selection B Config Extensio
41. from ADM Open Return Value 0 No change 1 Register has changed Example ADMHANDLE adm handle int offset if ADM DBChanged adm handle offset printf Data has changed else printf Data is unchanged Page 136 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBBitChanged Syntax int ADM DBBitChanged ADMHANDLE adm handle int offset Parameters adm handle Handle returned by previous call to ADM Open offset Bit offset into database Description This function checks to see if a bit has changed since the last call to ADM DBBitChanged adm handle must be a valid handle returned from ADM Open Return Value 0 No change 1 Bit has changed Example ADMHANDLE adm handle int offset if ADM DBBitChanged adm handle offset printf Bit has changed else printf Bit is unchanged ProSoft Technology Inc Page 137 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBOR Byte Syntax int ADM DBOR Byte ADMHANDLE adm handle int offset unsigned char bval Parameters adm handle Handle returned by previous call to ADM Open offset Byte offset into database bval Bit mask to be ORed with the
42. function for more information The MsgRcvBufSize and MsgSndBufSize members indicate the maximum size in words for received or sent messages respectively By default these values are both zero indicating that messaging is disabled Refer to the MVIbp SetlOConfig function for more information Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS handle does not have access Example MVIHANDLE handle MVIBPIOCONFIG ioconfig MVIbp GetlIOConfig handle amp ioconfig printf d words of input image available n ioconfig DirectInputSize printf d words of output image available n ioconfig DirectOutputSize ProSoft Technology Inc Page 169 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum See Also MVIbp SetlOConfig page 171 Page 170 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide MVIbp SetlOConfig Syntax int MVIbp SetIOConfig MVIHANDLE handle MVIBPIOCONFIG ioconfig Parameters handle Handle returned by previous call to MVIbp Open ioconfig Pointer to MVIBPIOCONFIG structure which contains configuration information Description This function defines the portion of the module s I O images that will be used for direct I O access a
43. image to disk Compression JWoma e Cancel Help 5 Click on File Save As and choose a directory and filename for the disk image file The image must be saved as an uncompressed disk image so be sure to select Save as type Image file IMA as shown in the following figure Save As 2 x Save in ames gm amp e zm Filename mvi3 Save as type image file IMA m Cancel Comment 6 Check the disk image file size to be sure it does not exceed the maximum size of the PTQ module s ROM disk 896K bytes If it is too large use WINIMAGE to remove some files from the image then de fragment the image and try again Note To de fragment an image click on Image Defrag current image The disk image is now ready to be downloaded to the PTQ module For more information on using WINIMAGE refer to the documentation included with it Note WINIMAGE is a shareware utility If you find this program useful please register it with the author ProSoft Technology Inc Page 83 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 8 3 Downloading a ROM Disk Image 8 3 1 MVIUPDAT MVIUPDAT EXE is a DOS compatible utility for downloading a ROM disk image from a host PC to the PTQ ADM module MVIUPDAT EXE uses a serial port on the PC to communicate with the module Follow the steps below
44. left unallocated when the direct I O sizes are specified If messaging is enabled and insufficient I O image is available for messaging the error MVI ERR BADCONFIG will be returned For best messaging performance set the direct I O sizes as small as possible Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS handle does not have access MVI ERR BADCONFIG Configuration is not valid MVI ERR NOTSUPPORTED Always returns this error Example MVIHANDLE handle MVIBPIOCONFIG ioconfig ioconfig DirectInputSize 2 2 words used for input ioconfig DirectOutputSize 1 1 word used for output MsgSndBufSize 256 Enable 256 word max messages to processor MsgRcvBufSize 0 Received messages not enabled if MVI SUCCESS MVIbp SetIOConfig handle amp ioconfig printf Error I O configuration failed n See Also MVIbp GetlOConfig page 169 Page 172 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide 10 3 Backplane API Synchronization Functions MVIbp WaitForlnputScan Syntax int MVIbp WaitForInputScan MVIHANDLE handle WORD timeout Parameters handle Handle returned by previous call to MVIbp Open timeout Maximum number of milliseconds to wait for scan Description MVIbp WaitForlnputScan allows an application
45. of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Understanding the PTQ ADM API C Programmable Network Interface Module for Quantum Developer Guide 7 Understanding the PTQ ADM API In This Chapter API Libraries oc EL e EU dee eode 56 Development Tools eeseessssseeeseeeeneeeentrene enne nennen 57 Theory of Operation kiniinin einen aeneis iiaae edane 58 se Database coc odere oi te er ei a vette fele ava buta 60 RS 485 Programming Note sss 61 The PTQ ADM API Suite allows software developers to access the PLC backplane and serial ports without needing detailed knowledge of the module s hardware design The PTQ ADM API Suite consists of three distinct components the Serial Port API the Backplane CIP API and the ADM API The Backplane API provides access to the PLC the Serial Port API provides access to the serial ports and the ADM API provides functions designed to ease development Applications for the PTQ ADM module may be developed using industry standard DOS programming tools and the appropriate API components This section provides general information pertaining to application development for the PTQ ADM module ProSoft Technology Inc Page 55 of 239 February 20 2013 Understanding the PTQ ADM API PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 7 1 API Libraries Each API pro
46. the BROWSE button to locate the Setup exe file to execute and then execute the setup program After the installation restart your PC if you are prompted to do so Refer to your Schneider Electric documentation for more information on installing drivers for Unity Pro Page 42 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Unity Pro C Programmable Network Interface Module for Quantum Developer Guide 4 4 1 Connecting to the Processor with TCPIP The next step is to download copy the project file to the processor The following steps demonstrate how to use an Ethernet cable connected from the Processor to your PC through an Ethernet hub or switch Other connection methods may also be available depending on the hardware configuration of your processor and the communication drivers installed in Unity Pro 1 If you have not already done so connect your PC and the processor to an Ethernet hub 2 Open the PLC menu and then choose SET ADDRESS Important Notice that the Set Address dialog box is divided into two areas Enter the address and media type in the PLC area of the dialog box not the SIMULATOR area 3 Enter the IP address in the address field In the MEDIA dropdown list choose TCPIP 4 Click the TEST CONNECTION button to verify that your settings are correct Set Address ProSoft Technology Inc Page 43 of 239 February 20 2013 Configuring t
47. the Processor with Concept Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Saving your project 1 Inthe PLC Configuration dialog box choose FILE SAVE PROJECT AS Ef Concept C CONCEPTATESTPR J untitled File Configure Project Online Options Window Help New project Open Close project Save project 001536 100512 300512 401872 Import Export Print Printer setup View Logfile Exit ASCIF Numbe AleF4 1 C CONCEPT TESTPRI NEWDFNT Dg Open Dialog Messa iid Save current project using a different database name 2 This action opens the Save Project As dialog box axi File name Folders IEEE pd ciNconcepttestpri Cancel WD i Bees J PR amp CONCEPT Network f TESTPRJ et 3 dib Save file as type Concept Projects pri z 3 NEWDFNT BAK CONEWDFNT DIA gt Drives amp x 3 Name the project and then click OK to save the project to a file 2 4 Download the Project to the Processor Next download copy the project file to the Quantum Processor Page 24 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Concept C Programmable Network Interface Module for Quantum Developer Guide 1 Use the null modem cable to connect your PC s serial port to the
48. timeout to zero If no message has been received MVI ERR TIMEOUT will be returned Before this function can be used messaging must be enabled with the MVIbp SetlOConfig function If messaging has not been enabled MVI ERR BADCONFIG will be returned If the message received from the control processor is larger than length the message will be truncated to length words and MVI ERR MSGTOOBIG will be returned The MVIbp ReceiveMessage function retrieves data written to the PTQ ADM module by the processor via a MSG instruction The MSG instruction must be configured as shown in table A The MSG instruction implements a put attribute command to the PTQ module s assembly object The MSG instruction will fail if a message has already been written to the PTQ module but application has not yet retrieved the message via MVIbp ReceiveMessage ProSoft Technology Inc Page 177 of 239 February 20 2013 Backplane API Functions Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Receive MSG Instruction Configuration Field Value Description Message Type CIP Generic Specify CIP message type Service Code 10 Hex Set_Attribute_Single service Object Type 4 Assembly object class code Object ID 8 Output message instance number Object Attribute 3 Data attribute Num Elements Application dependent Size of message to be written Path Application dependent Path to PTQ modu
49. to a 0 in the database at a specified bit offset adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY datab ase is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset ADM DBClearBit adm handle offset See Also ADM DBSetBit page 113 Page 114 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetByte Syntax char ADM DBGetByte ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open Offset Byte offset into database Description This function reads a byte from the database at a specified byte offset adm handle must be a valid handle returned from ADM Open Return Value Requested byte Example ADMHANDLE adm handle unsigned short offset int i i ADM DBGetByte adm handle offset See Also ADM DBSetByte page 116 ProSoft Technology Inc Page 115 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetByte Syntax int ADM DBSetByte AD
50. to be set shake Desired handshake mode Description This function enables handshaking for a port after it has been opened comport must be previously opened with MVIsp Open shake is the desired handshake mode Valid values for shake are HSHAKE NONE HSHAKE XONXOFF HSHAKE RTSCTS and HSHAKE DTRDSR Use HSHAKE XONXOFF to enable software handshaking for a port Use HSHAKE RTSCTS or HSHAKE DTRDSR to enable hardware handshaking for a port Hardware and software handshaking cannot be used together Handshaking is supported in both the transmit and receive directions Important If hardware handshaking is enabled using the MVIsp SetRTS and MVIsp SetDTR functions will cause unpredictable results If software handshaking is enabled ensure that the XON and XOFF ASCII characters are not transmitted as data from a port or received into a port because this will be treated as handshaking controls Return Values MVI SUCCESS No errors were encountered MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid handshaking mode Example if MVI SUCCESS MVIsp SetHandshaking COM1 HSHAKE RTSCTS printf Error Set Handshaking failed n ProSoft Technology Inc Page 199 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 11 3 Serial Port API Status Functions MVIsp SetRTS Syntax int MVI
51. 00 201 MVIsp Gets 209 211 214 217 219 MVIsp GetVersionlnfo 222 MVIsp Open 193 196 197 198 MVIsp OpenAlt 195 MVIsp PurgeDataUnread 220 221 MVIsp PurgeDataUnsent 220 221 MVIsp Putch 208 209 211 213 218 MVIsp PutData 208 211 212 215 217 218 MVIsp Puts 208 210 213 215 218 MVIsp_SetDTR 202 203 MVIsp_SetHandshaking 199 MVIsp_SetRTS 200 201 MVIUPDAT 84 O Operating System 54 Originator 235 Page 238 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Index C Programmable Network Interface Module for Quantum Developer Guide Output Image 235 U P Understanding the PTQ ADM API 55 Package Contents 12 Uploading files from the ADM module to a PC 95 PC and PC Software 13 V Pinouts 3 46 48 Producer 235 Verify Jumper Settings 46 Product Specifications 223 Verify Successful Download 27 PTO 235 W PTQ Suite 235 PTQ System BIOS Setup 85 Warnings 3 Q WINIMAGE Windows Disk Image Builder 82 Word 236 Quantum Hardware 12 Y R Your Feedback Please 2 Recommended Compact Flash CF Cards 13 Required Hardware 87 Required Software 87 RS 232 Modem Connection 49 Null Modem Connection Hardware Handshaking 49 Null Modem Connection No Hardware Handshaking 50 RS 232 Application Port s 48 RS 232 Configuration Debug Port 48 RS 422 51 RS 485 and RS 422 Tip 51 RS 485 Application Port s 50 RS 48
52. 00 Online Development Inc Copyright C 1990 1997 General Software Inc All Rights Reserved MVI56 Backplane Device Driver 1 05 Copyright c 1999 2000 Online Development Inc Copyright c 1997 2000 Allen Bradley Company LowMem HiMem 766k 0k General Software mini COMMRND COM V2 0 Copyright C 1990 1993 General Software Inc A gt path a a dos A gt S6ADH SI Press Esc to Exit Closing Backplane Driver Closing Serial Port Driver A gt Important The autoexec bat in the image file must allow the application to exit to a DOS prompt Page 92 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 8 5 5 Installing RY exe and SY exe To install RY exe and SY exe on the module remove the Compact Flash card from the module and then use a Compact Flash card reader on your PC to copy the files to the root directory of the Compact Flash card When you reinsert the Compact Flash card in the module use the following syntax to send or receive files C RY or C SY filename ext The filename and path must be in quotes Important You cannot copy files directly to the A drive on the module To update files on the A drive you must create a new ROM image and download the image to the module using MVIFlashUpdate page 84 The following procedures show how to send and
53. 1 Name project File Name Directories EE S asd c vnviBE adm serialin 4 Initial settings ADMAPI LIB 3 c CIPAPI LIB MVIBPAPI LIB prid MVISCAPI LIB MVISPAPI LIB Ez MVI56 SAMPLES E MVI56 4DM 4 MVIS6 ADM SERI Y List Files of Type Drives Library lib Project Files lt Previous Next gt Finish Cancel It you would like to add existing files to the project add them here When done press Next Page 68 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 12 Click Next Name project Set project type 3 Add files to project 13 Add any defines or include directories desired 14 Click Finish 15 The Project window should now contain all the necessary source and library files as shown in the following window TI ne fn fn CD TD ProSoft Technology Inc Page 69 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 16 Click Project Settings from the Main Menu Project Settings B os Eeue Lj ote Li F Ocg EENE Li COME 17 These settings were set when the project was created No changes are required The executable must be built as a DO
54. 100 ms In bits Outbits Status Eim 1 Quantum O 3 o 0 Select this row when inserting at end of list Head Setup Cancel Help 2 Click the EDIT button to open the Local Quantum Drop dialog box This dialog box is where you identify rack and slot locations Drop Module Modules 0 ESEI Port Bits In 0 P Bits In 0 Bits Out 0 LT Bits Qut Status T able Prey Nest Clear Delete Cut Copy Paste Rack Slot Module Detected In Ref In End Out Ref Dut End 11 i ans a p E E __ S a aa iae f OK Cancel Help F Pall Page 20 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Concept C Programmable Network Interface Module for Quantum Developer Guide 3 Click the MODULE button next to the rack slot position where the ProTalk module will be installed This action opens the O Module Selection dialog box x Drop Module Modules 0 ASCII Port rene z Bits In 0 Params 1EC6087 5 101 Slave 1EC6087 5 103 Master 1EC6087 5 104 Server Select your ProTalk Q module here Leave lt all gt highlighted 4 Inthe Modules pane use the scroll bar to locate and select the ProTalk module and then click OK This action copies the description of the ProTalk module next to the assigned rack and slot number of the Local Qua
55. 132 Memory Models Code D ptimizatons Exe Pack Pack Data e132 Windows Prolag E pilo m Output Toe Pros v Smart Linking Warnings Debug Information E Linker Map File kin C NoMap C Segment Map Detailed Segment Map Definitions Segments Imports E sports Map File Options Resource Compiler Symbol Map Make Cross Reference Faaal Make iee Niner C Sorted by Address Sorted by Address and Name Group Information Current Option Set 56adm si OPN 25 Click Make from the Topics field and ensure that the options match those shown in the following screen Project Settings x Target Build ption Sets Directories t Compil Code Generation Use IDDE Make Use Extemal Make File ae MIDDE Make Options emory Models Code Optimizations Build Order M Track Dependencies Windows Prolog Epilog Track System Includes ecd Link Order On Eror Continue Unrelated Debug Information I Ignore Errors in Build Linker th Packing amp Map File p Multitasking Definitions Frequent Moderate C None Segments Imports E ports NetBuild Resource Compiler Use NetBuild Jo Use Remote Headers External Make Librarian Working Directoy Current Option Set Hemuate Password 5Badm so 0PN mi nendro ET Bt ce 26 Click OK 27 Click Parse Update All from the Project Window Menu The new settings may not take effect unless the project is upd
56. 39 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 12 Choose Libraries lib from the Files of Type field to view all library files Look in Cu ib xy ct Be s MVISPAPT LIB My Computer E My Network P File name M Open Files of type Libraries lib X Cancel 13 The Project window should now contain all the necessary source and library files as shown in the following window D lib admapi lib lib D lib cipapi lib lib D lib mvibpapi lib lib D lib viscapi lib lib D lib Nnvispapi lib lib B conndrv c c D debugprt c c D mvicfg c c D main_app c c Page 78 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 14 Click Options Project from the Main Menu g Project Options y 21x Topics Directories t Compiler a 16 bit Compiler 32 bit Compiler This section lets you tell Borland C where to look for source C Options include and library files The output directories control where t ptimizations intermediate files OBJ RES and final files EXE DLL Messages RES are placed iin Linker Librarian r Source Directories cPResources Bui
57. 5 Programming Note 61 S Scanner 235 Serial Port API Communications 208 Serial Port API Configuration Functions 198 Serial Port API Initialization Functions 193 Serial Port API Miscellaneous Functions 222 Serial Port API Status Functions 200 Serial Port Library Functions 191 Set up Data Memory in Project 22 Setting Up the ProTalk Module 45 Setting Up Your Compiler 64 Setting Up Your Development Environment 63 Side connect 235 Software 62 Start Here 11 Support Service amp Warranty 229 T Target 236 Theory of Operation 58 Thread 236 Transferring Files to and from the Module with HyperTerminal 87 ProSoft Technology Inc Page 239 of 239 February 20 2013
58. 9 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBAND Byte Syntax int ADM DBAND Byte ADMHANDLE adm handle int offset unsigned char bval Parameters adm handle Handle returned by previous call to ADM Open offset Byte offset into database bval Bit mask to be ANDed with the byte at offset Description This function ANDs a byte in the database with a byte long bit mask adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle int offset unsigned char bval 0x55 ADM DBAND Byte adm handle offset bval Page 140 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBNAND Byte Syntax int ADM DBNAND Byte ADMHANDLE adm handle int offset unsigned char bval Parameters adm handle Handle returned by previous call to ADM Open offset Byte offset into database bval Bit mask to be NANDed with the byte at offset Description This function NANDs a byte in the database with a byte long bit mask adm handle m
59. ACE interface interface ptr amp interface ADM DAWriteSendData adm handle interface ptr app port ports app port len ports app port buff See Also ADM DAWriteRecvData page 106 ProSoft Technology Inc February 20 2013 Page 105 of 239 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DAWriteRecvData Syntax int ADM DAWriteRecvData ADMHANDLE adm handle ADM INTERFACE adm interface ptr int app port int length char data buff Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure which contains structure pointers needed by the function app port Application serial port referenced length The number of data characters to send to the data analyzer data buff The buffer holding the receive data Description This function sends receive data to the data analyzer screen The data will appear between two square brackets data adm handle must be a valid handle returned from ADM Open Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS adm handle does not have access Example ADMHANDLE adm handle ADM INTERFACE interface ptr ADM PORT ports MAX APP PORTS Int app port ADM INTERFACE interface interface ptr amp interface ADM DAWriteRecvData adm ha
60. ADPARAM Value of marker is not valid Example ADMHANDLE adm handle ADM INTERFACI interface ptr ADM INTERFACI interface interface ptr amp interface ADM DAWriteSendCtl adm handle interface ptr app port RTSON E EH See Also ADM DAWriteRecvCtl page 104 ProSoft Technology Inc Page 103 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DAWriteRecvCtl Syntax int ADM DAWriteRecvCtl ADMHANDLE adm handle ADM INTERFACE adm interface ptr int app port int marker Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure which contains structure pointers needed by the function app port Application serial port referenced marker Flow control symbol to output to the data analyzer screen Description This function may be used to send a receive flow control symbol to the data analyzer screen The control symbol will appear between two square brackets R R CS adm handle must be a valid handle returned from ADM Open Valid values for marker are RTSOFF R RTSON R CTSRCV CS Return Value MVI_SUCCESS No errors were encountered MVI ERR NOACCESS adm handle does not have access MVI ERR BADPARAM Value of marker is not va
61. API Communications essent 208 Page 8 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Contents C Programmable Network Interface Module for Quantum Developer Guide MVISp PUtGhi s iate ele lieet demie etu sleet isti 208 MVISpisGeIChis stesso n A IA A eter 209 MVISp Puts 25 d ele ate pel Oe ate e eM 210 MVIsp PutData o tee Op e RED Ee 212 MVISpiS 6IS ost a bd Add At aa Ske 214 MM IspeGetD ate ce eteatotu aedes en Lem eM eere doeet ue 216 MVIsp GetCountUnsent sss nennen nnne nennen nri nni sn nene erri n nsn trnr enne 218 MVIsp GetCountUnread sse entrent nens nnnr sn nenr enne s inrer inneren 219 MVlIsp PurgeDataUnsent eeeeessseeseseesseeeseeeee entree een NAER ERNA TNE nennen nns 220 MVIsp PurgeDataUnread eseesseesesesees seen nene een nhne nnn trn nnns nhne nnn nennen nes 221 11 5 Serial Port API Miscellaneous Functions eeseeeenneenen 222 MVIsp GetVersionlnfo essesssssssesssseseeeeee eee nnne einn a daaa a ai nsi aana daat 222 12 Product Specifications 228 12 1 General Specifications essssssssssssessseseee entente nnne nns 224 12 2 Hardware Specifications enne entes 225 12 3 Functional Specifications cccccccccceeceeeeeeceeeeeeeeceeeeeceaeeesaaeseeeeeseeeeeaeeseeeseeeeess 226 13 DOS 6 XL Ref
62. COM2 amp CharsLeft Keep checking until all characters sent while CharsLeft MVIsp GetCountUnsent COM2 amp CharsLeft Optional delay here depends on application Set RTS off MVIsp SetRTS COM2 OFF Page 62 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 8 Setting Up Your Development Environment In This Chapter Setting Up Your Compiler sese 64 Creating a ROM Disk Image eene 82 Downloading a ROM Disk Image eeen 84 PTQ System BIOS Setup seeseseeseeeeeeeeeenneen nennen 85 Transferring Files to and from the Module with HyperTerminal 87 Debugging Strategies esee 95 ProSoft Technology Inc Page 63 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 8 1 Setting Up Your Compiler There are some important compiler settings that must be set in order to successfully compile an application for the PTQ platforms The following topics describe the setup procedures for each of the supported compilers 8 1 1 Configuring Digital Mars C 8 49 The following procedure allows you to successfully build the sa
63. Config allows the configuration of a serial port to be changed after it has been opened comport specifies which port is to be opened baudrate is the desired baud rate Valid values for parity are PARITY NONE PARITY ODD PARITY EVEN PARITY MARK and PARITY SPACE wordlen sets the word length in number of bits per character Valid values for word length are WORDLEN5 WORDLEN6 WORDLEN7 and WORDLEN8 The number of stop bits is set by stopbits Valid values for stop bits are STOPBITS1 and STOPBITS2 Note If the console is enabled or the Setup jumper is installed the baud rate for COM1 is set as configured in BIOS Setup and cannot be changed by MVIsp Open MVIsp Config will return MVI SUCCESS but the baud rate will not be affected Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS Comport has not been opened MVI ERR BADPARAM Invalid pointer Example if MVIsp Config COMI BAUD 9600 PARITY NONE WORDLEN8 STOPBITS1 MVI SUCCESS printf Config failed Mn else printf Config succeeded An See Also MVIsp Open page 193 Page 198 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp SetHandshaking Syntax int MVIsp SetHandshaking int comport int shake Parameters comport Port for which handshaking is
64. Data page 212 Page 218 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp GetCountUnread Syntax int MVIsp GetCountUnread int comport int count Parameters comport Desired communications port count Pointer to int to receive unread character count Description MVIsp GetCountUnread returns the number of characters in the receive queue that are waiting to be read Since data received from a port is queued after reception from a serial port the application may need to determine if all characters have been read or how many characters remain to be read comport is the desired serial port and must be previously opened with MVIsp Open count points to an int that will receive the number of characters that have been received from the serial port but not read by the application If the returned count is 0 all received data has been read If it is non zero it contains the number of characters placed into the receive queue after reception from a serial port but that have not been read from the queue with MVIsp Getch MVIsp_ Gets or MVIsp GetData Return Value MVI SUCCESS Count retrieved successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer Example int count if MVIsp GetCountUnread COM2 amp count MVI SUCCESS if cou
65. E 113 ADM DBGl6aiBIit 5 155 n eroe enero e een deinde satis 114 ADMSDBGGSIByVIO estet diues Ls e eter teris ess 115 ADM DBSSIBVIG 2 3 netten duet ote MALE I EL eeu EE 116 ADMUDBGetW ores utet emnetoteiinteancitetette et tiet 117 ADM DBSeIWOLId 2 o nee M aoi eves an ice td edsctd utes PRU eaae ede NERO 118 ADM DBGeltLong e tede i e beer eder A De ge 119 ADM DBSetLong ede Ree pete dee tede bet edat epo ced 120 ADM BBGeltFloal 2 2 Jeden Ae MN eques i 121 ADMJ2DBSetFloat nusu ee eMIMNIas iis ciui i 122 ADM DBGetDFloat dee ee atid ie p eee edi bos e T Eee ced 123 ADM DBSeltDEF lo t dre Eee inde d e fb eee 124 ADM DBGeltBuft d te eel ea dice BR i E ee 125 ADM DBSetB lf ned d eee ee deep i diced eee 126 ADM DBGetR689S d te te lng i dice BR i E ee 127 ADM DBSetRegs ned aep cies ebd fenex tdi Det De oae eee 128 ADM DBGeltString cian dte ei dee e focos reditu Bs d a e Pepe cede 129 ADM DBSetString sincero daten dida e aee rt eb e eb eren 130 ADM DBSWapWYOIQ uiid ie EA eit oii tha tede ag edunt 131 ADMZDBSWAapDWhOTLd 4 tienen tate e eg etn ee tea ee ere eb E ert 132 ADM GetDBGptt iniret eedem thal n en raten red eve ied ens 133 ADM GetDBlpti i Eee Date i eR e tr aetate cete v eb irent 134 ADM GetBBlnt iint edendi tial e enn aie tal ined 135 ADM DBC hang d satan Man ada ice dae tia e e ee ea ee eh ed 136 ADM DBBitG hanged ss ibtd ende tial e enn ai
66. E handle int mode MVIbp GetSetupMode handle amp mode if mode Setup Jumper is installed perform configuration diagnostic else Not in Setup Mode normal operation ProSoft Technology Inc Page 187 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIbp GetProcessorStatus Syntax int MVIbp GetProcessorStatus MVIHANDLE handle WORD pstatus Parameters handle Handle returned by previous call to MVIbp Open pstatus Pointer to a word that will be updated with the current processor status Description This function is used to query the state of the processor handle must be a valid handle returned from MVIbp Open pstatus is a pointer to an word When this function returns certain bits in this word will be set to indicate the current processor status as shown in Figure 6 Processor Status Bits Bit Name Description 0 MVI PROCESSOR STATUS RUN Set if processor is in Run Mode 1 MVI DATA CONNECTION OPEN Set if data connection is open 2 MVI STATUS CONNECTION OPEN Setif status connection is open Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS handle does not have access MVI ERR BADCONFIG The data connection is not open Example MVIHANDLE handle WORD status MVIbp GetProcessorStatus handle amp status if status amp MVI PROCESSO
67. ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer MVI ERR TIMEOUT Timeout elapsed before bytes retrieved Example BYTE str 10 int nny nn 10 if MVIsp Gets COM1 amp str 0 Nr amp nn 1000L MVI SUCCESS printf d bytes were received n nn See Also MVIsp_Getch page 209 MVIsp Puts page 210 MVIsp PutData page 212 ProSoft Technology Inc Page 215 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp GetData Syntax int MVIsp GetData int comport BYTE data int len DWORD timeout Parameters comport Port from which data is to be received data Pointer to array of bytes to receive data len Number of bytes to receive bytes received timeout Amount of time to wait to receive character Description This function receives an array of bytes from a serial port comport must be previously opened with MVIsp Open data points to an array of bytes that will receive the data len points to the number of bytes to receive MVIsp GetData retrieves bytes from the reception queue until either the number of bytes pointed to by len are retrieved or the timeout elapses All data received from a port is queued after reception from the serial port Therefore some delay may occur between the time a character is received across the serial line and the time the
68. Example ADMHANDLE adm handle Set Status LED OK turn User LED 1 off and User LED 2 on ADM SetLed adm handle interface ptr ADM LED STATUS ADM LED OK ADM SetLed adm handle interface ptr ADM LED USER1 ADM LED OFF ADM SetLed adm handle interface ptr ADM LED USER2 ADM LED ON ProSoft Technology Inc Page 153 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 9 8 ADM API Miscellaneous Functions ADM GetVersionlnfo Syntax int ADM GetVersionInfo ADMHANDLE adm handle ADMVERSIONINFO adm verinfo Parameters adm handle Handle returned by previous call to ADM Open adm verinfo Pointer to structure of type ADMVERSIONINFO Description ADM GetVersionlnfo retrieves the current version of the ADM API library The information is returned in the structure adm verinfo adm handle must be a valid handle returned from ADM Open The ADMVERSIONINFO structure is defined as follows typedef struct char APISeries 4 short APIRevisionMajor short APIRevisionMinor long APIRun JADMVERSIONINFO Return Value ADM SUCCESS The version information was read successfully ADI ERR NOACCESS adm handle does not have access Example ADMHANDLE adm handle ADMVERSIONINFO verinfo print version of API library ADM GetV
69. If the timeout elapses before a character can be retrieved MVI ERR TIMEOUT is returned Return Value MVI SUCCESS A char was retrieved successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer MVI ERR TIMEOUT Timeout elapsed before character retrieved Example BYTE ch if MVIsp Getch COM1 amp ch 1000L MVI SUCCESS putch char ch See Also MVIsp PutCh page 208 MVIsp Gets page 214 ProSoft Technology Inc Page 209 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp Puts Syntax int MVIsp Puts int comport BYTE str BYTE term int len DWORD timeout Parameters comport Port to which data is to be sent str String of characters to be sent term Termination character of string len Pointer to BYTE to receive number of characters sent timeout Amount of time to wait to send character Description This function is used to transmit a string of characters across a serial port comport must be previously opened with MVIsp Open str is a pointer to an array of characters or is a string to be sent MVIsp Puts sends each char in the array str to the serial port until it encounters the termination character term Therefore the character array must end with the termination character The termination character is not sent to the seri
70. Inc February 20 2013 PTQ ADM C Programmable Support Service amp Warranty C Programmable Network Interface Module for Quantum Developer Guide 14 Support Service amp Warranty In This Chapter Contacting Technical Support ssssseeeneee 230 Warranty Information emen 231 ProSoft Technology Inc Page 229 of 239 February 20 2013 Support Service amp Warranty PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 14 4 Contacting Technical Support ProSoft Technology Inc ProSoft is committed to providing the most efficient and effective support possible Before calling please gather the following information to assist in expediting this process 1 Product Version Number 2 System architecture 3 Network details If the issue is hardware related we will also need information regarding Module configuration and associated ladder files if any Module operation and any unusual behavior Configuration Debug status information LED patterns Details about the serial Ethernet or fieldbus devices interfaced to the module if any akhOND Note For technical support calls within the United States an after hours answering system allows 24 hour 7 days a week pager access to one of our qualified Technical and or Application Support Engineers Detailed contact information for all our worldwide locations is available on the following page
71. Inc Page 117 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetWord Syntax int ADM DBSetWord ADMHANDLE adm handle unsigned short offset const short val Parameters adm handle Handle returned by previous call to ADM Open offset Word offset into database val Value to be written to the database Description This function writes a word to the database at a specified word offset adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const short val ADM DBSetWord adm handle offset val See Also ADM DBGetWord page 117 Page 118 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetLong Syntax long ADM DBGetLong ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open Offset Long int offset into database Description This function reads a long int from the database at a specified long int offset adm hand
72. M DBsSetString page 130 ProSoft Technology Inc Page 129 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetString Syntax int ADM DBSetString ADMHANDLE adm handle unsigned short offset const unsigned short maxcount char str Parameters adm handle Handle returned by previous call to ADM Open offset Character offset into database where the buffer starts maxcount Maximum number of characters to write str String buffer to copy string from Description This function copies a string to the database from a string buffer adm_handle must be a valid handle returned from ADM_Open Return Value ADM_SUCCESS No errors were encountered ADM_ERR_NOACCESS adm_handle does not have access ADM_ERR_MEMORY database is not allocated ADM_ERR_REG_RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const unsigned short maxcount char string buff ADM DBSetString adm handle offset maxcount str See Also ADM DBGetString page 129 Page 130 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBSwapWord Syntax int ADM DBSwapWord ADMHANDLE adm handle unsigned short offset Par
73. M Invalid pointer Example int state if MVIsp GetRTS COMI amp state MVI SUCCESS if state ON printf RTS is ON n else printf RTS is OFF n See Also MVIsp_SetRTS page 200 ProSoft Technology Inc Page 201 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp SetDTR Syntax int MVIsp SetDTR int comport int state Parameters comport Port for which DTR is to be changed state Desired state Description This function allows the state of the DTR signal to be controlled comport must be previously opened with MVIsp Open state is the desired state of the DTR signal Valid values for state are ON and OFF Note If DTR DSR handshaking is enabled changing the state of the DTR signal with MVIsp SetDTR will cause unpredictable results Return Value MVI SUCCESS The DTR signal was set successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid state Example if MVIsp SetDTR COM1 ON MVI SUCCESS printf Set DTR failed n See Also MVIsp GetDTR page 203 Page 202 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp GetDTR Syntax int MVIsp GetD
74. MHANDLE adm handle unsigned short offset const char val Parameters adm handle Handle returned by previous call to ADM Open offset Byte offset into database val Value to be written to the database Description This function writes a byte to the database at a specified byte offset adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const char val ADM DBSetByte adm handle offset val See Also ADM DBGetByte page 115 Page 116 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetWord Syntax int ADM DBGetWord ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open offset Word offset into database Description This function reads a word from the database at a specified word offset adm handle must be a valid handle returned from ADM Open Return Value Requested word Example ADMHANDLE adm handle unsigned short offset int i i ADM DBGetWord adm handle offset See Also ADM DBSetWord page 118 ProSoft Technology
75. NE MODBUSO1 1 After the build process is completed successfully the next step is to download the compiled project to the processor Page 40 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Unity Pro C Programmable Network Interface Module for Quantum Developer Guide 4 4 Connect Your PC to the Processor The next step is to connect to the processor so that you can download the project file The processor uses this project file to communicate over the backplane to modules identified in the project file Note If you have never connected from the PC to your processor before you must verify that the necessary port drivers are installed and available to Unity Pro To verify address and driver settings in Unity Pro 1 Open the PLC menu and choose STANDARD MODE This action turns off the PLC Simulator and allows you to communicate directly with the Quantum or Unity hardware EJ Debus Window Help Connect Ctrl K Set Address 5 Standard Mode B Simulation Mode Project Backup gt Memory Consumption 2 Open the PLC menu and choose SET ADDRESS This action opens the Set Address dialog box Open the MEDIA dropdown list and choose the connection type to use TCPIP or USB Set Address v PLC Smet imulator Bandwidth Address Address Test Connection 127 0 0 1 127 0 0 1 Media Media TCPIP TCPIP x Communication Parameters
76. ProSoff TECHNOLOGY Where Automation Connects 7 Prolalk PTQ ADM C Programmable C Programmable Network Interface Module for Quantum PROGRAMMABLE MODULES February 20 2013 DEVELOPER GUIDE Your Feedback Please We always want you to feel that you made the right decision to use our products If you have suggestions comments compliments or complaints about our products documentation or support please write or call us ProSoft Technology 5201 Truxtun Ave 3rd Floor Bakersfield CA 93309 1 661 716 5100 1 661 716 5101 Fax www prosoft technology com support prosoft technology com Copyright 2013 ProSoft Technology Inc all rights reserved PTQ ADM Developer Guide February 20 2013 ProSoft Technology ProLinx 9 inRAx 9 ProTalk 9 and RadioLinx are Registered Trademarks of ProSoft Technology Inc All other brand or product names are or may be trademarks of and are used to identify products and services of their respective owners In an effort to conserve paper ProSoft Technology no longer includes printed manuals with our product shipments User Manuals Datasheets Sample Ladder Files and Configuration Files are provided on the enclosed CD ROM and are available at no charge from our web site www prosoft technology com Content Disclaimer This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability of these product
77. ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp Getch Syntax int MVIsp Getch int comport BYTE ch DWORD timeout Parameters comport Port from which data is to be received ch Pointer to BYTE to receive character timeout Amount of time to wait to receive character Description This function receives a single character from a serial port comport must be previously opened with MVIsp Open ch points to a BYTE that will receive the character All data received from a port is queued after reception from the serial port Therefore some delay may occur between the time a character is received across the serial line and the time the character is returned by MVIsp Getch This function attempts to retrieve a character from the reception queue and return values correspond accordingly timeout specifies the amount of time in milliseconds to wait If timeout is TIMEOUT ASAP the function will return immediately if the queue is empty If timeout is TIMEOUT FOREVER the function will not return until a character is retrieved from the reception queue successfully If the reception queue is not empty the oldest character is retrieved from the queue and MVIsp Getch returns MVI SUCCESS If the queue is empty MVIsp Getch tries to retrieve a character from the queue until the timeout elapses
78. Quantum processor as shown in the following illustration Note You can use a Modbus Plus Network Option Module NOM Module module in place of the serial port if necessary 2 Open the PLC menu and then choose CONNECT 3 Inthe PLC Configuration dialog box open the ONLINE menu and then choose CONNECT This action opens the Connect to PLC dialog box Connect to PLC E x Protocol type Protocol settings Modbus Modbus Plus Mode Ee TCP IP PLC Node orn Device 9600 2 8 1 G IEC Simulator 32 b 001 cow x Port Settings amp ASCII Access Level List of nodes on Modbus Plus network Monitor only Change Data C Change Program Change Configuration Cancel 4 Leave the default settings as shown and click OK Note Click OK to dismiss any message boxes that appear during the connection process ProSoft Technology Inc Page 25 of 239 February 20 2013 Configuring the Processor with Concept Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum 5 In the PLC Configuration window open the ONLINE menu and then choose DOWNLOAD This action opens the Download Controller dialog box Download Controller je cleared All I ASCII message State RAM T Initial values only Extended memory Select parts to download then press Download Download Close Help x
79. R STATUS RUN Processor is in Run Mode else Processor is not in Run Mode or there is no connection Page 188 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide MVIbp Sleep Syntax int MVIbp Sleep MVIHANDLE handle WORD msdelay Parameters handle Handle returned by previous call to MVIbp Open msdelay Time in milliseconds to suspend task Description MVIbp Sleep suspends the calling thread for at least msdelay milliseconds The actual delay may be several milliseconds longer than msdelay due to system overhead and the system timer granularity bms Return Value MVI SUCCESS Success MVI ERR NOACCESS handle does not have access Example MVIHANDLE handle int timeout 200 Simple timeout loop while timeout Poll for data and so on Break if condition is met no timeout Else sleep a bit and try again MVIbp Sleep 10 ProSoft Technology Inc Page 189 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIbp SetConsoleMode Syntax int MVIbp SetConsoleMode MVIHANDLE handle int mode int baud Parameters handle Handle returned by previous call to MVIbp Open mode An integer that is set to 1 if the console
80. RFACE adm interface ptr Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to 2 structures Description This function sets the next write block number Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR NOTSUPPORTED Function is not supported on this platform Example ADMHANDLE adm handle ADM INTERFACE interface ptr ADM INTERFACE interface interface ptr amp interface ADM BtNext adm handle interface ptr See Also ADM BtOpen page 146 Page 148 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM ReadBtCfg Syntax int ADM ReadBtCfg ADMHANDLE adm handle ADM INTERFACE adm interface ptr int verbose Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to i structures verbose Switch to enable status messages to the debug port A 1 will enable messages and a 0 will disable the messages Description This function reads the module configuration from the processor The function will make a call to the function pointed to by interface process cfg ptr The user function can be
81. S executable in order to run on the PTQ platform 18 Click the Directories tab and fill in directory information as required by your project s directory structure Project Settings 19 If the fields are left blank then it is assumed that all of the files are in the same directory as the project file The output files will be placed in this directory as well Page 70 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 20 Click on the Build tab and choose the Compiler selection Confirm that the settings match those shown in the following screen Project Settings Code Generation Header Files Memory Models Code Optimizations Windows Prolog Epilog Output Warnings Debug Information Linker Packing amp Map File Definitions Segments Imports E ports Resource Compiler Make m m m IN a T LE w eo ee 21 Click Code Generation from the Topics field and ensure that the options match those shown in the following screen Code Generat Header Files Memory Models Code Optimizations Windows Prolog E pilog Output Warnings Debug Information Linker Packing amp Map File Definitions m IN MSN M NI m m M MN M I Segments Imports E ports T ProSoft Technology Inc Page 71 of 239
82. Set Value sr 7 Inthe PLC Configuration window open the TEMPLATES menu and then choose INSERT ADDRESSES This action opens the Insert addresses dialog box 8 Onthe nsert Adaresses dialog box enter the values shown in the following illustration and then click OK xl First Reference To Insert 400001 Last Reference To Insert 400010 Number of References to Insert id Display Format Dec m Cancel Help 9 Notice that the template populates the address range as shown in the following illustration Place your cursor as shown in the first blank address field below the addresses you just entered Place cursor here F RDE Template untitled Animation OFF ol xj Variable Name Data Type Address Value Page 28 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Concept C Programmable Network Interface Module for Quantum Developer Guide 10 Repeat steps 6 through 9 using the values in the following illustration xi First Reference To Insert 400020 Last Reference To Insert 400029 Number of References to Insert o Display Format Dec m OK Cancel Help 11 In the PLC Configuration window open the ONLINE menu and then choose ANIMATE This action opens the HDE Template dialog box with animated values in the Value field ES RDE Template untitled Animation ON a Inl xl Variable Name Data Type Address
83. TR int comport int state Parameters comport Port for which DTR is requested state Pointer to int for desired state Description This function allows the state of the DTR signal to be determined comport must be previously opened with MVIsp Open The current state of the DTR signal is copied to the int pointed to by state Return Values MVI SUCCESS The DTR state was read successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer Example int state if MVIsp GetDTR COMI1 amp state MVI SUCCESS if state ON printf DTR is ON n else printf DTR is OFF n See Also MVIsp SetDTR page 202 ProSoft Technology Inc Page 203 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp GetCTS Syntax int MVIsp GetCTS int comport int state Parameters comport Port for which CTS is requested state Pointer to int for desired state Description This function allows the state of the CTS signal to be determined comport must be previously opened with MVIsp Open The current state of the CTS signal is copied to the int pointed to by state Return Value MVI SUCCESS The CTS state was read successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer Example int state if MVIsp GetCTS COM1
84. TTTTTTTTTTTTTTITITITTTTTTTTTITI 5K of 6K Elapsed 00 00 01 Remaining Throughput When the file has been transferred to the module the dialog box will indicate that the transfer is complete Page 94 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 8 5 7 Uploading files from the ADM module to a PC In order to upload files from the module the ADM module s running program must be interrupted You must run the SY EXE program which uses the YModem protocol 1 In HyperTerminal connect to the module at 57600 baud and type the command to halt the program for example Esc or Ctrl C your application must be written to allow itself to exit to the command prompt on request 2 Atthe command prompt type C SY filename ext The filename and path must be in quotes File Edi View Cal Transfer Help D I 3 d Send File Receive File Capture Text Send Text File Capture to Printer 3 From the Transfer menu in HyperTerminal select Receive File This action opens the Receive File dialog box 4 Use the Browse button to choose a folder on your computer to save the file 5 Select Ymodem as the receiving protocol and then click the Receive button Receive File Place received file in the following folder Use receiving protocol Ymodem v Receive Close Ca
85. Time of Day 400007 Config Extensions ASCII Data Protection Disabled Number of Messages Peer Cop Disabled Message Area Size Hot Standby Disabled Nr wekuens ak Dasta n rl PLC Configuration Overview double click in window to edit sections NOT CONNECTED Page 22 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Configuring the Processor with Concept Developer Guide 2 This action opens the SPECIALS dialog box M I Battery Coil Ox Timer Register 4x I I Time Of Day 4x 400007 x aT 1536 1872 1865 I Allow Duplicate Coils LL984 only First Coil Address Ox Watchdog Timeout ms 10 30 a Online Editing Timeslice ms OK Cancel Help Selecting the Time of Day 1 Select check the Time of Day box and then enter the value 00001 as shown in the following illustration This value sets the first time of day register to 400001 xi Maximum Battery Coil of 1536 Timer Register 4x E 1872 IV Time Of Day 4x 00001 400008 1865 T Allow Duplicate Coils LL984 only First Coil Address Ox B a Watchdog Timeout ms 10 Online Editing Timeslice ms Cancel Help 2 Click OK to save your settings and close the Specials dialog box ProSoft Technology Inc February 20 2013 Page 23 of 239 Configuring
86. Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 4 Click OK The Project window appears Project BOE Pase View Trace EY Beadn si prj B MVIS6ADN Serial C C MADM TOOL Sbadm si DEF DEF C ADM_TOOL_ admapi h h C MDM TOOL cipapi h E C XADM TOOL MVISGADM Serial C ADM_TOOL_ mvibpapi h 4 C ADM_TOOL_ mviscapi h e C ADM_TOOL_ mvispapi h i C ADM_TOOL_ ADMAP LIB CIPAP LIB MVIBPAPI LIB MVISCAPI LIB MVISPAPI LIB 5 Click Project Rebuild All from the Main Menu to create the exe file The status of the build will appear in the Output window Output Bon Edit Stop setup module amp shut dow si LNK AMPI MVIS6 ADM SERIAL IN MVIBPAPI LIB util 1232576 Previous Definition Different Delay_x_1ms qus Error C XADM TOOL MVIXSAMPLESXMVISS SAMPLESMMVIS6 ADMNMVISB ADM SERIAL INXMVIBPAPI LIB util 1232576 Previous Definition Different GDelay x 10us qul ren X SCHS EXE 5badm si EXE M5badm si EXE built jLines Processed 3069 Errors 2 Warnings 0 Build failed d Porting Notes The Digital Mars compiler classifies duplicate library names as Level 1 Errors rather than warnings These errors will manifest themselves as Previous Definition Different function name Level 1 errors are non fatal and the executable will build and run The architecture of the ADM libraries will cause two or more of thes
87. WITCHED OFF OR THE AREA IS KNOWN TO BE NON HAZARDOUS AVERTISSEMENT RISQUE D EXPLOSION AVANT DE DECONNECTER L EQUIPEMENT COUPER LE COURANT OU S ASSURER QUE L EMPLACEMENT EST DESIGNE NON DANGEREUX Class Division 2 GPs A B C D I3 G Ex nA IIC X 0 C lt Ta lt 60 C I Equipment intended for above ground use not for use in mines 3 Category 3 equipment investigated for normal operation only G Equipment protected against explosive gasses Warnings North America Warnings A Warning Explosion Hazard Substitution of components may impair suitability for Class I Division 2 B Warning Explosion Hazard When in hazardous locations turn off power before replacing or rewiring modules Warning Explosion Hazard Do not disconnect equipment unless power has been switched off or the area is known to be non hazardous C Suitable for use in Class Division 2 Groups A B C and D Hazardous Locations or Non Hazardous Locations ATEX Warnings and Conditions of Safe Usage Power Input and Output I O wiring must be in accordance with the authority having jurisdiction A Warning Explosion Hazard When in hazardous locations turn off power before replacing or wiring modules B Warning Explosion Hazard Do not disconnect equipment unless power has been switched off or the area is known to be non hazardous C These products are intended to be mounted in an IP54 enclosure The devices shall provide external me
88. Writelnputlmage or MVIbpReadOutputlmage functions To enable the module to receive messages from the control processor via the MVIbp ReceiveMessage function the MsgRcvBufSize member should be set to the maximum message size expected Likewise to enable the module to send messages to the control processor via the MVIbp SendMessage function the MsgSndBufSize member should be set to the maximum message size expected The message sizes are expressed in words The combined maximum message size is 2048 words If the sum of MsgRcvBufSize and MsgSndBufSize exceeds 2048 the error MVI ERR BADCONFIG will be returned ProSoft Technology Inc Page 171 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Notes If messaging is enabled a portion of the input and output images must be reserved for use by the messaging protocol One word of input and one word of output is required for messaging control At least one additional word of input and or output is required for messaging data depending upon the messaging direction s enabled To receive messages from the control processor at least one word of output image is required for messaging data To send messages to the control processor at least one word of input image is required for messaging data Therefore for bi directional messaging at least two words of input and two words of output image must be
89. a the programming port PRT1 ProSoft Technology Inc Page 57 of 239 February 20 2013 Understanding the PTQ ADM API PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 7 3 Theory of Operation 7 3 1 ADM API The ADM API is one component of the PTQ ADM API Suite The ADM API provides a simple module level interface for the ProLinx MVI and PTQ Families This is useful when developing an application that implements a serial protocol for a particular device such as a scale or bar code reader After the application has been developed it can be used on any of the PTQ family modules 7 3 2 ADM API Architecture The ADM API is composed of a statically linked library called the ADM library Applications using the ADM API must be linked with the ADM library The ADM API encapsulates the hardware making it possible to design PTQ applications that can be run on any of the PTQ family of modules The following illustration shows the ADM API architecture Application ADM API BP or CIP API 7 3 3 PTQ Big I O Backplane Model Theory of Operation When the PLC has data to write to the PTQ module it will write to the backplane and pass the lock to the PTQ module The module program must call MVIbp ReadOutputlmage to see if data is available for reading If data is available the function will return MVI SUCCESS f not it will return MVI TIMEOUT The call to MVlbp ReadOutputlmage should
90. ab Tue Hep Dl ool 3 ola eel m Bios des e uti Hi v vw Lage C 1998 Gen al Sof Inc ights reserved i aM Module Fle sh i pda te o Mode Reset pad our on defaults vet i Carried 80100 ANS 10008241 num The PTQ module can be placed in a mode where it is waiting to receive a new flash image by selecting the Begin Flash ROM Update Mode option ProSoft Technology Inc Page 85 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Select PTQ Module Configuration to set the Console Console Baud Rate and Compact Flash mode The Console allows keyboard entry and text output to the debug port The baud rate of the console port is selected by the Console Baud Rate option In order to use a Compact Flash disk in the PTQ module the Compact Flash option must be set to CHS mode Prev Hypes Tosminol d Ed Ven Ca Tuis Heip pia e ol rel Ht Wit System BIOS Setup Custom Configuration i I C 1998 General Software Inc All rights reserved Ili Console on Port 1 Disabled Conpact Flash CHS Mode Console Baud Rate 115200 iii Hl Ht Hl Ml Wt Ht I CE W Tab to select or to modify i XEsc to return to main menu d Corrected 00003 ANS 10e NUM i Page
91. act cause of the error The corresponding error flag will be set for each error type detected Note The QSERR_OVERRUN bit indicates that a receive queue overflow has occurred After returning the bit flags in status line status errors are cleared Therefore MVIsp GetLineStatus actually returns line status errors detected since the previous call to this function Return Value MVI SUCCESS The line status was read successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer Example BYTE sts if MVIsp GetGetLineStatus COM2 amp sts MVI SUCCESS if sts 0 printf No Line Status Errors Received n else if sts amp LSERR BREAK 0 printf A Break Signal was Received n else printf A Line Status Error was Received n ProSoft Technology Inc Page 207 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 11 4 Serial Port API Communications MVIsp Putch Syntax int MVIsp Putch int comport BYTE ch DWORD timeout Parameters comport Port to which data is to be sent ch Character to be sent timeout Amount of time to wait to send character Description This function is used to transmit a single character across a serial port comport must be previously opened with MVIsp Open ch is the byte to be sent All data sen
92. ail if a message has not already been written by the application via MVIbp SendMessage ProSoft Technology Inc Page 179 of 239 February 20 2013 Backplane API Functions Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Send MSG Instruction Configuration Field Value Description Message Type CIP Generic Specify CIP message type Service Code OE Hex Get_Attribute_Single service Object Type 4 Assembly object class code Object ID 7 Output message instance number Object Attribute 3 Data attribute Num Elements Application dependent Size of message to be written Path Application dependent Path to PTQ module Return Value MVI_SUCCESS A message has been received MVI ERR NOACCESS handle does not have access MVI ERR TIMEOUT The timeout occurred before the message was transferred MVI ERR BADPARAM A parameter is invalid MVI ERR BADCONFIG Send messaging is not enabled Example MVIHANDLE Handle int re WORD buffer 256 Wait 5 seconds for the message to be sent rc MVIbp SendMessage Handle buffer 256 5000 if rc MVI_SUCCESS printf Message sentin See Also MVIbp SetlOConfig MVIbp ReceiveMes page 171 sage page 177 Page 180 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Inter
93. al port All data sent to a port is queued before transmission across the serial port Therefore some delay may occur between the time this function returns and the actual time that the characters are transmitted across the serial line This function attempts to insert the characters into the transmission queue and return values correspond accordingly timeout specifies the amount of time in milliseconds to wait If timeout is TIMEOUT ASAP the function will return immediately if any of the characters cannot be queued immediately If timeout is TIMEOUT FOREVER the function will not return until all the characters are queued successfully If all the characters can be queued immediately MVIsp Puts returns MVI SUCCESS If the characters cannot be queued immediately MVIsp Puts tries to queue the characters until the timeout elapses If the timeout elapses before the characters can be queued MVI ERR TIMEOUT is returned If len is not NULL MVIsp Puts writes to the int pointed to by len the number of characters queued successfully len is written for successfully sent characters as well as timeouts Note If handshaking is enabled and the receiving serial device has paused transmission timeouts may occur after the queue becomes full Page 210 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide Return V
94. ally and can truncate the unused portion of the disk In addition WINIMAGE will de fragment a disk image so that files may be deleted and added to the image without resulting in wasted space To install WINIMAGE unzip the winima40 zip file in a subdirectory on your PC running Win9x or NT 4 0 To start WINIMAGE run WINIMAGE EXE Follow these steps to build a disk image 1 Start WINIMAGE 2 Select File New and choose a disk format as shown in the following diagram Any format will do as long as it is large enough to contain your files The default is 1 44Mb which is fine for our purposes Click on OK Diskette Format x r Format Standard format C 160KB C 180KB C 320KB C 360KB C 720KB C 268MB Non standard format C 820KB C 1 72MB C 1 68MB C DMF cluster 1024 C DMF cluster 2048 Cancel 3 Drag and drop the files you want in your image to the WINIMAGE window Page 82 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 4 Click on Options Settings and make sure the Truncate unused image part option is selected as shown in the following figure Click on OK Settings x Disk Image Extract File Notification General Iv Truncate unused image part Use incremented open save wizard Iv Verify disk contents before writing
95. alue MVI SUCCESS The characters were sent successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid parameter MVI ERR TIMEOUT Timeout elapsed before characters sent Example char str Hello World int nn if MVIsp Puts COMI1 str O amp nn 1000L MVI SUCCESS printf Sd characters were sent Mn nn See Also MVIsp Gets page 214 MVIsp PutCh page 208 MVIsp PutData page 212 ProSoft Technology Inc Page 211 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp PutData Syntax int MVIsp PutData int comport BYTE data int len DWORD timeout Parameters comport Port to which data is to be sent data Pointer to array of bytes to be sent len Pointer to number of bytes to send bytes sent timeout Amount of time to wait to send byte Description This function is used to transmit an array of bytes across a serial port comport must be previously opened with MVIsp Open data is a pointer to an array of bytes to be sent MVIsp PutData sends each byte in the array data to the serial port len should point to the number of bytes in the array data to be sent All data sent to a port is queued before transmission across the serial port Therefore some delay may occur between the time this function returns and the actual time that t
96. ameters adm handle Handle returned by previous call to ADM Open offset Word offset into database where swapping is to be performed Description This function swaps bytes within a database word adm handle must be a valid h Return Value andle returned from ADM Open ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset ADM DBSwapWord adm handle offset ProSoft Technology Inc February 20 2013 Page 131 of 239 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSwapDWord Syntax int ADM DBSwapDWord ADMHANDLE adm handle unsigned short offset int type Parameters adm handle Handle returned by previous call to ADM Open offset long offset into database where swapping is to be performed type If type 3 then bytes will be swapped in pairs within the long Description This function swaps bytes within a database long word adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsign
97. ans to prevent the rated voltage being exceeded by transient disturbances of more than 4096 This device must be used only with ATEX certified backplanes D DO NOT OPEN WHEN ENERGIZED Electrical Ratings Backplane Current Load 1100 mA maximum 9 5 Vdc 5 Operating Temperature 0 C to 60 C 32 F to 140 F Storage Temperature 40 C to 85 C 40 F to 185 F Shock 30 g operational 50 g non operational Vibration 5 g from 10 to 150 Hz Relative Humidity 5 to 95 without condensation All phase conductor sizes must be at least 1 3 mm squared and all earth ground conductors must be at least 4mm squared Markings CSA cUL CSA CB Certified ATEX 243333 Important Notice C22 2 No 213 1987 IEC61010 EN60079 0 Category 3 Zone 2 EN60079 15 C A CAUTION THE CELL USED IN THIS DEVICE MAY PRESENT A FIRE OR CHEMICAL BURN HAZARD IF MISTREATED DO NOT DISASSEMBLE HEAT ABOVE 100 C 212 F OR INCINERATE Maximum battery load 200 pA Maximum battery charge voltage 3 4 VDC Maximum battery charge current 500 pA Maximum battery discharge current 30 pA PTQ ADM C Programmable Contents C Programmable Network Interface Module for Quantum Developer Guide Contents Your Feedback Please tete e regie ete ett ee n ii re n e EE ATA pe y Eta n 2 Content Disclaitmet 2 eot e eb ie et Pme ehe aee Pone era v beta 2 Information for ProTalk Product Users tette tentent tentent 3
98. antum Developer Guide MVIsp OpenAIt Syntax int MVIsp OpenAlt int comport MVISPALTSETUP altsetup Parameters comport Communications port to open altsetup pointer to structure of type MVISPALTSETUP Description MVIsp OpenAIt provides an alternate method to acquire access to a communications port With MVIsp_OpenAlt the sizes of the serial port data queues can be set by the application See MVIsp Open for any considerations about opening a port Comport specifies which port is to be opened See MVIsp Open for valid values Altsetup points to a MVISPALTSETUP structure that contains the configuration information for the port The MVISPALTSETUP structure is defined as follows typedef struct tagMVISPALTSETUP BYTE baudrate BYTE parity BYTE wordlen BYTE stopbits int txquesize Transmit queue size int rxquesize Receive queue size BYTE fifosize UART Internal FIFO size MVISPALTSETUP See MVIsp Open for valid values for the baudrate parity wordlen and stopbits members of the structure The txquesize and rxquesize members determine the size of the data buffers used to queue serial data Valid values for the queue sizes can be any value from MINQSIZE to MAXQSIZE The MVIsp_Open function uses a queue size of DEFQSIZE These values are defined as define MINOSIZE 512 Minimum Queue Size define DEFQSIZE 1024 Default Queue Size define MAXOSIZE 16384
99. artTimer using a different variable for each timer adm handle must be a valid handle returned from ADM Open Return Value Current time value from millisecond clock Example Initialize 2 timers ADMHANDLE adm handle unsigned short timerl unsigned short timer2 timerl ADM StartTimer adm handle timer2 ADM StartTimer adm handle See Also ADM_CheckTimer page 145 Page 144 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM CheckTimer Syntax int ADM CheckTimer ADMHANDLE adm handle unsigned short adm tmlast long adm tmout Parameters adm handle Handle returned by previous call to ADM Open adm tmlast Starting time of timer returned from call to ADM StartTimer adm tmout Timeout value in microseconds Description ADM CheckTimer checks a timer for a timeout condition Each time the function is called ADM CheckTimer updates the current timer value in adm tmlast and the time remaining until timeout in adm tmout If adm tmoutis less than 0 then a 1 is returned to indicate a timeout condition If the timer has not expired a 0 will be returned adm handle must be a valid handle returned from ADM Open Return Value Timer not expired Timer expired Example Check 2 timers ADMHANDLE adm handle unsigned short timerl unsigned shor
100. at ADM DBGetFloat ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open offset float offset into database Description This function reads a floating point number from the database at a specified float offset adm handle must be a valid handle returned from ADM Open Return Value Requested floating point number Example ADMHANDLE adm handle unsigned short offset float f f ADM DBGetFloat adm handle offset See Also ADM DBSetFloat page 122 ProSoft Technology Inc Page 121 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetFloat Syntax int ADM DBSetFloat ADMHANDLE adm handle unsigned short offset const float val Parameters adm handle Handle returned by previous call to ADM Open offset float offset into database val Value to be written to the database Description This function writes a floating point number to the database at a specified float offset adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const float val ADM DBSetFloat a
101. ata received from a port is queued after reception from the serial port Therefore some delay may occur between the time a character is received across the serial line and the time the character is returned by MVIsp Gets This function attempts to retrieve characters from the reception queue and return values correspond accordingly timeout specifies the amount of time in milliseconds to wait If timeout is TIMEOUT ASAP the function will return immediately if the queue is empty If timeout is TIMEOUT FOREVER the function will not return until an array of bytes is retrieved from the reception queue successfully If the timeout elapses before the termination character or len bytes are received MVI ERR TIMEOUT is returned When MVIsp_ Gets returns it writes to the int pointed to by len the number of bytes retrieved len is written for successfully retrieved bytes as well as timeouts If the function returns because a termination character was retrieved len includes the termination character in the length Note If handshaking is enabled and the reception queue is full this API may pause transmissions from the external device and timeouts may then occur Page 214 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide Return Value MVI SUCCESS Bytes were retrieved successfully MVI
102. atabase byte ADM DBAND Byte AND a byte with a database byte ADM DBNAND Byte NAND a byte with a database byte ADM DBXOR Byte Exclusive OR a byte with a database byte ADM DBXNOR Byte Exclusive NOR a byte with a database byte Timer ADM StartTimer Initialize a timer ADM CheckTimer Check current timer value Backplane ADM BtOpen Opens and initializes backplane interface ADM BtClose Closes backplane interface ADM BtNext Sets next write block number ADM ReaaBtCfg Reads configuration from the processor ADM BtFunc Handles backplane transfers ADM SetStatus Writes status to Error Status table ADM SetBtStatus Writes status to processor LED ADM SetLed Turn user LED indicators on or off Flash ADM FileGetString Searches for a string in a config file ADM FileGetlnt Searches for an integer in a config file ADM FileGetChar Searches for a char in a config file ADM GetVal Gets an integer from a buffer ADM GetStr Gets a string from a buffer ADM Getc Gets a char from a buffer ADM SkipToNext Skips white space Miscellaneous ADM GetVersionlnfo Get the ADM API version information ADM SetConsolePort Enable the console on a port ADM SetConsoleSpeed Set the console port baud rate RAM ADM EEPROM ReadConfiguration Read configuration file ADM RAM Find Section Find section in the configuration file ADM RAM GetsString Get String under topic name ADM RAM Getlnt Get Integer under top
103. ated and reparsed 28 Click Project Build All from the Main Menu ProSoft Technology Inc Page 73 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 29 When complete the build results will appear in the Output window Edit Stop sc MVI56 ADM SERIAL OUT MYIS6A0M SerialOut c p ml o cnp o cp otda o dc o dv otcse otli otliv o loop otreg otvbe 3 al Nc c 0 M IS6 ADM SERIAL OUT MVIS6ADM SerialOut link PACKD 8192 PAC 8192 DO PACKF XN B5badm so LNK Error C XADM TOOL MVIXSAMPLESXMVISS SAMPLESNMVIS6 ADMNMVISS ADM SERIAL INN NMVIS6 ADM SERIAL OUTMMVIBPAPI LIB util Previous Definition Different BDelay x 1ms qus Error C ADM_ITOOL_MVI SAMPLES MVI56 SAMPLES MV1S6 ADM MVIS6 ADM SERIAL IN MVIS6 ADM SERIAL OUT MVIBPAPI LIB util Previous Definition Different BDelay x 10us qul Uren SCHS EXE S6adm so EXE X56adm so EXE built Lines Processed 3108 Errors 2 Warnings 0 ET failed E Jj The executable file will be located in the directory listed in the Compiler Output Directory box of the Directories tab that is C ADM_TOOL_PTQ SAMPLES The Project Settings window can be accessed by clicking Project gt Settings from the Main Menu Porting Notes The Digital Mars compiler classifies duplicate library names as Level 1 Errors rather than warnings
104. ation ports independently allowing maximum flexibility in the design ProSoft Technology Inc Page 223 of 239 February 20 2013 Product Specifications PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 12 1 General Specifications Single Slot Quantum backplane compatible The module is recognized as an Options module and has access to PLC memory for data transfer Configuration data is stored in non volatile memory in the ProTalk module Up to six modules can be placed in a rack Local rack The module must be placed in the same rack as processor Compatible with all common Quantum programming packages including Concept version 2 6 or higher Unity Pro version 2 2 or higher ProWORX version 2 20 or later and ModSoft Quantum data types supported 3x 4x High speed data transfer across backplane provides quick data update times Sample ladder file available Page 224 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Product Specifications C Programmable Network Interface Module for Quantum Developer Guide 12 2 Hardware Specifications Specification Value Backplane Current Load 1100 mA maximum 9 5 Vdc 596 Operating Temperature 0 C to 60 C 32 F to 140 F Storage Temperature 40 C to 85 C 40 F to 185 F Relative Humidity 5 to 95 without condensation Vibration Sine vibratio
105. ator On or Off respectively Return Value MVI SUCCESS The input scan has occurred MVI ERR NOACCESS handle does not have access MVI ERR BADPARAM lednum or ledstate is invalid Example MVIHANDLE Handle Turn User LED 1 on and User LED 2 off MVIbp SetUserLED Handle MVI LED USER1 MVI LED STATE ON MVIbp SetUserLED Handle MVI LED USER2 MVI LED STATE OFF Page 184 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide MVIbp SetModuleStatus Syntax int MVIbp SetModuleStatus MVIHANDLE handle int status Parameters handle Handle returned by previous call to MVIbp Open status Module status OK or Faulted Description MVIbp SetModuleStatus allows an application set the state of the module to OK or Faulted handle must be a valid handle returned from MVIbp Open state must be set to MVI MODULE STATUS OK or MVI MODULE STATUS FAULTED If the state is OK the module status LED indicator will be set to Green If the state is Faulted the status indicator will be set to Red Note The MVI hardware can set the OK LED to Red if any of the following occurs anunrecoverable fault hardware failure backplane driver failure Neither the PTQ hardware nor the Set ModuleStatus call has priority Eithe
106. c February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBZero Syntax int ADM DBZero ADMHANDLE adm handle Parameters adm handle Handle returned by previous call to ADM Open Description This function writes zeros to a database previously created by ADM DBOpen adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated Example ADMHANDLE adm handle ADM DBZero adm handle See Also ADM DBOpen page 109 ProSoft Technology Inc Page 111 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBGetBit Syntax int ADM DBGetBit ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open offset Bit offset into database Description This function reads a bit from the database at a specified bit offset adm handle must be a valid handle returned from ADM Open Return Value Requested bit ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsig
107. ccording to functionality as follows ProSoft Technology Inc February 20 2013 Page 165 of 239 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Initialization MVIbp Open MVIbp Close Configuration MVIbp GetlOConfig MVIbp SetlOConfig Synchronization MVIbp WaitForlnputScan MVIbp WaitForOutputScan Direct I O Access MVIbp ReadOutputlmage MVIbp Writelnputlmage Messaging MVIbp ReceiveMessage MVIbp SendMessage Miscellaneous MVIbp GetVersionlInfo MVIbp ErrorString MVIbp SetUserLED MVIbp SetModuleStatus MVIbp GetSetupMode MVIbp GetConsoleMode MVIbp SetConsoleMode MVIbp GetModulelnfo MVIbp GetProcessorStatus MVIbp Sleep Platform Specific MVIbp WriteModuleFile MVIbp ReadModuleFile MVIbp SetModulelnterrupt Page 166 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide 10 1 Backplane API Initialization Functions MVIbp Open Syntax int MVIbp Open MVIHANDLE handle Parameters handle Pointer to variable of type MVIHANDLE Description MVIbp Open acquires access to the API and sets handle to a unique ID that the application uses in subsequent functions This function must be called before any of the other API functions can be used IMPORTANT After the API has been opened MVIbp Close
108. ce Module for Quantum Developer Guide MVIbp ErrorString Syntax int MVIbp ErrorString int errcode char buf Parameters errcode Error code returned from an API function buf Pointer to user buffer to receive message Description MVIbp ErrorStr returns a text error message associated with the error code errcode The null terminated error message is copied into the buffer specified by buf The buffer should be at least 80 characters in length Return Value MVI SUCCESS Message returned in buf MVI ERR BADPARAM Unknown error code Example char buf 80 int rc print error message MVIbp ErrorString rc buf printf Error s buf ProSoft Technology Inc Page 183 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIbp SetUserLED Syntax int MVIbp SetUserLED MVIHANDLE handle int lednum int ledstate Parameters handle Handle returned by previous call to MVIbp Open lednum Specifies which of the user LED indicators is being addressed Description MVIbp SetUserLED allows an application to turn the user LED indicators on and off handle must be a valid handle returned from MVlIbp Open lednum must be set to MVI LED USER 1 or MVI LED USERe to select User LED 1 or User LED 2 respectively ledstate must be set to MVI LED STATE ON or MVI LED STATE OFF to turn the indic
109. ce ptr int pass cnt ADM INTERFACE interface interface ptr amp interface ADM SetBtStatus adm handle interface ptr interface pass cnt See Also ADM SetStatus page 151 Page 152 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide 9 7 ADM LED Functions ADM SetLed Syntax int ADM SetLed ADMHANDLE adm handle ADM INTERFACE adm interface ptr int led int state Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to the interface structure led Specifies which of the user LED indicators is being addressed state Specifies whether the LED will be turned on or off Description ADM SetLed allows an application to turn the user LED indicators on and off adm handle must be a valid handle returned from ADM Open led must be set to ADM LED USER1 ADM LED USER 2 or ADM LED STATUS for User LED 1 User LED 2 or Status LED respectively state must be set to ADM LED OK ADM LED FAULT to turn the Status LED green or red respectively For User LED 1 and User LED 2 state must be set to ADM LED OFF or ADM LED ON to turn the indicator On or Off respectively Return Value ADM SUCCESS The LED has successfully been set ADM ERR NOACCESS adm handle does not have access ADM ERR BADPARAM led or state is invalid
110. ch to begin writing length Number of words to write Description MVIbp Writelnputlmage writes to the module s input image handle must be a valid handle returned from MVIbp Open buffer must point to a buffer of at least length words in size offset specifies the word in the input image to begin writing and length specifies the number of words to write The error MVI ERR BADPARAM will be returned if an attempt is made to access the input image beyond the range configured for direct I O If this error is returned no data will be written to the input image Refer to the MViIbp SetlOConfig function for more information The input image is written by the module and read by the control processor Return Value MVI SUCCESS The data was written to the input image successfully MVI ERR NOACCESS handle does not have access MVI ERR BADPARAM Parameter contains invalid value MVI ERR BADCONFIG The data connection is not open Example MVIHANDLE Handle WORD buffer 2 int rc Write 2 words of data to the input image starting with word 0 rc MVIbp WriteInputImage Handle buffer 0 2 if rc MVI SUCCESS printf ERROR MVIbp WriteInputImage failed See Also MVIbp SetlOConfig page 171 MVIbp ReadOutputlmage page 175 Page 176 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Dev
111. chnology Inc February 20 2013 PTQ ADM C Programmable Start Here C Programmable Network Interface Module for Quantum Developer Guide Select the files that go with the Concept version you are using and then click OK This action opens the Add New Modules dialog box ii Concept Module Installation E o xj Fie Modules Help Installed parre n Add New Modules E x P Available Modules in ptq_2_60 mde 5 Click the ADD ALL button A series of message boxes may appear during this process Click YES or OK for each message that appears 6 When the process is complete open the FILE menu and choose EXIT to save your changes ProSoft Technology Inc Page 15 of 239 February 20 2013 Start Here PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 16 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Concept C Programmable Network Interface Module for Quantum Developer Guide 2 Configuring the Processor with Concept In This Chapter Create a New Project sessssesseseeeeeeennnee nennen nennen rens 18 Add the PTQ Module to the Project seen 20 Set up Data Memory in Project eseeem 22 Download the Project to the Processor see 24 Verify Successful Download sesesseeeeeenenenene 27 The
112. ci testinal atid diets dece tere need tede pre a aa deo fepe epia ian 171 10 3 Backplane API Synchronization Functions sese 173 MVIbp WaitForlnputScan ssssssesseseseeee ener nneren nennen stern sn treten ness rnnt nns n tenens 173 MVIbp WaitForOutputScan ssssessssssssseeeene entente nnns en tent enne nnns n nnne nennen 174 10 4 Backplane API Direct I O Access ssssssssseeeeeenneee nennen 175 MVIbp ReadOutputlmage sss eene trnt innen nnn sitter tenens 175 MVIbp Writelnputlmage seessseeeeeeneeeneneneennnnennenn nnne nennen nn nennen nennen nn nennt 176 10 5 Backplane API Messaging Functions seen 177 MVIbp ReceiveMessage eeessseesseeseseseeeeeseeen eee nnne nn nnnm r enne nnne nnne tr etse trennen 177 MVIbp SendMessage ssssssssseseseees seen apaan ien aia e htt enne senis innen ntes 179 10 6 Backplane API Miscellaneous Functions eseeeeen 181 MVIbp GetVersionlnfO iicet tente ette reb teer p t ate 181 MV lbp GetModu lelnfo iret Prem nebenbei eee eere ie He dH an eet 182 MV Ibp ErrorStrihg nieht edente tbe ain ette be ted er pb t arte eat 183 MV lbp SetUS6rLED tine en bete iter te e dee Peers pn Er art eet 184 MV lbp SetModt leStatus edt tene tbt eden b ertt ata dada ere P ER d exa eat 185 MVIbp GetConsoleMode ssssssesssesss
113. cluded after the connection is established Consumer A destination for data Controller The PLC or other controlling processor that communicates with the module directly over the backplane or via a network or remote I O adapter D DLL Dynamic Linked Library ProSoft Technology Inc Page 233 of 239 February 20 2013 Glossary of Terms PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum E Embedded I O Refers to any I O which may reside on a CAM board ExplicitMsg An asynchronous message sent for information purposes to a node from the scanner H HSC High Speed Counter Input Image Refers to a contiguous block of data that is written by the module application and read by the controller The input image is read by the controller once each scan Also referred to as the input file Library Refers to the library file containing the API functions The library must be linked with the developer s application code to create the final executable program Linked Library Dynamically Linked Library See Library Local I O Refers to any I O contained on the CPC base unit or mezzanine board Long 32 bit value Module Refers to a module attached to the backplane Mutex A system object which is used to provide mutually exclusive access to a resource MVI Suite The MVI suite consists of line products for the following platforms Flex I O ControlLogix SLC
114. code is returned Example ADMHANDLE adm handle RFACFE ADM INTE int verbose ADM INT ERFACE interface ptr 1 interface interface ptr amp interface ADM BtOpen adm handle interface ptr verbose See Also ADM BtClose page 147 Page 146 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM BtClose Syntax int ADM BtClose ADMHANDLE adm handle ADM INTERFACE adm interface ptr Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to E E structures Description This function closes the backplane interface Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access Example ADMHANDLE adm handle ADM INTERFACI interface ptr ADM INTERFACI interface interface ptr amp interface ADM BtClose adm handle interface ptr EE See Also ADM_BtOpen page 146 ProSoft Technology Inc Page 147 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM BtNext Syntax int ADM BtNext ADMHANDLE adm handle ADM INTE
115. dge Base PTQ 101S 0 m M Rack 02 ead 2 Distributed E3 Properties Drop 01 Module PTQ 101S Drop Series Quantum Series 2 Description 1EC 60870 5 101 Slave Module Hold Up Time 3 lt ux Power Rating 800 m Rack 1 R Rack 2 LiProjects SB Utiles Status Reaister 3x Documents Pan I lt i amp Input Points 0000 1024 zl TIBAFTESTTEST C Edt Summay Traffic Cop mbol zl Rack Slot ProWORX 32 Tracking Help pos hos hs f sz Welcome to the Tracking Help Here you will find relevant information that Short Comments directly pertains to the current instruction or 1 0 module being accessed v APES EVES AVENE BMI SSE ORTA MU SI Ree CAM SENSED Gea teles CREE CIO r Tracking Help I Message Central J Logged in user N A PROGRAM SAFTESTTEST Quantum 534 TCPIP 192168 0 139 gt Offine ProSoft Technology Inc Page 33 of 239 February 20 2013 Configuring the Processor with ProWORX PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 34 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with Unity Pro C Programmable Network Interface Module for Quantum Developer Guide 4 Configuring the Processor with Unity Pro In This Chapter Create a New Project s
116. dm handle offset val See Also ADM DBGetFloat page 121 Page 122 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetDFloat Syntax double ADM DBGetDFloat ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open offset double float offset into database Description This function reads a double floating point number from the database at a specified double float offset adm handle must be a valid handle returned from ADM Open Return Value Requested double floating point number Example ADMHANDLE adm handle unsigned short offset double d d ADM DBGetDFloat adm handle offset See Also ADM DBSetDFloat page 124 ProSoft Technology Inc Page 123 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetDFloat Syntax int ADM DBSetDFloat ADMHANDLE adm handle unsigned short offset const double val Parameters adm handle Handle returned by previous call to ADM Open offset double float offset into database val Value to be written to the database Description This function writes a double floating point number to the database at a specified double float
117. dule for Quantum 9 1 ADM API Functions This section provides detailed programming information for each of the ADM API library functions The calling convention for each API function is shown in C format API library routines are categorized according to functionality Function Function Name Description Category Initialization ADM Open Initialize access to the API ADMClose Terminate access to the API Debug Port ADM_ProcessDebug Debug port user interface ADM DAWriteSendCtl Writes a data analyzer Tx control symbol ADM DAWriteRecvCtl Writes a data analyzer Rx control symbol ADM DAWriteSendData Writes a data analyzer Tx data byte ADM DAWriteRecvData Writes a data analyzer Rx data byte ADM ConPrint Outputs characters to Debug port ADM CheckDBPort Checks for character input on Debug port Database ADM DBOpen Initializes database ADM DBClose Closes database ADM DBZero Zeros database ADM DBGetBit Read a bit from the database ADM DBSetBit Write a 1 to a bit to the database ADM DBClearBit Write a 0 to a bit to the database ADM_DBGetByte Read a byte from the database ADM_DBSetByte Write a byte to the database ADM_DBGetWord Read a word from the database ADM_DBSetWord Write a word to the database ADM_DBGetLong Read a double word from the database ADM_DBSetLong Write a double word to the database ADM DBGetFloat Read a floating
118. dule for Quantum Developer Guide ADM Get BP Data Exchange Syntax void ADM Get BP Data Exchange ADMHANDLE adm handle Parameters adm handle Handle returned by previous call to ADM Open Description ADM Get BP Data Exchange read the whole Backplane Data Exchange section and load all variable for communication between Quantum PLC and module Return Value None Example ADM Get BP Data Exchange adm handle ProSoft Technology Inc Page 163 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 164 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Backplane API Functions Developer Guide 10 Backplane API Functions In This Chapter Backplane API Initialization Functions Backplane API Configuration FUNCTIONS eeeeeeeee Backplane API Synchronization Functions Backplane API Direct I O Access cceecceeeeeeeneeeeeeeteneeeeeeteeeeeaeetias Backplane API Messaging Functions eeeee Backplane API Miscellaneous Functions This section provides detailed programming information for each of the API library functions The calling convention for each API function is shown in C format The API library routines are categorized a
119. e Syntax int MVIsp Close int comport Parameters comport Port to close Description This function is used by an application to release control of the a communications port comport must be previously opened with MVIsp Open comport specifies which port is to be closed The valid values for the module are COM corresponds to PRT1 COM2 corresponds to PRT2 and COM3 corresponds to PRT3 The handshake lines DTR and RTS of the port specified by comport are turned off by MVIsp Close IMPORTANT After the API has been opened this function should always be called before exiting the application Return Value MVI SUCCESS Port was closed successfully MVI ERR NOACCESS Comport has not been opened Example MVIsp Close COM1 See Also MVIsp Open page 193 ProSoft Technology Inc Page 197 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 11 2 Serial Port API Configuration Functions MVIsp Config Syntax int MVIsp Config int comport BYTE baudrate BYTE parity BYTE wordlen BYTE stopbits Parameters comport Communications port to open baudrate Baud rate for this port parity Parity setting for this port wordlen Number of bits for each character stopbits Number of stop bits for each character baudrate Pointer to DWORD to receive baudrate Description MVIsp
120. e Contents ProTalk Module Null Modem Serial Cable Q E EE X E r X 0 1454 9F DB 9 Female to 9 Pos Screw Terminal adapter Serial protocol modules only ProSoft Solutions CD Note The DB 9 Female to 5 Pos Screw Terminal adapter is not required on Ethernet modules and is therefore not included in the carton with these types of modules Quantum Hardware This guide assumes that you are familiar with the installation and setup of the Quantum hardware The following should be installed configured and powered up before proceeding Quantum Processor Quantum rack Quantum power supply Quantum Modbus Plus Network Option Module NOM Module optional Quantum to PC programming hardware NOM Ethernet or Serial connection to PC Page 12 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Start Here C Programmable Network Interface Module for Quantum Developer Guide PC and PC Software Windows based PC with at least one COM port Quantum programming software installed on machine Or Concept PLC Programming Software version 2 6 Or ProWORX PLC Programming Software Or Unity Pro PLC Programming Software Note ProTalk modules are compatible with common Quantum programming applications including Concept and Unity Pro For all other programming applications please contact technical support 1 1 2 Recommended Compact Flash CF Ca
121. e eal eel iad 137 ADM DBOR Byte 5 inten i i een tia ete ee ea ee etd 138 ADM DBNORCBytO uiii eder hatten thal n aria ai in all indies 139 ADM DBAND Byte satan fae iat ca En Pre tial nan tbt en evo t 140 ADMUDBNAND Byte 5 3 m ice pe ete Seed e Oe e Ege ee lan sia eae ee 141 ADM DBXOR ZBVyItO6 tecti ett ihe Poe Rd EE pee ened ie Eae ence Erin dedos 142 ADM DBXNOR Byte 3 x tente a eei lated d ed OR e ERE pee th tinea D E dev ee deus 143 9 5 ADM API Clock Functions sess nnns 144 ADM Mei Ia IMITARI TRUE 144 ADM Check Timok nania orto iere cort temet ro Ero De eria e ra ree Ped Der rer eie a ra rie IET 145 9 6 ADM API Backplane Functions esseeeeeenenennnenen nennen 146 ADM BIOp6n diet iae eade mto obe ave hime ep DE paene dea Det aaa darte ert lh 146 ADMSBIGIOSG 5 setestarescci sce tese Teri tise cease satasces de let ge EINER Ede seater E A E E a A IUE 147 BUM m R bedi 148 bres 149 PEMEX bodes 150 ADM SelSIallS 1 cet ott eE a bem og irit ween as tad e eR wees sas genes Soames cad RRE 151 ADM SeIBISIalus 5 niii Ic bec ex nsi tiis nei 152 9 7 ADM LED FUNCIONS menier tem Ee POE dea ERR emEE Ee NR E NETS eias 153 ADM SelLbed2 x ei iiie tei or OE stili diee MS ced 153 9 8 ADM API Miscellaneous Functions
122. e err offset 1 module err freq 07 else module err freq 500 ProSoft Technology Inc Page 159 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM RAM GetFloat Syntax float ADM RAM GetFloat ADMHANDLE adm handle char huge mydata char Topic Parameters adm handle Handle returned by previous call to ADM Open mydata Pointer return from ADM RAM Find Section Topic Pointer to name of a variable Description ADM RAM GetFloat tries to find the Topic name passed to the function in the file Return Value Value of a type Float found under the Topic name or 0 if the sub section is not found Example module time ADM RAM GetFloat adm handle tptr Time if module time 0 module time gt module max regs 61 module time 1 module err freq 0 else module err freq 500 Page 160 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM RAM GetDouble Syntax double ADM RAM GetDouble ADMHANDLE adm handle char huge mydata char Topic Parameters adm handle Handle returned by previous call to ADM Open mydata Pointer return from ADM RAM Find Section Topic Pointer to name of a var
123. e errors to appear when the executable is built This is a normal occurrence If you are building existing code written for a different compiler you may have to replace calls to run time functions with the Digital Mars equivalent Refer to the Digital Mars documentation on the Run time Library for the functions available ProSoft Technology Inc Page 65 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 6 The executable file will be located in the directory listed in the Compiler Output Directory field If it is blank then the executable file will be located in the same folder as the project file The Project Settings window can be accessed by clicking Project Settings from the Main Menu Project Settings x Target Build Option Sets 1 Include Directories Library Directories Compiler Output Directory Target Output Directory Browser Exclude Directories Source Search Path cael Page 66 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Creating a New Digital Mars C 8 49 ADM Projec 1 igi 49 Menu ProjectE xpre Setting Up Your Development Environment Developer Guide 1 Name project 2 Set project type 3 Add files to project 4 Initial settings t Start Digital
124. e is present in the rack and therefore is not able to report the health status of the module when the module is online with the Quantum processor Please consider this when monitoring the status of the PTQ module 1 Run the SCHNEIDER ALLIANCES EXE application that is installed with the ProWORX 32 software G Authorization ees CodeGen g ExecLoader gg Proworx 32 4E Schneider Alliances 2 Click on IMPORT Schneider Alliances DER 1010100 Moi Te 7 T f mis eua pap QD 170 series 800 Series Delete Import Esport Name Card ID Card Description Medium Description Long Description Power 45 Power 44 3 Power 5 In Bytes Out Bytes Module Type Doc Only Rack View Bitmap Drop View Bitmap Has Multiple Catalog Number Terminal Strip ProSoft Technology Inc Page 31 of 239 February 20 2013 Configuring the Processor with ProWORX PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 3 Select the SAF File that is located on the CD ROM shipped with the PTQ module Select Import File Look in B SAF Files j 8 et FA My Recent Documents a Desktop My Documents My Computer My Network File name ProtalkQ v1 Q SAF Places Files of type Schneider Alliance File saf z Cancel 4 After you click on OPEN you should see the PTQ module
125. e must be a valid handle returned from ADM_Open Return Value ADM_SUCCESS No errors were encountered ADM_ERR_NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const unsigned short reg count unsigned short reg buff ADM DBSetRegs adm handle offset reg count reg buff See Also ADM DBGetRegs page 127 Page 128 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetString Syntax char ADM DBGetString ADMHANDLE adm handle unsigned short offset const unsigned short maxcount char str Parameters adm handle Handle returned by previous call to ADM Open offset Character offset into database where the buffer starts maxcount Maximum number of characters to retrieve str String buffer to receive characters Description This function copies a string from the database to a string buffer adm_handle must be a valid handle returned from ADM_Open Return Value Returns NULL if not successful Returns str if string is copy is successful Example ADMHANDLE adm handle unsigned short offset const unsigned short maxcount char string buff ADM DBGetString adm handle offset maxcount str See Also AD
126. e previously opened with MVIsp Open The current state of the DCD signal is copied to the int pointed to by state Return Value MVI SUCCESS The DCD state was read successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer Example int state if MVIsp GetDCD COM1 amp state MVI SUCCESS if state ON printf DCD is ON n else printf DCD is OFF n Page 206 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp GetLineStatus Syntax int MVIsp GetLineStatus int comport BYTE status Parameters comport Port for which line status is requested status Pointer to BYTE to receive line status Description MVIsp GetLineStatus returns any line status errors received over the serial port The status returned indicates if any overrun parity or framing errors or break signals have been detected comport is the desired serial port and must be previously opened with MVIsp Open status points to a BYTE that will receive a set of flags that indicate errors received over the serial port If the returned status is 0 no errors have been detected If status is non zero it can be logically and ed with the line status error flags LSERR_OVERRUN LSERR PARITY LSERR FRAMING LSERR BREAK and or QSERR OVERRUN to determine the ex
127. e sweep free running scan time ms Set clock r Single sweep settings Invoke optimized solve Flash program Close single sweep time base ms sweep trigger count Help 2 Click the SET CLOCK button to open the Set Controller s Time of Day Clock dialog box Set Controller s Time of Day Clock Day of week Stop cor Month 1 1 Day 1 31 Year Clear cor Invoke const Hour 0 23 x Zlk 2 Minute 0 59 Second 0 59 Write Panel gt PLC 7 15 2003 16 06 08 Cancel Help Close Help 3 Click the WRITE PANEL button This action updates the date and time fields in this dialog box Click OK to close this dialog box and return to the previous window Click CLOSE to close the Online Control Panel dialog box In the PLC Configuration window open the ONLINE menu and then choose REFERENCE DATA EDITOR This action opens the Heference Data Editor dialog box On this dialog box you will add preset values to data registers that will later be monitored in the ProTalk module ProSoft Technology Inc February 20 2013 Page 27 of 239 Configuring the Processor with Concept PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 6 Place the cursor over the first address field as shown in the following illustration Broe Template untitled Animation ON E ni x Variable Name Address
128. ed short offset ADM DBSwapDWord adm handle offset 3 Page 132 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM GetDBOptr Syntax char ADM GetDBCptr ADMHANDLE adm handle int offset Parameters adm handle Handle returned by previous call to ADM Open offset Word offset into database Description This function obtains a pointer to char corresponding to the database offset location Because offset is a word offset the pointer will always reference a character on a word boundary adm handle must be a valid handle returned from ADM Open Return Value Returns NULL if not successful Returns pointer to char if successful Example ADMHANDLE adm handle int offset char cur c ADM GetDBCptr adm handle offset ProSoft Technology Inc Page 133 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM GetDBlptr Syntax int ADM GetDBIptr ADMHANDLE adm handle int offset Parameters adm handle Handle returned by previous call to ADM Open offset Word offset into database Description This function obtains a pointer to int corresponding to the database offset location adm handle must be a valid handle returned from ADM O
129. eloper Guide 10 5 Backplane API Messaging Functions MVIbp ReceiveMessage Syntax int MVIbp ReceiveMessage MVIHANDLE handle WORD buffer WORD length WORD reserved WORD timeout Parameters handle Handle returned by previous call to MVIbp Open buffer Pointer to buffer to receive message data from processor length Pointer to a variable containing the maximum message length in words When this function is called this should be set to the size of the indicated buffer Upon successful return this variable will contain the actual received message length reserved Must be set to 0 timeout Maximum number of milliseconds to wait for message Description This function retrieves a message sent from the control processor handle must be a valid handle returned from MVIbp Open Upon calling this function length should contain the maximum message size in words to be received buffer must point to a buffer of at least length words in size Upon successful return length will contain the actual length of the message received If length exceeds the maximum message size specified by the value MsgRocvBufSize refer to the MVIbp SetlOConfig function MVI ERR BADPARAM will be returned reserved is not used and must be set to zero MVI ERR BADPARAM will be returned if reserved is not zero timeout specifies the number of milliseconds that the function will wait for a message To poll for a message without waiting set
130. en cycle power to reboot the module COM1 Properties x Port Settings Be persecond EZTONINIIEIE Daat jj v Parity None Y Stop bits 1 EN Restore Defaults ProSoft Technology Inc Page 89 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 4 During the memory check portion of the module s boot sequence press Ctrl C to enter the BIOS configuration menu General Software 80C386 EM Embedded BIOS tm Version 4 1 Copyright C 1998 General Software Inc Prosoft Technology MVIS6 Communications Module Prosoft Technical Support 01 661 664 7208 MVI BIOS v1 01 Copyright c 1999 2000 Online Development Inc 00384 KB OK Hit C if you want to run SETUP 80C386 EX 4 1 0160 0800 System Bios Setup Utility v4 001 C 1998 General Sof tware Inc All rights reserved MVI Module Configuration Begin Flash ROM Update Mode Reset Con Fauna cran to factory defaults xit I I 1 I 1 I I I I I I I 1 I l I I I l I I I I 1 I I I I 1 I l I I I l lt Esc gt to continue Page 90 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 5 Press Enter to
131. erence Manual 227 14 Support Service amp Warranty 229 14 1 Contacting Technical SUPPOMt ceececesceeesceceeeeeseeeeeeceeeeeeeeaeeeeaeeeeeeaeeneneeeaas 230 14 2 Warranty nfOrImatlOn 52 2 cette itte ene citer ete e NEE eene nte iere teet 231 Glossary of Terms 233 Index 237 ProSoft Technology Inc Page 9 of 239 February 20 2013 Start Here PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 10 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Start Here C Programmable Network Interface Module for Quantum Developer Guide 1 Start Here In This Chapter Hardware and Software Requirements eeeeeese 12 Information for Concept Version 2 6 Users 14 This guide is intended to guide you through the ProTalk module setup process from removing the module from the box to exchanging data with the processor In doing this you will learn how to Setup the processor environment for the PTQ module View how the PTQ module exchanges data with the processor Edit and download configuration files from your PC to the PTQ module Monitor the operation of the PTQ module ProSoft Technology Inc Page 11 of 239 February 20 2013 Start Here Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum 1 4 Hardware and Software Requirements 1 1 1 Packag
132. ers 300001 300512 Bi Segment Scheduler Holding Registe400001 401872 Bl Modbus Port Settings police Specials Segment Scheduler Battery Coil i Segments 32 Timer Register Time of Day 400007 Config Extensions ASCII Data Protection Disabled Number of Messages Peer Cop Disabled Message Area Size Hot Standby Disabled Me imbas af Dasha PLC Configuration Overview double click in window to edit sections NOT CONNECTED 6 Make a note of the holding registers for the module You will need this information when you modify your application The Holding Registers are displayed in the PLC Memory Partition pane of the PLC Configuration dialog box PLC Memory Partition 34 Coils 000001 001536 Discrete Inputs 100001 100512 Input Registers 300001 300512 Holding Registe400001 401872 ProSoft Technology Inc Page 19 of 239 February 20 2013 Configuring the Processor with Concept PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 2 2 Add the PTQ Module to the Project 1 Inthe list of options on the left side of the PLC Configuration dialog box double click I O MAP This action opens the O Map dialog box Expansion Size i4 L1 gt Insert Delete Go To Loca Remote Head Slot z Cul Copy Paste Click Here Drop Type Holdup x
133. ersionInfo adm handle amp adm version printf Revision d dWMn verinfo APIRevisionMajor verinfo APIRevisionMinor Page 154 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM SetConsolePort Syntax void ADM SetConsolePort int Port Parameters Port Com port to use as the console COM1 0 COM2 1 COM3 2 Description ADM SetConsolePort sets the specified communication port as the console This allows the console to be disabled in the BIOS setup and the application can still configure the console for use Return Value None Example enable console on COM1 ADM SetConsolePort COM1 See Also ADM SetConsoleSpeed page 156 ProSoft Technology Inc Page 155 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM SetConsoleSpeed Syntax void ADM SetConsoleSpeed int Port long Speed Parameters Port Com port to use as the console COM1 0 COM2 1 COM3 2 Speed Baud rate for console port Available settings are 50 75 110 134 150 300 600 1200 1800 2400 4800 9600 19200 38400 57600 and 115200 Description ADM SetConsoleSpeed sets the specified communication port to the baud rate specified Return Value None
134. esssesseseeeeeeenneee neret rene 36 Add the PTQ Module to the Project 38 Build the Project niece tte epe Bienen 40 Connect Your PC to the Processor ssseeeem 41 Download the Project to the Quantum Processor sssss 44 The following steps are designed to ensure that the processor Quantum or Unity is able to transfer data successfully with the PTQ module As part of this procedure you will use Unity Pro to create a project add the PTQ module to the project set up data memory for the project and then download the project to the processor ProSoft Technology Inc Page 35 of 239 February 20 2013 Configuring the Processor with Unity Pro Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum 4 1 Create a New Project The first step is to open Unity Pro and create a new project 1 Inthe New Project dialog box choose the CPU type In the following illustration the CPU is 140 CPU 651 60 Choose the processor type that matches your own hardware configuration if it differs from the example Click OK to continue New Project 4 Premium I Quantum 140 CPU 311 10 02 00 _ 140 CPU 434 12A 140CPU 534 144 140 CPU 651 50 140 CPU 651 60 140 CPU 671 60 02 00 02 00 0200 02 00 02 00 02 00 02 00 OK Premium Quantum 486 CPU 400Kb Program MB MB Help 486 CPU 800Kb Program MB MB 586 CPU
135. face Module for Quantum Developer Guide 10 6 Backplane API Miscellaneous Functions MVibp_GetVersionInfo Syntax int MVIbp GetVersionInfo MVIHANDLE handle MVIBPVERSIONINFO verinfo Parameters handle Handle returned by previous call to MVIbp Open verinfo Pointer to structure of tyoe MVIBPVERSIONINFO Description MVIbp GetVersionlnfo retrieves the current version of the API library and the backplane device driver The information is returned in the structure verinfo handle must be a valid handle returned from MVlbp Open The MVIBPVERSIONINFO structure is defined as follows typedef struct tagMVIBPVERSIONINFO WORD APISeries API series WORD APIRevision API revision WORD BPDDSeries Backplane device driver series WORD BPDDRevision Backplane device driver revision BYTE Reserved 8 Reserved MVIBPVERSIONINFO Return Value MVI SUCCESS The version information was read successfully MVI ERR NOACCESS handle does not have access Example MVIHANDLE Handle MVIBPVERSIONINFO verinfo print version of API library MVIbp GetVersionInfo Handle amp verinfo printf Library Series d Rev dWMn verinfo APISeries verinfo APIRevision printf Driver Series d Rev d n verinfo BPDDSeries verinfo BPDDRevision ProSoft Technology Inc Page 181 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Devel
136. figuration direct I O access synchronization messaging and control of the console and LEDs ADM API Functions The ADM API provides an interface to initialize the API control the debug port read and write data to the database start and check timers transfer data over the backplane parse configuration files set user LED indicators and configure the console Module Specifications Module User definable module memory usage supporting the storage and transfer of up to 5000 registers to from the control processor Floating point data movement support Development Environment Operating system General software DOS 6 XL Compatible compilers 16 bit DOS target o Digital Mars C V8 49 included Borland C V5 02 Page 226 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable DOS 6 XL Reference Manual C Programmable Network Interface Module for Quantum Developer Guide 13 DOS 6 XL Reference Manual The DOS 6 XL Reference Manual makes reference to compilers other than Digital Mars C or Borland Compilers The PTQ ADM and ADMNET modules only support Digital Mars C and Borland C C Compiler Version 5 02 References to other compilers should be ignored ProSoft Technology Inc Page 227 of 239 February 20 2013 DOS 6 XL Reference Manual PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 228 of 239 ProSoft Technology
137. he following diagram RS 232 Config Debug Port Cable DB 9 Male Config Debug Port Ro 2 L vo To 3 E wo com s con The Ethernet port on this module if present is inactive RS 232 Application Port s When the RS 232 interface is selected the use of hardware handshaking control and monitoring of modem signal lines is user definable If no hardware handshaking will be used the cable to connect to the port is as shown below RS 232 Application Port Cable No Handshaking DB 9 Male RS 232 Device Page 48 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up the ProTalk Module C Programmable Network Interface Module for Quantum Developer Guide RS 232 Modem Connection This type of connection is required between the module and a modem or other communication device RS 232 Application Port Cable Modem Connection DB 9 Male RS 232 Device Signal Signal Common Common DTR DTR The Use CTS Line parameter for the port configuration should be set to Y for most modem applications RS 232 Null Modem Connection Hardware Handshaking This type of connection is used when the device connected to the module requires hardware handshaking control and monitoring of modem signal lines RS 232 Application Port Cable Hardware Handshaking DB 9 Male RS 232 Device no r Signal Signal Common Common ProSoft Technol
138. he Processor with Unity Pro PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 4 5 Download the Project to the Quantum Processor 1 Open the PLC menu and then choose CONNECT This action opens a connection between the Unity Pro software and the processor using the address and media type settings you configured in the previous step 2 Onthe PLC menu choose TRANSFER PROJECT TO PLC This action opens the TRANSFER PROJECT TO PLC dialog box If you would like the PLC to go to Run mode immediately after the transfer is complete select check the PLC RUN AFTER TRANSFER check box Transfer Project to PLC PC Project verwritten PLC Project Name Station Name Station Version 0 0 1 Version 0 0 1 Last Build September 25 2006 3 37 26 PM Last Build September 25 2006 3 37 26 PM cot 3 Click the TRANSFER button to download the project to the processor As the project is transferred Unity Pro reports its process in a PROGRESS dialog box with details appearing in a pane at the bottom of the window When the transfer is complete place the processor in Run mode The processor will start scanning your process logic application Page 44 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up the ProTalk Module C Programmable Network Interface Module for Quantum Developer Guide 5 Setting Up the ProTalk Module
139. he bytes are transmitted across the serial line This function attempts to insert the bytes into the transmission queue and return values correspond accordingly timeout specifies the amount of time in milliseconds to wait If timeout is TIMEOUT ASAP the function will return immediately if any of the bytes cannot be queued immediately If timeout is TIMEOUT FOREVER the function will not return until all the bytes are queued successfully If all the bytes can be queued immediately MVIsp PutData returns MVI SUCCESS If the characters cannot be queued immediately MVIsp PutData tries to queue the bytes until the timeout elapses If the timeout elapses before the bytes can be queued MVI ERR TIMEOUT is returned When MVIsp PutData returns it writes to the int pointed to by len the number of bytes queued successfully len is written for successfully sent bytes as well as timeouts Note If software handshaking is enabled on the external serial device sending data that contains XOFF characters may stop transmission from the external serial device If handshaking is enabled and the receiving serial device has paused transmission timeouts may occur after the queue becomes full Page 212 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide Return Value MVI SUCCESS The bytes were sent
140. he executable file will be located in the directory listed in the Final field of the Output Directories that is C adm sample The Project Options window can be accessed by clicking Options Project Menu from the Main Menu Topics Directories d Compiler dr 16 bit Compiler x 32 bit Compiler This section lets you tell Borland C where to look for source aPC Options include and library files The output directories control where lt P Optimizations intermediate files 0BJ RES and final files EXE DLL cP Messages RES are placed RP Linker Librarian r Source Directories TR Bua PEI Include Je beS include c adm sample ine Make Library Je beS libsc adm sample ib Source o adm_wrkg sample Dutput D rectories Intermediate eNadm sample Final c Sadmisample x Set paths for input and output files Undo Page x Cancel Help Creating a New Borland C 5 02 ADM Project 1 Start Borland C 5 02 then click File gt Project from the Main Menu r Project Path and Name z cNadm sample wn proi ide m Target Name my_proi owse r Target Type Advanced m Frameworks Dynamic Library dll M Class Library 2 Hep EasyWin exe Static Library for exe lib p Math Support Static Library for dll lib Floating Point Import Library lib zi Emulation C None Platform DOS Standard Libraries Target
141. hnology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 20 When complete the Success window appears S Building ADM Complete al xl Status Success Running Program C BC5 BINMtlink exe Command line C 4DM SAMPLESADM r p Information Elapsed Time 2 531 Seconds Statistics Total Current Lines 17535 0 Warnings 0 0 Errors 0 0 21 Click OK The executable file will be located in the directory listed in the Final box of the Output Directories that is C adm sample The Project Options window can be accessed by clicking Options Project from the Main Menu ProSoft Technology Inc Page 81 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 8 2 Creating a ROM Disk Image To change the contents of the ROM disk a new disk image must be created using the WINIMAGE utility The WINIMAGE utility for creating disk images is described in the following topics 8 2 1 WINIMAGE Windows Disk Image Builder WINIMAGE is a Win9x NT utility that may be used to create disk images for downloading to the PTQ module It does not require the use of a floppy diskette Also it is not necessary to estimate the disk image size since WINIMAGE does this automatic
142. iable Description ADM RAM GetDouble tries to find the Topic name passed to the function in the file Return Value Value of a type Double found under the Topic name or 0 if the sub section is not found Example module time ADM RAM GetDouble adm handle tptr Time if module time 0 module time gt module max regs 61 module time 1 module err freq 0 else module err freq 500 ProSoft Technology Inc Page 161 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM RAM GetChar Syntax unsigned char ADM RAM GetChar ADMHANDLE adm handle char huge mydata char Topic Parameters adm handle Handle returned by previous call to ADM Open mydata Pointer return from ADM RAM Find Section Topic Pointer to name of a variable Description ADM RAM GetChar tries to find the Topic name passed to the function in the file Return Value Character found under the Topic name or if the sub section is not found Example module enable ADM RAM GetChar adm handle tptr Enable if module enable module time 1 module err freq 0 else module err freq 500 Page 162 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Mo
143. ic name ADM RAM GetLong Get Long under topic name ADM RAM GetFloat Get Float under topic name ADM RAM GetDouble Get Double under topic name ADM RAM GetChar Get Char under topic name ADM Get BP Data Exchange Get Control Data Exchange ProSoft Technology Inc February 20 2013 Page 99 of 239 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 9 2 ADM API Initialization Functions ADM_Open Syntax int ADM Open ADMHANDLE adm handle Parameters adm_handle Pointer to variable of tyoe ADMHANDLE Description ADM_Open acquires access to the ADM API and sets adm_handle to a unique ID that the application uses in subsequent functions This function must be called before any of the other API functions can be used IMPORTANT After the API has been opened ADM_Close should always be called before exiting the application Return Value ADM_SUCCESS API was opened successfully ADM_ERR_REOPEN API is already open ADM_ERR_NOACCESS API cannot run on this hardware Note ADM_ERR_NOACCESS will be returned if the hardware is not from ProSoft Technology Example ADMHANDLE adm handle if ADM Open amp adm handle ADM SUCCESS printf nFailed to open ADM API exiting programin exit 1 See Also ADM Close page 101 Page 100 of 239 ProSoft Technology Inc
144. ide 10 2 Backplane API Configuration Functions MVIbp GetlOConfig Syntax int MVIbp GetIOConfig MVIHANDLE handle MVIBPIOCONFIG ioconfig Parameters handle Handle returned by previous call to MVIbp Open ioconfig Pointer to MVIBPIOCONFIG structure to receive configuration information Description This function obtains the I O configuration of the PTQ module handle must be a valid handle returned from MVIbp Open The MVIBPIOCONFIG structure is defined as shown typedef struct tagMVIBPIOCONFIG WORD TotalInputSize Size of entire input image in words WORD TotalOutputSize Size of entire output image in words WORD DirectInputSize Input words available for direct access WORD DirectOutputSize Output words available for direct access WORD MsgRcvBufSize Max size in words for received messages WORD MsgSndBufSize Max size in words for sent messages MVIBPIOCONFIG The sizes in words of the module s input and output images are returned in the MVIBPIOCONFIG structure pointed to by ioconfig The TotallnputSize and TotalOutputSize members are set equal to the size of the entire input or output image respectively The DirectlnputSize and DirectOutputSize members are set equal to the number of words of the respective image that is available for direct access via the MVIbp Writelnputlmage or MVIbpReadOutputlmage functions By default the direct and total sizes are equal Refer to the MVIbp SetlOConfig
145. in the same rack as the processor 2 Tiltthe module at a 45 angle and align the pegs at the top of the module with slots on the backplane Caution The PTQ module is hot swappable meaning that you can install and remove it while the rack is powered up You should not assume that this is the case for all types of modules unless the user manual for the product explicitly states that the module is hot swappable Failure to observe this precaution could result in damage to the module and any equipment connected to it ProSoft Technology Inc Page 47 of 239 February 20 2013 Setting Up the ProTalk Module PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 5 1 4 Cable Connections The application ports on the PTQ ADM module support RS 232 RS 422 and RS 485 interfaces Please inspect the module to ensure that the jumpers are set correctly to correspond with the type of interface you are using Note When using RS 232 with radio modem applications some radios or modems require hardware handshaking control and monitoring of modem signal lines Enable this in the configuration of the module by setting the UseCTS parameter to 1 RS 232 Confiquration Debug Port This port is physically a DB 9 connection This port permits a PC based terminal emulation program to view configuration and status data in the module and to control the module The cable for communications on this port is shown in t
146. ion The node needing to transmit will assert the RTS line then transmit the message The RTS line must be de asserted as soon as the last character is transmitted Turning RTS on late or off early will cause the beginning or end of the message to be clipped resulting in a communication error In some applications it may be necessary to delay between RTS transitions and the message In this case RTS would be asserted wait for delay time transmit message wait for delay time and de assert RTS RS 485 Transmit Receive RTI On RTI Of Unit A RTS Unit A Teen PR eee Daa PESOS G HOI Unit B RTS Transmit Unit B Das Cpional Catena RTI On ott Dalay Diny ProSoft Technology Inc Page 61 of 239 February 20 2013 Understanding the PTQ ADM API PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 7 5 2 Soflware The following is a code sample designed to illustrate the steps required to transmit in RS 485 Depending on the application it may be necessary to handle other processes during this transmit sequence and to not block This is simplified to demonstrate the steps required int length 10 send 10 characters int CharsLeft BYTE buffer 10 Set RTS on MVIsp SetRTS COM2 ON Optional delay here depends on application Transmit message MVIsp PutData COM2 buffer amp length TIMEOUT ASAP Check to see that message is done MVIsp GetCountUnsent
147. is to be enabled or 0 if the console is not enabled baud An integer that is set to the desired console baud rate index if the console is enabled Description This function sets the state of the console handle must be a valid handle returned from MVIbp Open mode is an integer that contains the desired state of the console mode should be set to 1 if the console is to be enabled or 0 if the console is to be disabled baud is an integer that contains the desired baud rate of the console baud should be set to the console s baud index value if the console is enabled The baud index values are shown in Table 3 The state of the console is normally configured with the BIOS setup menu and is saved in battery backed memory If the module is removed from power for a period of time and the battery discharges then the state information is lost This function allows an application to store a desired console state into the battery backed memory Note If the Setup Jumper is installed the console is enabled at 19200 baud Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS handle does not have access Example MVIHANDLE handle int mode baud mode 1 enable the console baud 8 set baud rate to 19200 baud MVIbp SetConsoleMode handle mode baud Page 190 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Netw
148. ld Attributes Include cNbcSNinclude Make Library fo be5 ib Source pd m Output D rectories Intermediate Final Set paths for input and output files w ox Duro r2 x Cancel Help 15 Click Directories from the Topics field and fill in directory information as required by your project s directory structure d Project Options Ad xl Topics Directories e Directories a Compiler a 15 bit Compiler RP 32 bit Compiler This section lets you tell Borland C where to look for source R C Options include and library files The output directories control where t Optimizations intermediate files 0BJ RES and final files EXE DLL ap Messages RES are placed in Linker Librarian r Source Directories PRA S Bd DUE Include JoNbeS include c adm sample inc Make Library cbe adm sample ib x Source Je Nadm sample my_proj Output D rectories Intermediate eNadmvsampleNmy profvout x Final Jo adm sample my_proj oul X The output directory for your EXE DLL and MAP files w ok Sunao Page x Cancel Help ProSoft Technology Inc Page 79 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 16 Double click on the Compiler header in the Topics field and choose the Processor selection C
149. le Return Value MVI_SUCCESS A message has been received MVI ERR NOACCESS handle does not have access MVI ERR TIMEOUT The timeout occurred before a message was received MVI ERR BADPARAM A parameter is invalid MVI ERR BADCONFIG Receive messaging is not enabled MVI ERR MSGTOOBIG The received message is too big for the buffer Example MVIHANDLE Handle int rcr WORD buffer 256 WORD length length 256 maximum message size that can be received Wait up to 5 seconds for a message rc MVIbp Receiv ssage Handle buffer amp length 0 5000 if rc MVI SUCCESS printf Message received Length is d words n length See Also MVIbp SetlOConfig page 171 MVIbp SendMessage page 179 Page 178 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide MVIbp SendMessage Syntax int MVIbp SendMessage MVIHANDLE handle WORD buffer WORD length WORD reserved WORD timeout Parameters handle Handle returned by previous call to MVIbp Open buffer Pointer to buffer of data to send to processor length The length in words of the message to send reserved Must be set to 0 timeout Maximum number of milliseconds to wait for processor to read message Description This function sends a message to the control proces
150. le must be a valid handle returned from ADM Open Return Value Requested long int Example ADMHANDLE adm handle unsigned short offset long 1 l ADM DBGetLong adm handle offset See Also ADM DBSetLong page 120 ProSoft Technology Inc Page 119 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetLong Syntax int ADM DBSetLong ADMHANDLE adm handle unsigned short offset const long val Parameters adm handle Handle returned by previous call to ADM Open offset Long int offset into database val Value to be written to the database Description This function writes a long int to the database at a specified long int offset adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const long val ADM DBSetLong adm handle offset val See Also ADM DBGetLong page 119 Page 120 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetFloat Syntax flo
151. lid Example ADMHANDLE adm handle ADM INTERFACE interface ptr ADM INTERFACE interface interface ptr amp interface ADM DAWriteRecvCtl adm handle interface ptr app port RTSON See Also ADM DAWriteSendCtl page 103 Page 104 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DAWriteSendData Syntax int ADM DAWriteSendData ADMHANDLE adm handle ADM INTERFACE adm interface ptr int app port int length char data buff Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure which contains structure pointers needed by the function app port Application serial port referenced length The number of data characters to send to the data analyzer data buff The buffer holding the transmit data Description This function may be used to send transmit data to the data analyzer screen The data will appear between two angle brackets data adm handle must be a valid handle returned from ADM Open Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS adm handle does not have access Example ADMHANDLE adm handle ADM INTERFACE interface ptr ADM PORT ports MAX APP PORTS Int app port ADM INTERF
152. ll modem cable 2 Start the communication program on your computer and configure the communication parameters with the following settings Baud Rate 19200 Parity None Data Bits 8 Stop Bits 1 Software Handshaking None 3 Open the connection Send the necessary command to terminate the module s program If there is no response from the module follow these steps 1 Verify that the null modem cable is connected properly between your computer s serial port and the module A regular serial cable will not work 2 Verify that your communication software is using the correct settings for baud rate parity and handshaking 3 On computers with more than one serial port verify that your communication program is connected to the same port that is connected to the module 4 Ifyou are still not able to establish a connection you can contact ProSoft Technology Technical Support for further assistance Page 88 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 8 5 4 Enabling the Console Before you can use RY and SY from the command prompt you must enable the console in the ADM module s BIOS To change BIOS settings 1 Remove the module from the rack and install the Setup jumper 2 Return the module to the rack 3 Connect to the module using HyperTerminal at 19 200 bps and th
153. mple ADM code supplied by ProSoft Technology using Digital Mars C 8 49 After verifying that the sample code can be successfully compiled and built you can modify the sample code to work with your application Note This procedure assumes that you have successfully installed Digital Mars C 8 49 on your workstation Downloading the Sample Program The sample code files are located in the ADM TOOL PTQ ZIP file This zip file is available from the CD ROM shipped with your system or from the www prosoft technology com web site When you unzip the file you will find the sample code files in ADM_TOOL_PTQ SAMPLES Important The sample code and libraries in the 1756 MVI Samples folder are not compatible with and are not supported for the Digital Mars compiler Building an Existing Digital Mars C 8 49 ADM Project 1 Start Digital Mars C 8 49 and then click Project Open from the Main Menu pen Project x File name Folders DK pi cS mvi56 adm serial in ok 5badm si pri E c E 4DM TOOL MVI E SAMPLES E MVIBE S amples MVI56 4DM fme MVI56 ADM Serifig List files of type Drives Project pri v c gt Network 2 From the Folders field navigate to the folder that contains the project CAADM TOOL PTQWSAMPLES 3 Inthe File Name field click on the project name 56adm si prj Page 64 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting
154. n Note If the Setup Jumper is installed the console is enabled at 19200 baud Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS handle does not have access Example MVIHANDLE handle int mode MVIbp GetConsoleMode handle amp mode if mode Console is enabled allow user interaction else Console is not available normal operation Page 186 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Guide MVIbp GetSetupMode Syntax int MVIbp GetSetupMode MVIHANDLE handle int mode Parameters handle Handle returned by previous call to MVIbp Open mode Pointer to an integer that is set to 1 if the Setup Jumper is installed or O if the Setup Jumper is not installed Description This function is used to query the state of the Setup Jumper handle must be a valid handle returned from MVIbp Open mode is a pointer to an integer When this function returns mode will be set to 1 if the module is in Setup Mode or 0 if not If the Setup Jumper is installed the module is considered to be in Setup Mode It may be useful for an application to detect Setup Mode and perform special configuration or diagnostic functions Return Value MVI SUCCESS No errors were encountered MVI ERR NOACCESS handle does not have access Example MVIHANDL
155. n 4 100 Hz in each of the 3 orthogonal axes Shock 30G 11 mSec in each of the 3 orthogonal axes Dimensions HxWxD Approx 250 x 103 85 x 40 34 mm 9 84 x 4 09 x 1 59 in LED Indicators Module Status Backplane Transfer Status Serial Port Activity LED Serial Activity and Error LED Status Configuration Serial Port PRT1 DB 9M PC Compatible RS 232 only No hardware handshaking Application Serial Ports PRT2 PRT3 DB 9M PC Compatible RS 232 422 485 jumper selectable RS 422 485 screw termination included RS 232 handshaking configurable 500V Optical isolation from backplane ProSoft Technology Inc February 20 2013 Page 225 of 239 Product Specifications PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 12 3 Functional Specifications The PTQ ADM API Suite allows software developers to access the Quantum backplane and serial ports without needing detailed knowledge of the module s hardware design Serial Port API Functions The serial port API provides a common interface to the serial ports across all of the PTQ hardware platforms Functions include configuring opening closing controlling and monitoring the serial port and sending and receiving serial data Backplane API Functions The backplane API provides an interface to transfer data between the module and the processor over the backplane Functions include initialization con
156. n Concept Database MDC PTQ 101M MDC PTQ 1015 MDC PTQ 103M MDC PTQ 1045 MDC PTQ DFCM MDC PTQ DFNT MDC PTQ DNP MDC PTQ DNPSNET MDC PTQ HART MDC PTQ LNG Module Details IECBUS7 5 101 Master IEC6087 5 101 Slave IEC6087 5 103 Master IEC6087 5 104 Server Rockwell Automation DF1 Half Duplex Master Rockwell Automation Ethemet IP Module DNP 3 0 Master Slave Module DNP 3 0 Ethemet Server HART Module Landis and Gyr Protocol Provider Version Copyright ProLinx Communication Gateways 1 00 00 Copyright 2002 2003 2 Choose FILE OPEN INSTALLATION FILE This action opens the Open Installation File dialog box File Modules Help 15 x Installed Modules in Concept Database MDC PT Wyse Ge Tetra SI Al xl MDC PT MDC PT File name Folders ok EI mad c concept roce Cancel MDC Sample mdc E es Gast MDC PT amp CONCEPT Network MDC PT C3 Ca help EL 3 CC2CAT Module Provider Version Copyrigt List files of type Module Desc mdc 3 Dat 3 Dib zl Drives c 3 If you are using a Quantum processor you will need the MDC files In the Open Installation File dialog box navigate to the MDC Files directory on the ProTalk CD 4 Choose the MDC file and help file for your version of Concept o Concept 2 6 users select PTQ 2 60 mdc and PTQMDC hlp o Concept 2 5 users select PTQ 2 50 mdc and PTQMDC hlp Page 14 of 239 ProSoft Te
157. ncel When the file has been transferred to your PC the dialog box will indicate that the transfer is complete 8 6 Debugging Strategies For simple debugging printf s may be inserted into the module application to display debugging information on the console connected to PRT1 ProSoft Technology Inc Page 95 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 96 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Application Development Libraries Developer Guide 9 Application Development Libraries In This Chapter ADM API Functions eeeeeenn ADM API Initialization Functions ADM API Debug Port Functions ADM API Database Functions ADM API Clock Functions eeeeeeeen ADM API Backplane Functions ADM LED Functions eeeeee ADM API Flash Functions ADM API Miscellaneous Functions ADM API RAM Functions ProSoft Technology Inc February 20 2013 Page 97 of 239 Application Development Libraries Developer Guide PTQ ADM C Programmable C Programmable Network Interface Mo
158. nction reliably especially during binary file transfers such as when uploading downloading configuration files or module firmware upgrades Anull modem serial cable 8 5 2 Required Software In order to send and receive data over the serial port COM port on your computer to the module you must use a communication program terminal emulator A simple communication program called HyperTerminal is pre installed with recent versions of Microsoft Windows operating systems If you are connecting from a machine running DOS you must obtain and install a compatible communication program The following table lists communication programs that have been tested by ProSoft Technology DOS ProComm as well as several other terminal emulation programs Windows 3 1 Terminal Windows 95 98 HyperTerminal Windows NT 2000 XP HyperTerminal The RY and SY programs use the Ymodem file transfer protocol to send upload and receive download configuration files from your module If you use a communication program that is not on the list above please be sure that it supports Ymodem file transfers ProSoft Technology Inc Page 87 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 8 5 3 Connecting to the Module To connect to the module s Configuration Debug port 1 Connect your computer to the module s port using a nu
159. nctions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp GetCountUnsent Syntax int MVIsp GetCountUnsent int comport int count Parameters comport Desired communications port count Pointer to int to receive unsent character count Description MVIsp GetCountUnsent returns the number of characters in the transmit queue that are waiting to be sent Since data sent to a port is queued before transmission across a serial port the application may need to determine if all characters have been transmitted or how many characters remain to be transmitted comport is the desired serial port and must be previously opened with MVIsp Open count points to an int that will receive the number of characters that have been sent to the serial port but not transmitted If the returned count is 0 all data has been transmitted If it is non zero it contains the number of characters put into the queue with MVIsp Putch MVIsp Puts or MVIsp PutData but that have not been transmitted Return Value MVI SUCCESS Count retrieved successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid pointer Example int count if MVIsp GetCountUnsent COM2 amp count MVI SUCCESS if count 0 printf All chars sent n else printf Sd characters remaining n count See Also MVIsp Putch page 208 MVIsp Puts page 210 MVIsp Put
160. nd to enable messaging handle must be a valid handle returned from MVIbp Open By default all of the module s I O image is available for direct I O access and messaging is disabled The MVIbp SetlOConfig may be used to limit the amount of I O image available for direct access to only that which the application expects to use Attempts to access l O outside of the range defined by this function will result in an error If the application is to use the messaging functions MVIbp SendMessage and MVIbp ReceiveMessage MVIbp SetlOConfig must be called to enable messaging and setup the maximum message size that will be allowed The message size is expressed in words The MVIBPIOCONFIG structure is defined as shown typedef struct tagMVIBPIOCONFIG WORD TotalInputSize Size of entire input image in words WORD TotalOutputSize Size of entire output image in words WORD DirectInputSize Input words available for direct access WORD DirectOutputSize Output words available for direct access WORD MsgRcvBufSize Max size in words for received messages WORD MsgSndBufSize Max size in words for sent messages MVIBPIOCONFIG The TotallnputSize and TotalOutputSize members are ignored by the API since the total I O image sizes cannot be changed by the application The DirectInputSize and DirectOutputSize members should be set equal to the number of words of the respective image that will be used for direct access via the MVIbp
161. ndle interface ptr app port ports app port len ports app port buff See Also ADM DAWriteSendData page 105 Page 106 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM ConPrint Syntax nt ADM ConPrint ADMHANDLE adm handle ADM INTERFACE adm interface ptr Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to structures Description This function outputs characters to the debug port This function will buffer the output and allow other functions to run The buffer is serviced with each call to ADM ProcessDebug and can be serviced by the user s program When sending data to the debug port if printf statements are used other processes will be held up until the printf function completes execution Two variables in the interface structure must be set when data is loaded The first buff ch is the offset of the next character to print This should be set to 0 The second is buff len This should be set to the length of the string placed in the buffer adm handle must be a valid handle returned from ADM Open Return Value ADM ERR NOACCESS adm handle does not have access Number of characters left in the buffer Example ADMHANDLE adm handle ADM INTERFACI in
162. ned short offset if ADM DBGetBit adm handle offset printf bit is set else printf bit is clear Page 112 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module Application Development Libraries for Quantum Developer Guide ADM DBSetBit Syntax int ADM DBSetBit ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open offset Bit offset into database Description This function sets a bit to a 1 in the database at a specified bit offset adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset ADM DBSetBit adm handle offset See Also ADM DBClearBit page 114 ProSoft Technology Inc February 20 2013 Page 113 of 239 Application Development Libraries Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum ADM DBClearBit Syntax int ADM DBClearBit ADMHANDLE adm handle unsigned short offset Parameters adm handle Handle returned by previous call to ADM Open offset Bit offset into database Description This function clears a bit
163. ngth in number of bits per character Valid values for word length are WORDLEN5 WORDLEN6 WORDLEN7 and WORDLEN8 The number of stop bits is set by stopbits Valid values for stop bits are STOPBITS1 and STOPBITS2 The handshake lines DTR and RTS of the port specified by comport are turned on by MVIsp Open j NI Aaj A lN o o Note If the console is enabled or the Setup jumper is installed the baud rate for COM1 is set as configured in BIOS Setup and cannot be changed by MVIsp_Open MVIsp Open will return MVI_SUCCESS but the baud rate will not be affected It is recommended that the console be disabled in BIOS Setup if COM1 is to be accessed with the serial API IMPORTANT After the API has been opened MVIsp_Close should always be called before exiting the application Return Value MVI SUCCESS Port was opened successfully MVI ERR REOPEN Port is already open MVI ERR NODEVICE UART not found on port Note MVI ERR NODEVICE will be returned if the port is not supported by the module Example if MVIsp Open COMI BAUD 9600 PARITY NONE WORDLEN8 STOPBITS1 MVI SUCCESS printf Open failed Win else printf Open succeeded Win See Also MVIsp Close page 197 Page 194 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Qu
164. ns IEC UNKNOWN Type Unsupported controller Available Logic Area 65535 Coils 000001 Discrete Inputs 100001 Input Registers 300001 Holding Registe 400001 B ASCII PLC Memory Partition 31 000001 100001 300001 400001 Loadables Number installed 0 pes Battery Coil Timer Register Time of Day Specials 31 400007 r Segment Scheduler Segments m Config Extensions Data Protection Peer Cop Hot Standby L 5 lll Disabled Disabled Disabled ASCII Number of Messages Message Area Size Merle af Darba PLC Configuration Overview double click in window to edit sections 3 Inthe list of options on the left side of this dialog box double click the PLC SELECTION folder This action opens the PLC Selection dialog box PLC Selection x i until Ev Concept C CONCEPT TESTPRJ untitled PLC Family File Configure Project Online Options Wi Quantum D c pae fe aa I eal B Summary pam B Type 6 IEC B Config Extensions B ASCII PLC 140 CPU 11 140 CPU 11 140 CPU 11 Discr Input Holdi 140 CPU 113 025 140 CPU 113 035 186 IEC None S84 Eg IMID CHS CPU Executive 3 02 303 3 03 140CPU 21304 vl Coils Memory Size Cancel l NOT CONNECTED JEC Heap Size KB
165. nt 0 printf All chars read n else printf d characters remaining n count See Also MVIsp_Getch page 209 MVIsp Gets page 214 MVIsp GetData page 216 ProSoft Technology Inc Page 219 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp PurgeDataUnsent Syntax int MVIsp PurgeDataUnsent int comport Parameters comport Port whose transmit data is to be purged Description MVIsp PurgeDataUnsent deletes all data waiting in the transmit queue The data is discarded and is not transmitted Comport specifies the port whose transmit queue is to be purged Return Value MVI SUCCESS The data was purged successfully MVI ERR BADPARAM invalid comport MVI ERR NOACCESS The comport has not been opened Example if MVIsp PurgeDataUnsent COM1 MVI SUCCESS printf Transmit Data purged n See Also MVIsp PurgeDataUnread page 221 Page 220 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp PurgeDataUnread Syntax int MVIsp PurgeDataUnread int comport Parameters comport Port whose receive data is to be purged Description MVIsp PurgeDataUnread deletes all data waiting in the receive queue The data i
166. nterface Module for Quantum Developer Guide ADM DBXNOR Byte Syntax int ADM DBXNOR Byte ADMHANDLE adm handle int offset unsigned char bval Parameters adm handle Handle returned by previous call to ADM Open offset Byte offset into database bval Bit mask to be XNORed with the byte at offset Description This function XNORs a byte in the database with a byte long bit mask adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle int offset unsigned char bval 0x55 ADM DBXNOR Byte adm handle offset bval ProSoft Technology Inc Page 143 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 9 5 ADM API Clock Functions ADM StartTimer Syntax unsigned short ADM StartTimer ADMHANDLE adm handle Parameters adm handle Handle returned by previous call to ADM Open Description ADM StartTimer can be used to initialize a variable with a starting time with the current time from a microsecond clock A timer can be created by making a call to ADM StartTimer and by using ADM CheckTimer to check to see if timeout has occurred For multiple timers call ADM St
167. ntum Drop dialog box Drop Module Modules 1 ASEM Partt none zl Bits In 0 Params Bits In 0 Bits Out 0 Bits Out 0 Status Table Prey Hert Clear Delete Cut Copy Paste Rack Slot Module Detected In Ref InEnd OutRef OutEnd a ii mmn PE e is E ENNE Foor 15 mmn ca OT iz n is is n 131077 o ii BA e fa 0 E mes ueo Fea ProSoft Technology Inc Page 21 of 239 February 20 2013 Configuring the Processor with Concept PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 5 Repeat steps 3 through 5 for each ProTalk module you plan to install When you have finished installing your ProTalk modules click OK to save your settings Click YES to confirm your settings Tip Select a module and then click the Help on Module button for help pages About ProTalk Q File Edit Bookmark Options Help Heime i B Om lt gt c Prolalk Q The ProTalk Q DNP Server Ethernet Communications Module PTG DNPSNET supports the implementation of the DNP 3 0 Distributed Network Prolocal over Ethernet alowing Quantum processors to easily communicate with host systems supporting the protocd The modue supports DNP Subset Level 2 features and some Level 3 features The module supports DNP Subset Level 2 features and some of the Level 3 features allowing the many SCADA systems supporting the DNP protocol ta
168. nty Information Complete details regarding ProSoft Technology s TERMS AND CONDITIONS OF SALE WARRANTY SUPPORT SERVICE AND RETURN MATERIAL AUTHORIZATION INSTRUCTIONS can be found at www prosoft technology com warranty Documentation is subject to change without notice ProSoft Technology Inc Page 231 of 239 February 20 2013 Support Service amp Warranty PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Page 232 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Glossary of Terms C Programmable Network Interface Module for Quantum Developer Guide Glossary of Terms API Application Program Interface Backplane Refers to the electrical interface or bus to which modules connect when inserted into the rack The module communicates with the control processor s through the processor backplane BIOS Basic Input Output System The BIOS firmware initializes the module at power up performs self diagnostics and provides a DOS compatible interface to the console and Flashes the ROM disk Byte 8 bit value C CIP Control and Information Protocol This is the messaging protocol used for communications over the ControlLogix backplane Refer to the ControlNet Specification for information Connection A logical binding between two objects A connection allows more efficient use of bandwidth because the message path is not in
169. oducts may result in injury harm or improper operating results Failure to observe this information can result in injury or equipment damage 2013 ProSoft Technology All rights reserved Printed documentation is available for purchase Contact ProSoft Technology for pricing and availability North America 1 661 716 5100 Asia Pacific 603 7724 2080 Europe Middle East Africa 33 0 5 3436 87 20 Information for ProTalk Product Users The statement power input and output I O wiring must be in accordance with Class I Division 2 wiring methods Article 501 10 b of the National Electrical Code NFPA 70 for installations in the U S or as specified in section 18 1J2 of the Canadian Electrical Code for installations within Canada and in accordance with the authority having jurisdiction The following or equivalent warnings shall be included A Warning Explosion Hazard Substitution of components may Impair Suitability for Class I Division 2 B Warning Explosion Hazard When in Hazardous Locations Turn off Power before replacing Wiring Modules and C Warning Explosion Hazard Do not Disconnect Equipment unless Power has been switched Off or the Area is known to be Nonhazardous D Caution The Cell used in this Device may Present a Fire or Chemical Burn Hazard if Mistreated Do not Disassemble Heat above 100 C 212 F or Incinerate WARNING EXPLOSION HAZARD DO NOT DISCONNECT EQUIPMENT UNLESS POWER HAS BEEN S
170. of word registers that can be accessed as bits bytes words longs floats or doubles Functions are provided for reading and writing the data in the various data types The database serves as a holding area for exchanging data with the processor on the backplane and with a foreign device attached to the application port Data transferred into the module from the processor can be requested via the serial port Conversely data written into the module database by the foreign device can be transferred to the processor over the backplane Page 60 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Understanding the PTQ ADM API C Programmable Network Interface Module for Quantum Developer Guide 7 5 RS 485 Programming Note 7 5 1 Hardware The serial port has two driver chips one for RS 232 and one for RS 422 485 The Request To Send RTS line is used for hardware handshaking in RS 232 and to control the transmitter in RS 422 485 In RS 485 only one node can transmit at a time All nodes should default to listening RTS off unless transmitting If a node has its RTS line asserted then all other communication is blocked An analogy for this is a 2 way radio system where only one person can speak at a time If someone holds the talk button then they cannot hear others transmitting In order to have orderly communication a node must make sure no other nodes are transmitting before beginning a transmiss
171. offset adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const double val ADM DBSetDFloat adm handle offset val See Also ADM DBGetDFloat page 123 Page 124 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetBuff Syntax char ADM DBGetBuff ADMHANDLE adm handle unsigned short offset const unsigned short count char str Parameters adm handle Handle returned by previous call to ADM Open offset Character offset into database where the buffer starts count Number of characters to retrieve str String buffer to receive characters Description This function copies a buffer of characters in the database to a character buffer adm_handle must be a valid handle returned from ADM_Open Return Value ADM_SUCCESS No errors were encountered ADM_ERR_NOACCESS adm_handle does not have access ADM_ERR_MEMORY database is not allocated ADM_ERR_REG_RANGE offset is out of range Example ADMHANDLE adm handle unsigned short offset const unsigned short char count char st
172. ogy Inc Page 49 of 239 February 20 2013 Setting Up the ProTalk Module PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum RS 232 Null Modem Connection No Hardware Handshaking This type of connection can be used to connect the module to a computer or field device communication port RS 232 Application Port Cable No Handshaking DB 9 Male RS 232 Device TxD RxD RTS RTS CTS jumper must be installed if CTS line CTS EJ monitoring enabled Signal Signal Common Common Note If the port is configured with the Use CTS Line set to Y then a jumper is required between the RTS and the CTS line on the module connection RS 485 Application Port s The RS 485 interface requires a single two or three wire cable The Common connection is optional and dependent on the RS 485 network The cable required for this interface is shown below RS 485 Application Port Cable DB 9 Male RS 485 Device TxD RxD TxD RxD TxD RxD s toro Signal Signal Common Common Note Terminating resistors are generally not required on the RS 485 network unless you are experiencing communication problems that can be attributed to signal echoes or reflections In these cases installing a 120 ohm terminating resistor between pins 1 and 8 on the module connector end of the RS 485 line may improve communication quality Page 50 of 239 ProSoft Technology Inc February 20 2013 PTQ
173. onfirm that the settings match those shown in the following screen 3 Project Options Al xl Topics Processor r Instruction set C 80t6 C 80186 o Calling Convention 90286 2 Memory Model 80 86 Segment Names Data A Segment Names Far Data C i56 Segment Names Code EY t Entry Exit Code 250 MONTO 32 bit Cunmpiler Byte a Ce Options C Wed cP Optimizations cP Messages SP Linker Librarian SP Resources Build Attributes Make Select a target processor Sin Page x Cancel Help 17 Click Memory Model from the Topics field and ensure that the options match those shown in the following screen Topics Memory Model m Mixed Model Override p Assume SS Equals D 1 C Tiny Default Procaesor C Small C Never Calling Convention C Medium C Always C Compact Segment Names Data ize Segment Names Far Data 9 Segment Names Code C Huge Entry Exit Code SHE 4 32 bit Compiler Eons ED IC Options Put constant strings in code segments lt gt Optimizations Far virtual tables Ro Messages Fasthuge pointers p Linker mi AER ibrarian utomatic far data Resources Far Data Threshold 22767 Build Attributes Make Select a memory model refer to TargetE pert for application model dips x Cancel 2 Help 18 Click OK 19 Click Project Build All from the Main Menu Page 80 of 239 ProSoft Tec
174. ools module configuration and programming information and example code for the module For the Quantum PLC refer to ProTalk Setup Guide Phase 1 and 2 for more information This document assumes the reader is familiar with software development in the 16 bit DOS environment using the C programming language This document also assumes that the reader is familiar with Quantum PLC platform ProSoft Technology Inc Page 53 of 239 February 20 2013 Introduction to PTQ ADM PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 6 1 Operating System The PTQ module includes General Software Embedded DOS 6 XL This operating system provides DOS compatibility along with real time multi tasking functionality The operating system is stored in Flash ROM and is loaded by the BIOS when the module boots DOS compatibility allows user applications to be developed using standard DOS tools such as Digital Mars C and Borland compilers User programs may be executed automatically by loading them from either the CONFIG SYS file or an AUTOEXEC BAT file Note DOS programs that try to access the video or keyboard hardware directly will not function correctly on the PTQ module Only programs that use the standard DOS and BIOS functions to perform console I O are compatible Refer to the General Software Embedded DOS 6 XL Developer s Guide page 227 on the PTQ ADM CD ROM for more information Page 54
175. oper Guide C Programmable Network Interface Module for Quantum MVIbp GetModulelnfo Syntax int MVIbp GetModuleInfo MVIHANDLE handle MVIBPMODULEINFO modinfo Parameters handle Handle returned by previous call to MVIbp Open modinfo Pointer to structure of type MVIBPMODULEINFO Description MVIbp GetModulelnfo retrieves identity information for the module The information is returned in the structure modinfo handle must be a valid handle returned from MVIbp Open The MVIBPMODULEINFO structure is defined as follows typedef struct tagMVIBPMODULEINFO WORD VendorID Reserved WORD DeviceType Reserved WORD ProductCode Device model cod BYTE ajorRevision Device major revision BYTE inorRevision Device minor revision DWORD SerialNo Serial number BYTE ame 32 Device name string BYTE onth Date of manufacture month BYTE Day Date of manufacture day WORD Year Date of manufacture year MVIBPMODULEINFO Return Value MVI SUCCESS The version information was read successfully MVI ERR NOACCESS handle does not have access Example MVIHANDLE Handle MVIBPMODULEINFO modinfo print module name MVIbp GetModuleInfo Handle amp modinfo printf Name is s n modinfo Name Page 182 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interfa
176. or ProTalk modules is 1060 decimal 0424 hex Unity Pro XL No name gt File Edit View Services Tools Build PLC Debug Window Help eu iH g eooc mls5s ES 1 4 GEN NOM Tg Structural view l ax amp Station NOM type generic module E Gy Configuration Bog 1 Local Bus mo contig ic Fon Oy 1 Local Quantur a 1 40 x8F Parameter Name in Derived Data Types D Derived FB Types Dy Variables amp FB instan Elementary Variables Derived Variables Gy I0 Derived Variables v MR Flementam FR instan Local Quantum Drop Analog Communication 1 Counting 1 Discrete Expert amp Motion E Ala T4 EA Local Bus R08 7 Loca Bus 14 GEN a s T Toy build A tmoatiexsor A User eros A SexchiReviace J Value between 1 65535 HMI R W mode OFFLINE 3 Before you can save the project in Unity Pro you must validate the modifications Open the EDIT menu and then choose VALIDATE If no errors are reported you can save the project 4 SAVE the project ProSoft Technology Inc Page 39 of 239 February 20 2013 Configuring the Processor with Unity Pro PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 4 3 Build the Project Whenever you update the configuration of your PTQ module or the processor you must import the changed configuration from the module and then build compile the project befo
177. ork Interface Module for Quantum Developer Guide 11 Serial Port Library Functions In This Chapter Serial Port API Initialization Functions eeeeeeee 193 Serial Port API Configuration Functions eeeeeeeee 198 Serial Port API Status Functions eeeeeeeeeeeeeeeeeeeennn 200 Serial Port API Communications eeeeeeeeeeeeeennn 208 Serial Port API Miscellaneous Functions eeeeeennnnee 222 This section provides detailed programming information for each of the API library functions The calling convention for each API function is shown in C format The API library routines are categorized according to functionality as follows Initialization MVIsp Open MVIsp Close MVIsp_OpenAlt Configuration MVIsp Config MVIsp SetHandshaking Port Status MVIsp SetRTS MVIsp GetRTS MVIsp SetDTR MVIsp GetDTR MVIsp_GetCTS MVIsp_GetDSR MVIsp_GetDCD MVIsp GetLineStatus Communications MVIsp Putch MVIsp Puts MVIsp PutData MVIsp Getch MVIsp Gets MVIsp GetData MVIsp GetCountUnsent MVIsp GetCountUnread MVIsp PurgeDataUnsent MVIsp PurgeDataUnread ProSoft Technology Inc February 20 2013 Page 191 of 239 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum Miscellaneous MVIsp_GetVersionInfo Page 192 of 239 ProSoft Technology Inc
178. ort multi threading with Digital Mars C 8 49 Note The ADM DOS 6 XL operating system has a system tick of 5 milliseconds Therefore thread scheduling and timer servicing occur at 5ms intervals Refer to the DOS 6 XL Developer s Guide on the distribution CD ROM for more information Multi threading is also supported by the API DOS and cipapi libraries have been tested and are thread safe for use in multi threaded applications MVlIbp and MVisp libraries are safe to use in multi threaded applications with the following precautions If you call the same MVIbp or MVIsp function from multiple threads you will need to protect it to prevent task switches during the function s execution The same is true for different MV bp or MVIsp functions that share the same resources for example two different functions that access the same read or write buffer Page 56 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Understanding the PTQ ADM API C Programmable Network Interface Module for Quantum Developer Guide WARNING ADM and ADMNET libraries are not thread safe ProSoft Technology Inc does not support the use of ADM and ADMNET libraries in multi threaded applications 7 2 Development Tools An application that is developed for the PTQ ADM module must be stored on the module s Flash ROM disk to be executed Tools are provided with the API to build the disk image and download it to the module vi
179. pecifies the word in the output image to begin reading and length specifies the number of words to read The error MVI ERR BADPARAM will be returned if an attempt is made to access the output image beyond the range configured for direct I O Refer to the MVIbp SetlOConfig function for more information The output image is written by the control processor and read by the module Return Value MVI SUCCESS The data was read from the output image successfully MVI ERR NOACCESS handle does not have access MVI ERR BADPARAM Parameter contains invalid value MVI ERR BADCONFIG The data connection is not open Example MVIHANDLE Handle WORD buffer 8 int re Read 8 words of data from the output image starting with word 2 rc MVIbp ReadOutputImage Handle buffer 2 8 if rc MVI_SUCCESS printf ERROR MVIbp ReadOutputImage failed See Also MVIbp SetlOConfig page 171 MVIbp Writelnputlmage page 176 ProSoft Technology Inc Page 175 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIbp Writelnputlmage Syntax int MVIbp WriteInputImage MVIHANDLE handle WORD buffer WORD offset WORD length Parameters handle Handle returned by previous call to MVIbp Open buffer Pointer to buffer of data to be written to input image offset Word offset into input image at whi
180. pen Return Value Returns NULL if not successful Returns pointer to int if successful Example ADMHANDLE adm handle int offset int iy i ADM GetDBIptr adm handle offset Page 134 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM GetDBint Syntax int ADM GetDBIptr ADMHANDLE adm handle int offset Parameters adm handle Handle returned by previous call to ADM Open offset Word offset into database Description This function obtains an int corresponding to the database offset location adm handle must be a valid handle returned from ADM Open Return Value Returns 0 if not successful Returns int requested if successful Example ADMHANDLE adm handle int offset int i i ADM GetDBInt adm handle offset ProSoft Technology Inc Page 135 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBChanged Syntax int ADM DBChanged ADMHANDLE adm handle int offset Parameters adm handle Handle returned by previous call to ADM Open offset Word offset into database Description This function checks to see if a register has changed since the last call to ADM DBChanged adm handle must be a valid handle returned
181. point number from the database ADM DBSetFloat Write a floating point number to the database ADM DBGetDFloat Read a double floating point number from the database ADM DBSetDFloat Write a double floating point number to the database ADM DBGetBuff Reads a character buffer from the database ADM DBSetBuff Writes a character buffer to the database ADM DBGetRegs Read multiple word registers from the database ADM DBSetRegs Write multiple word registers to the database ADM DBGetsString Read a string from the database ADM DBSetsString Write a string to the database ADM DBSwapWord Swaps bytes within a word in the database ADM DBSwapDWord Swaps bytes within a double word in the database Page 98 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide Function Function Name Description Category ADM GetDBOptr Get a pointer to a character in the database ADM GetDBlptr Get a pointer to a word in the database ADM GetDBint Returns an integer from the database ADM DBChanged Tests a database register for a change ADM DBBitChanged Tests a database bit for a change ADM DBOR Byte Inclusive OR a byte with a database byte ADM DBNOR Byte Inclusive NOR a byte with a d
182. r can overwrite the other Return Value MVI_SUCCESS The input scan has occurred MVI_ERR_NOACCESS handle does not have access MVI_ERR_BADPARAM lednum or ledstate is invalid Example MVIHANDLE Handle Set the Status indicator to Red MVIbp SetModuleStatus Handle MVI MODULE STATUS FAULTED ProSoft Technology Inc Page 185 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIbp GetConsoleMode Syntax int MVIbp GetConsoleMode MVIHANDLE handle int mode int baud Parameters handle Handle returned by previous call to MVIbp Open mode Pointer to an integer that is set to 1 if the console is installed or 0 if the console is not enabled baud Pointer to an integer that is set to the console baud rate index if the console is enabled Description This function is used to query the state of the console handle must be a valid handle returned from MVIbp Open mode is a pointer to an integer When this function returns mode will be set to 1 if the console is enabled or 0 if the console is disabled baud is a pointer to an integer When this function returns baud will be set to the console s baud index value if the console is enabled baud is not set if the console is disabled It may be useful for an application to detect that the console is enabled and allow user interactio
183. rary Series d Rev dWMn verinfo APISeries verinfo APIRevision Page 222 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Product Specifications C Programmable Network Interface Module for Quantum Developer Guide 12 Product Specifications In This Chapter General Specifications essessesseeeeeeeeeenenenne 224 Hardware Specifications 225 Functional Specifications 226 The PTQ Application Development Module is an backplane compatible module that allows user developed C applications to operate on the platform A great way to speed up custom ASCII data communications or to protect a proprietary algorithm the ADM is a powerful tool for the platform Powerful platform for developing and running C applications on Schneider Electric s processors The PTQ ADM module is a single slot backplane compatible solution for the platform This module is a powerful and programmable solution supporting two fully isolated serial ports allowing the many serial field devices to be integrated into the platform The PTQ ADM module has three serial ports two of which are isolated for field interfaces CFG Debug configuration RS 232 PHT1 Application RS 232 RS 422 or RS 485 PRT2 Application RS 232 RS 422 or RS 485 PRT1 and PRT2 are jumper configured for direct or multi drop field communication The application program can be written to control the two applic
184. rds What Compact Flash card does ProSoft recommend using Some ProSoft products contain a Personality Module or Compact Flash card ProSoft recommends using an industrial grade Compact Flash card for best performance and durability The following cards have been tested with ProSoft s modules and are the only cards recommended for use These cards can be ordered through ProSoft or can be purchased by the customer Approved ST Micro cards 32M SMCO32AFC6E 64M SMCO64AFF6E 128M SMC128AFF6E Approved Silicon Systems cards 256M SSD C25MI 3012 512M SSD C51MI 3012 2G SSD C02GI 3012 4G SSD C04GI 3012 ProSoft Technology Inc Page 13 of 239 February 20 2013 Start Here Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum 1 2 Information for Concept Version 2 6 Users This guide uses Concept PLC Programming Software version 2 6 to configure the Quantum PLC The ProTalk installation CD includes MDC module configuration files that help document the PTQ installation Although not required these files should be installed before proceeding to the next section 1 2 1 Installing MDC Configuration Files 1 From a PC with Concept 2 6 installed choose START PROGRAMS CONCEPT MODCONNECT TOOL This action opens the Concept Module Installation dialog box iff Concept Module Installation File Modules Help 151 xi Installed Modules i
185. re downloading it to the processor Note The following steps show you how to build the project in Unity Pro This is not intended to provide detailed information on using Unity Pro or debugging your programs Refer to the documentation for your processor and for Unity Pro for specialized information To build compile the project 1 Review the elements of the project in the Project Browser 2 When you are satisfied that you are ready to download the project open the BUILD menu and then choose REBUILD ALL PROJECT This action builds compiles the project into a form that the processor can use to execute the instructions in the project file This task may take several minutes depending on the complexity of the project and the resources available on your PC 3 Asthe project is built Unity Pro reports its process in a Progress dialog box with details appearing in a pane at the bottom of the window The following illustration shows the build process under way Unity Pro XL No name gt Ta Structural view CX Station 3 140 CPU 651 60 02 00 bd 3 Configuration An 1 Local Bus 1 Local Quantu SA GFN Project 1 140 BF I Derived Data Types Generating Variables m Derived FB Types e Variables amp FB instant Sana BESEESEEEEEEEEEEEEEEEEEEEEEEEERE M 10 Derived Variables WEE Flementam FR Instan d Local Quantum Drop Analog Communication Counting Discrete Expert Motion HMI RAV mode OFFLI
186. receive files from the module s Compact Flash card drive C ProSoft Technology Inc Page 93 of 239 February 20 2013 Setting Up Your Development Environment PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 8 5 6 Downloading Files From a PC to the ADM Module In order to download files to the module the ADM module s running program must be interrupted To transfer files to the module run the RY EXE program which uses the YModem protocol 1 In HyperTerminal connect to the module at 57600 baud and type the command to halt the program for example Esc or Ctrl C your application must be written to allow itself to exit to the command prompt on request 2 Atthe command prompt type C RY 3 In HyperTerminal open the Transfer menu and then choose Send File File Edit View Call Transfer Help Receive File Capture Text E Send Text File 4 Click the Browse button to navigate to the folder and file to send to the module 5 Chose Ymodem from the Protocol dropdown list and then click Send L Send File Folder C Documents and Settings mrodrigues Filename Protocol ne Close Cancel 6 The Ymodem File Send dialog box shows the file transfer size and remaining time Ymodem file send Sending C AMVINFILE CFG Packet 7 Error checking CRC File size 6K Retries 0 Total retries 0 Files 1 of 1 Last error File EEETE
187. ring buff ADM DBGetBuff adm handle offset char count string buff See Also ADM DBSetBuff page 126 ProSoft Technology Inc Page 125 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBSetBuff Syntax int ADM DBSetBuff ADMHANDLE adm handle unsigned short offset const unsigned short count char str Parameters adm handle Handle returned by previous call to ADM Open offset Character offset into database where the buffer starts count Number of characters to write str String buffer to copy characters from Description This function copies a buffer of characters to the database adm_handle must be a valid handle returned from ADM_Open Return Value NULL adm_handle has no access the database is not allocated or count offset is beyond the max size of the database Characters from buffer Example ADMHANDLE adm handle unsigned short offset const unsigned short char count char string buff MVI ADM char count strlen string buff ADM DBSetBuff adm handle offset char count string buff See Also ADM DBGetBuff page 125 Page 126 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network Interface Module for Quantum Developer Guide ADM DBGetRegs Syntax
188. roject 64 Byte 233 Cable Connections 48 Calling Convention 56 CIP 233 Configuring Borland C 5 02 74 Configuring Digital Mars C 8 49 64 Configuring the Processor with Concept 17 Configuring the Processor with ProWORX 31 Configuring the Processor with Unity Pro 35 Connect Your PC to the Processor 41 Connecting to the Module 88 Connecting to the Processor with TCPIP 43 Connection 233 Consumer 233 ProSoft Technology Inc February 20 2013 Page 237 of 239 Index Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Controller 233 Create a New Project 18 36 Creating a New Borland C 5 02 ADM Project 76 Creating a New Digital Mars C 8 49 ADM Project 67 Creating a ROM Disk Image 82 D Database 60 Debugging Strategies 95 Development Tools 57 DLL 233 DOS 6 XL Reference Manual 54 227 Download the Project to the Processor 24 Download the Project to the Quantum Processor 44 Downloading a ROM Disk Image 84 93 Downloading Files From a PC to the ADM Module 94 Downloading the Sample Program 64 74 E Embedded I O 234 Enabling the Console 89 ExplicitMsg 234 F Functional Specifications 226 G General Specifications 224 H Hardware 61 Hardware and Software Requirements 12 Hardware Specifications 225 Header File 56 How to Contact Us Technical Support 230 HSC 234
189. s discarded and is no longer available for reading Note If handshaking is enabled and the transmitting serial device has been paused this function will release the transmitting serial device to resume transmission Return Value MVI SUCCESS The data was purged successfully MVI ERR BADPARAM invalid comport MVI ERR NOACCESS The comport has not been opened Example if MVIsp PurgeDataUnread COM1 MVI SUCCESS printf Transmit Data purged n See Also MVIsp PurgeDataUnsent page 220 ProSoft Technology Inc Page 221 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 11 5 Serial Port API Miscellaneous Functions MVIsp GetVersionlnfo Syntax int MVIsp GetVersionInfo MVISPVERSIONINFO verinfo Parameters verinfo Pointer to structure of type MVISPVERSIONINFO Description MVIsp GetVersionlnfo Retrieves the current version of the API The version information is returned in the structure verinfo The MVISPVERSIONINFO structure is defined as follows typedef struct tagMVISPVERSIONINFO WORD APISeries API series WORD APIRevision API revision MVISPVERSIONINFO Return Value MVI SUCCESS The version information was read successfully Example MVISPVERSIONINFO verinfo print version of API library MVIsp GetVersionInfo amp verinfo printf Lib
190. s for specific user applications It is the duty of any such user or integrator to perform the appropriate and complete risk analysis evaluation and testing of the products with respect to the relevant specific application or use thereof Neither ProSoft Technology nor any of its affiliates or subsidiaries shall be responsible or liable for misuse of the information contained herein Information in this document including illustrations specifications and dimensions may contain technical inaccuracies or typographical errors ProSoft Technology makes no warranty or representation as to its accuracy and assumes no liability for and reserves the right to correct such inaccuracies or errors at any time without notice If you have any suggestions for improvements or amendments or have found errors in this publication please notify us No part of this document may be reproduced in any form or by any means electronic or mechanical including photocopying without express written permission of ProSoft Technology All pertinent state regional and local safety regulations must be observed when installing and using this product For reasons of safety and to help ensure compliance with documented system data only the manufacturer should perform repairs to components When devices are used for applications with technical safety requirements the relevant instructions must be followed Failure to use ProSoft Technology software or approved software with our hardware pr
191. s imported select I O SERIES as QUANTUM gt Schneider Alliances DER e UT DS uM I A Pe REN QD i 1 0 series Quantum Series Add Delete Import Esport Value Card ID 0424H Card Description PTQ AFC Medium Description Flow Computer Module Long Description Gas Liquid Flow Computer Communication Power 800 Number of Parameters Used 0 Default Number of Parameters 0 In Bytes 0 Dut Bytes 0 Module Type D Discrete Doc Only 1 True MCS Simple 1 0 Ordinary MCS Simple 2 0000 0000 Default Parameter Data Rack View Bitmap PTOAFC bmp Drop View Bitmap PTOAFC bmp Page 32 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Configuring the Processor with ProWORX C Programmable Network Interface Module for Quantum Developer Guide Now you can close the Schneider alliances application and run the ProoWORX 32 software At the Traffic Cop section select the PTQ module to be inserted at the slot ProWORX 32 SAFTESTTEST Offline Traffic Cop SAFTESTIEST fe fel f Ble Edt view window Help le x DE amp m ec XB a OY Oe a e n e 5 SEU AD f A e aa a Q MEL 6 Direct To Online My Computer wL Nst demo Lj SAFTESTTEST lt Offlin 420 Configuration F Traffic Cop Communications E Logic m Data Editors Configuration Extensior ASCII Messages H PLC Status Ei Analyze Device Efl Knowle
192. seseees eterne e a ea ennt enne sinn intr trennen nnns 186 MV lbp GetSet pMode 1 edet tha ein estt ata idl i ER d ena eat 187 MVIbp GetProcessorStatus ssssssssssssssesenes einen a a naana ta nennt isis ae eaat 188 MVWIbp SIe6p diminutio atin ted en pnt eet eet 189 MV lbp SetGonsoleMode 4 et mete ee beet ert eee eren Rene EX RR ARE eua 190 11 Serial Port Library Functions 191 11 1 Serial Port API Initialization Functions sesesseeeeeeennen 193 MV ISP OPO ERI II 193 MV Isp OpenA lt iatan EI 195 MV Spi Glos Einsi EE 197 11 2 Serial Port API Configuration Functions c ccceeceeeeeeeeeeeeeeeeeeeeeetaeeteaeeeeeneess 198 MV ISG Ong MT IE 198 MVIsp_SetHandshaking cccccceceeeceeeeeeeeeceeeeeeeceaeeeeaaeseeaeeseaeeecaaeseeaaesdeneeseaeeesaeeeeaaeeseneesaas 199 11 3 Serial Port API Status Functions sess eene 200 MV ISpeSetR S niei etia aa E ed te ie dE D pte rode diei De Tea eee pees dp Ie nores 200 MY Isp GetR XE 201 IEEE IPAU LC m 202 MVlIsp GetDTR aiit inte ertet rte iria ap Dp ente i e eee Fes o tct e edens 203 MV ISP Gel T i i ht erae t Rer babeant aem rca E A orgie teak 204 MVISp GelD9B iint eR ERE IOS iEn tenait ritmo ieu iSE 205 MVISp GelDGL 1 teneor es vacua E ce acc nani rt tas gu cn ci use oy IR eem a E asc NS aS 206 MVIsp GetLineStatus esses entrent nennen nsn treten ness ssi tnnt tenens 207 11 4 Serial Port
193. should always be called before exiting the application Return Value MVI SUCCESS API was opened successfully MVI ERR REOPEN API is already open MVI ERR NODEVICE Backplane driver could not be accessed Note MVI ERR NODEVICE will be returned if the backplane device driver is not loaded Example MVIHANDLE Handle if MVIbp Open amp Handle MVI SUCCESS printf Open failed n else printf Open succeeded n See Also MVIbp Close page 168 ProSoft Technology Inc Page 167 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIbp Close Syntax int MVIbp Close MVIHANDLE handle Parameters handle Handle returned by previous call to MVIbp Open Description This function is used by an application to release control of the API handle must be a valid handle returned from MVIbp Open IMPORTANT After the API has been opened this function should always be called before exiting the application Return Value MVI SUCCESS API was closed successfully MVI ERR NOACCESS Handle does not have access Example MVIHANDLE Handle MVIbp Close Handle See Also MVIbp Open page 167 Page 168 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Backplane API Functions C Programmable Network Interface Module for Quantum Developer Gu
194. sor handle must be a valid handle returned from MVIbp Open Upon calling this function length should contain the message size in words buffer must point to a buffer of at least length words in size If length exceeds the maximum message size specified by the value MsgSndBufSize refer to the MVIbp SetlOConfig function MVI ERR BADPARAM will be returned timeout specifies the number of milliseconds that the function will wait for the message to transfer to the control processor If the timeout occurs before the message has been transferred MVI ERR TIMEOUT will be returned If timeout is 0 the function will return immediately If the message was successfully queued to be sent MVI SUCCESS will be returned If the message was not queued for example a previous message is being sent MVI ERR TIMEOUT will be returned and the message must be re tried at a later time A timeout of 0 allows an application to perform other tasks while the message is being transmitted Before this function can be used messaging must be enabled with the MVIbp SetlOConfig function If messaging has not been enabled MVI ERR BADCONFIG will be returned Notes The MVIbp SendMessage function copies the message data into a buffer to be retrieved by the processor via a MSG instruction The MSG instruction must be configured as shown in table B The MSG instruction implements a get attribute command to the PTQ module s assembly object The MSG instruction will f
195. sp SetRTS int comport int state Parameters comport Port for which RTS is to be changed state Desired RTS state Description This functions allows the state of the RTS signal to be controlled comport must be previously opened with MVIsp Open state specifies desired state of the RTS signal Valid values for state are ON and OFF Note If RTS CTS hardware handshaking is enabled using the MVIsp SetRTS function will cause unpredictable results Return Value MVI SUCCESS The RTS signal was set successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid state Example int rc rc MVIsp SetRTS COM1 ON if rc MVI SUCCESS printf SetRTS failed n See Also MVIsp GetRTS page 201 Page 200 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Serial Port Library Functions C Programmable Network Interface Module for Quantum Developer Guide MVIsp GetRTS Syntax int MVIsp GetRTS int comport int state Parameters comport Port for which RTS is requested state Pointer to int for desired state Description This function allows the state of the RTS signal to be determined comport must be previously opened with MVIsp Open The current state of the RTS signal is copied to the int pointed to by state Return Value MVI SUCCESS The RTS state was read successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARA
196. successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid parameter MVI ERR TIMEOUT Timeout elapsed before bytes sent Example BYTE dd 5 10 20 30 40 50 int nn nn 5 if MVIsp PutData COM1 amp dd 0 amp nn 1000L MVI SUCCESS printf Sd bytes were sent n nn See Also MVIsp PutCh page 208 MVIsp Puts page 210 ProSoft Technology Inc Page 213 of 239 February 20 2013 Serial Port Library Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIsp Gets Syntax int MVIsp Gets int comport BYTE str BYTE term int len DWORD timeout Parameters comport Port from which data is to be received str Pointer to array of bytes to receive data term Termination character of data len Number of bytes to receive bytes received timeout Amount of time to wait to receive character Description This function receives an array of bytes from a serial port comport must be previously opened with MVIsp Open str points to an array of bytes that will receive the data len points to the number of bytes to receive MVIsp Gets retrieves bytes from the reception queue until either a byte is equal to the termination character or the number of bytes pointed to by len are retrieved If a byte is retrieved that equals the termination character the byte is copied into the array str and the function returns All d
197. t timer2 long timeoutl long timeout2 timeoutl 10000000L set timeout for 10 seconds timerl ADM StartTimer adm handle wait until timer 1 times out while ADM CheckTimer adm handle amp timerl amp timeoutl timeout2 5000000L set timeout for 5 seconds timer2 ADM StartTimer adm handle wait until timer 2 times out while ADM CheckTimer adm handle amp timer2 amp timeout2 See Also ADM StartTimer page 144 ProSoft Technology Inc Page 145 of 239 February 20 2013 Application Development Libraries Developer Guide PTQ ADM C Programmable C Programmable Network Interface Module for Quantum 9 6 ADM API Backplane Functions ADM_BtOpen Syntax int ADM BtOpen ADMHANDLE adm handle ADM INTERFACE adm interface ptr int verbose Parameters adm handl e Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to structures verbose Switch to enable status messages to the debug port A 1 will enable messages and a 0 will disable the messages Descriptio n This function opens and initializes the backplane interface Return Val ue ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access Backplane error number If there is an error writing to the backplane during initialization the error
198. t to a port is queued before transmission across the serial port Therefore some delay may occur between the time after this function returns and the actual time that the character is transmitted across the serial line This function attempts to insert the character into the transmission queue and return values correspond accordingly timeout specifies the amount of time in milliseconds to wait If timeout is TIMEOUT ASAP the function will return immediately if the character cannot be queued immediately If timeout is TIMEOUT FOREVER the function will not return until the character is queued successfully If the character can be queued immediately MVIsp Putch returns MVI SUCCESS If the character cannot be queued immediately MVIsp Putch tries to queue the character until the timeout elapses If the timeout elapses before the character can be queued MVI ERR TIMEOUT is returned Note If handshaking is enabled and the receiving serial device has paused transmission timeouts may occur after the queue becomes full Return Value MVI SUCCESS The char was sent successfully MVI ERR NOACCESS comport has not been opened MVI ERR BADPARAM Invalid parameter MVI ERR TIMEOUT Timeout elapsed before character sent Example if MVIsp Putch COM1 1000L MVI SUCCESS printf Semicolon could not be sent in 1 second n See Also MVIsp GetCh page 209 MVIsp Puts page 210 MVIsp PutData page 212 Page 208 of 239
199. ter the disk image has been transferred reboot the PTQ module by selecting the REBOOT MODULE menu item 10 Exit the MVIUPDAT EXE utility by pressing Esc Page 84 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Setting Up Your Development Environment C Programmable Network Interface Module for Quantum Developer Guide 8 4 PTQ System BIOS Setup The BIOS Setup for the PTQ products contains module configuration settings and allows for placing the PTQ module in a flash update mode To access the BIOS Setup attach a null modem cable from the PC COM port to the Status Debug port on the PTQ module Start Hyper Term with the appropriate communication settings for the Debug port Press CTRL C during the memory test portion in the booting of the module ROT Fa Ed Ven Cab Tune Hep Dl ol 3 solas eel If fGen s S906 EE pierced BIOS tm Version 4 1 Copyr tant T 1998 Gen ware Inc Prosoft Tec no ogy MVIS6 Com Module Proso ft Tec al Suppo et OL e61 tte oed NT Bros v1 81 ight c 1999 2000 Online Development Inc 90512 KB 0K it 7C if you want to run SETUP 80C386 EK 4 1 0160 8880 Dacorracied ANSIA 19900841 nm It may be necessary to install the setup jumper in order to access the BIOS Setup The setup jumper will be necessary if the Console is disabled The following illustration shows the BIOS Setup screen Prela Hippes Tovwanad Fa Edi View C
200. terface ptr ADM INTERFACI interface interface ptr amp interface sprintf interface buff MVI ADM n interface buff ch 0 interface buff len strlen interface buff write buffer to console while interface buff len my E E B interface buff len ADM ConPrint adm handle interface ptr ProSoft Technology Inc Page 107 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM CheckDBPort Syntax int ADM CheckDBPort ADMHANDLE adm handle Parameters adm handle Handle returned by previous call to ADM Open Description This function checks for input characters on the debug port adm handle must be a valid handle returned from ADM Open Return Value ADM ERR NOACCESS adm handle does not have access Returns the character input to the debug port Example int key key ADM CheckDBPort adm handle printf key i n key Page 108 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Application Development Libraries Developer Guide 9 4 ADM API Database Functions ADM_DBOpen Syntax int ADM DBOpen ADMHANDL Parameters E adm handle unsigned short max size adm handle Handle returned by previous call to ADM Open max size Ma
201. to download a ROM disk image 1 2 Connect a null modem serial cable between the serial port on the PC and PRT1 on the PTQ module If you are using HyperTerm or a similar terminal program for the PTQ ADM module console exit or disconnect from the serial port before running the MVI Flash Update tool Turn off power to the PTQ module Install the Setup Jumper as described in the Installation Instructions Click the START button and then choose RUN In the OPEN field enter mvruppat Specify the PC port on the command line as shown in the following illustration The default is COM1 Run L2 1x1 Type the name of a program folder document or Internet resource and Windows will open it for you Open MVIUPDAT PORT COM2 m Cancel Browse Turn on power to the PTQ module You should see the following menu shown on the host PC Verify Module Connection Update Flash Disk Image Reboot Module Select VERIFY MODULE CONNECTION to verify the connection to the PTQ module If the connection is working properly the message Module Responding will be displayed Note If an error occurs check your serial port assignments and cable connections You may also need to cycle power more than once before the module responds 8 9 Select UPDATE FLASH DISK IMAGE to download the ROM disk image Type the image file name when prompted The download progress is displayed as the file is being transmitted to the module Af
202. to synchronize with the scan of the module s input image This function will return immediately after the input image has been read handle must be a valid handle returned from MVlbp Open timeout specifies the number of milliseconds that the function will wait for the input scan to occur Return Value MVI SUCCESS The input scan has occurred MVI ERR NOACCESS handle does not have access MVI ERR TIMEOUT The timeout expired before an input scan occurred Example MVIHANDLE Handle Wait here until input scan 50ms timeout rc MVIbp WaitForInputScan Handle 50 if rc MVI ERR TIMEOUT printf Input scan did not occur within 50 milliseconds Mn else printf Input scan has occurred Mn See Also MVIbp WaitForOutputScan page 174 ProSoft Technology Inc Page 173 of 239 February 20 2013 Backplane API Functions PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum MVIbp WaitForOutputScan Syntax int MVIbp WaitForOutputScan MVIHANDLE handle WORD timeout Parameters handle Handle returned by previous call to MVIbp Open timeout Maximum number of milliseconds to wait for scan Description MVIbp WaitForlnputScan allows an application to synchronize with the scan of the module s output image This function will return immediately after the module s output image has been written handle must be a valid handle returned from MVlbp
203. uantum T Target The end node to which a connection is established by an originator Thread Code that is executed within a process A process may contain multiple threads Ww Word 16 bit value Page 236 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable C Programmable Network Interface Module for Quantum Index Developer Guide Index A Add the PTQ Module to the Project 20 38 ADM API 58 ADM API Architecture 58 ADM API Backplane Functions 146 ADM API Clock Functions 144 ADM API Database Functions 109 ADM API Debug Port Functions 102 ADM API Functions 98 ADM API Initialization Functions 100 ADM API Miscellaneous Functions 154 ADM API RAM Functions 157 ADM LED Functions 153 ADM BtClose 146 147 ADM BtFunc 150 ADM BtNext 148 ADM BtOpen 146 147 148 149 150 ADM CheckDBPort 108 ADM CheckTimer 144 145 ADM Close 100 101 ADM ConPrint 107 ADM DAWriteRecvCtl 103 104 ADM DAWriteRecvData 105 106 ADM DAWriteSendCtl 103 104 ADM DAWriteSendData 105 106 ADM DBAND Byte 140 ADM DBBitChanged 137 ADM DBChanged 136 ADM DBClearBit 113 114 ADM DBClose 109 110 ADM DBGetBit 112 ADM DBGetBuff 125 126 ADM DBGetByte 115 116 ADM DBGetDFloat 123 124 ADM DBGetFloat 121 122 ADM DBGetLong 119 120 ADM DBGetRegs 127 128 ADM DBGetString 129 130 ADM DBGetWord 117 118 ADM DBNAND Byte 141
204. upply and then click the right mouse button to open a shortcut menu On the shortcut menu choose NEW DEVICE Local Bus 140 CPU 651 60 02 00 X 4 Expand the Supply folder and then select your power supply from the list Click OK to continue New Device Address Counting Discrete Expert Motion Supply 140 CPS 111 00 140 CPS 114 20 140CPS 114 X0 140 CPS 124 00 140 CPS 124 20 140 CPS 211 00 140 CPS 214 00 140 CPS 224 00 140 CPS 414 00 140 CPS 424 00 140 CPS 511 00 140 CPS 524 00 AC Standalone PS 115 230V 3A AC Summable PS 120 230V AC Standalone PS 115 230V 8A AC Redundant PS 115 230V 8A AC Redundant PS 120 230V DC Standalone PS 24V 3A DC Summable PS 24V 10A DC Redundant PS 24V 8A DC Summable PS 48V 8A DC Redundant PS 48V 8A DC Standalone PS 125V 3A DC Redundant PS 125V 8A 5 Repeat these steps to add any additional devices to your Quantum Rack ProSoft Technology Inc February 20 2013 Page 37 of 239 Configuring the Processor with Unity Pro PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum 4 2 Add the PTQ Module to the Project 1 Expand the Communicationtree and select GEN NOM This module type provides extended communication capabilities for the Quantum system and allows communication between the PLC and the PTQ module without requiring additional programming Unity Pro XL No name gt ile Edit Vie e l
205. used to perform boundary checking on the configuration parameters Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access or configuration was interrupted by operator ADM ERR NOTSUPPORTED This function is not supported on this platform Example ADMHANDLE adm handle ADM INTERFACE interface ptr int verbose 1 ADM INTERFACE interface interface ptr amp interface ADM ReadBtCfg adm handle interface ptr verbose See Also ADM BtOpen page 146 ProSoft Technology Inc Page 149 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM BtFunc Syntax int ADM BtFunc ADMHANDLE adm handle ADM INTERFACE adm interface ptr int verbose Parameters adm handle Handle returned by previous call to ADM Open adm interface ptr Pointer to ADM INTERFACE structure to allow API access to i structures verbose Switch to enable status messages to the debug port A 1 will enable messages and a 0 will disable the messages Description This function Return Value handles the transfer of data across the backplane 0 Block transfer was successful 1 Invalid block number received Example ADMHANDLE adm handle ADM INTERFACE interface ptr int verbose 1 ADM INTERFACE interface
206. ust be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle int offset unsigned char bval 0x55 ADM DBNAND Byte adm handle offset bval ProSoft Technology Inc Page 141 of 239 February 20 2013 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBXOR Byte Syntax int ADM DBXOR Byte ADMHANDLE adm handle int offset unsigned char bval Parameters adm handle Handle returned by previous call to ADM Open offset Byte offset into database bval Bit mask to be XORed with the byte at offset Description This function XORs a byte in the database with a byte long bit mask adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR MEMORY database is not allocated ADM ERR REG RANGE offset is out of range Example ADMHANDLE adm handle int offset unsigned char bval 0x55 ADM DBXOR Byte adm handle offset bval Page 142 of 239 ProSoft Technology Inc February 20 2013 PTQ ADM C Programmable Application Development Libraries C Programmable Network I
207. vides a library of function calls The library supports any programming language that is compatible with the Pascal calling convention Each API library is a static object code library that must be linked with the application to create the executable program It is distributed as a 16 bit large model OMF library compatible with Digital Mars or Borland development tools Note The following compiler versions are intended to be compatible with the PTQ module API Digital Mars C 8 49 Borland C V5 02 More compilers will be added to the list as the API is tested for compatibility with them 7 1 1 Calling Convention The API library functions are specified using the C programming language syntax To allow applications to be developed in other industry standard programming languages the standard Pascal calling convention is used for all application interface functions 7 1 2 Header File A header file is provided along with each library This header file contains API function declarations data structure definitions and miscellaneous constant definitions The header file is in standard C format 7 1 3 Multithreading Considerations The DOS 6 XL operating system supports the development of multi threaded applications Note The multi threading library kernel lib in the DOS folder on the distribution CD ROM is compiler specific to Borland C 5 02 It is not compatible with Digital Mars C 8 49 ProSoft Technology Inc does not supp
208. ximum number of words in the database Description This function creates a database in the RAM area of the PTQ ADM module adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access ADM ERR DB MAX SIZE max size has exceeded the maximum allowed ADM ERR REG RANGE max size requested was zero ADM ERR OPEN Database already created ADM ERR MEMORY Insufficient memory for database ADM SUCCI Example ADMHANDLE adm handle if ADM DBOpen adm handle ADM MAX DB REGS printf Error setting up Database Nin See Also ADM DBClose page 110 ESS ProSoft Technology Inc February 20 2013 Page 109 of 239 Application Development Libraries PTQ ADM C Programmable Developer Guide C Programmable Network Interface Module for Quantum ADM DBClose Syntax int ADM DBClose ADMHANDLE adm handle Parameters adm handle Handle returned by previous call to ADM Open Description This function closes a database previously created by ADM DBOpen adm handle must be a valid handle returned from ADM Open Return Value ADM SUCCESS No errors were encountered ADM ERR NOACCESS adm handle does not have access Example ADMHANDLE adm handle ADM DBClose adm handle See Also ADM DBOpen page 109 Page 110 of 239 ProSoft Technology In

Download Pdf Manuals

image

Related Search

Related Contents

HP ZBook 14    Anwenderanleitung - Flowserve Corporation  Mode d`emploi ä bande magn6tique  ン S  VOXX ARS140PDPK  Sequoia Spirit Wood-Frame-Pool-Set  Propak User Manual - English  自動スプレーガンニードル弁脱着方法  AeroCartTM AeroCartTM AeroCartTM AeroCartTM  

Copyright © All rights reserved.
Failed to retrieve file