{\rtf1\ansi\ansicpg1252\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fmodern\fprq1 Swiss;}{\f3\fmodern\fprq1 Courier New;}} {\colortbl\red0\green0\blue0;\red0\green240\blue240;\red0\green0\blue255;} \deflang1033\pard\plain\f3\fs20\cf2 'This program example covers features and code for On Board I/O handling \par \par 'Note 1: Not all functions dealing with Communictions control are covered here. \par '\tab This is intended to show exampes of hardware configurations only. \par \par 'Note 2: Examples below show means to obtaing a 10-Bit analog value from each port. \par '\tab This can be done at any time reguardless of what the ports may be being used for \par ' without adversly effecting their use at the time. \par \par \par '===================================================== \par 'Ports A and B: \tab Default to Quadrature Counter input ports. \par '===================================================== \par UAI\tab 'Set Port A as an Input Port \par UAO \tab 'Set Port A as an Output Port \par UA=1\tab \tab 'Set it to 5VDC \par x=UAA\tab 'Assign the 10 Bit analog value of Port A to the variable x \par \par UBI\tab 'Set Port B as an Input Port \par UBO \tab 'Set Port B as an Output Port \par UB=0\tab 'Set it to 0VDC \par x=UBA\tab 'Assign the 10 Bit analog value of Port B to the variable x \par \par MF0\tab 'Set Ports A and B as High Speed Quad Counter and zero counter (CTR) \par \par MS0\tab 'Set Port A as High Speed Pulse Counter \par \tab 'and Port B to Direction input \par \par '===================================================== \par 'Ports C and D:\tab Default to Travel Limit Inputs \par '===================================================== \par 'Note 3:Port C defaults to Right(Posative) Travel Limit Input \par '\tab Port D defaults to Left (Negative) Travel Limit Input \par ' By Default:a SmartMotor will turn off poer to the drive amp when a limit \par '\tab is reached and will have no holding torque. \par \par UCI\tab 'Set Port C as an Input Port \par UCO \tab 'Set Port C as an Output Port \par UC=1\tab \tab 'Set it to 5VDC \par x=UCA\tab 'Assign the 10 Bit analog value of Port C to the variable x \par \par UCP\tab \tab 'Resetting Port C as Limit Switch \par \par \par UDI\tab 'Set Port D as an Input Port \par UDO \tab 'Set Port D as an Output Port \par UD=1\tab \tab 'Set it to 5VDC \par x=UDA\tab 'Assign the 10 Bit analog value of Port D to the variable x \par \par UDM\tab \tab 'Resetting Port D as Limit Switch \par \par LIMN\tab 'Set Limits as non-directional (you can command a position beyond a limit if you drift past it) \par LIMD\tab 'Set Limits as Directional (You cannot command a position past a limt if you have drift past it) \par LIML\tab 'Set Limits to Stop motors when Pulled Low (to ground potential) \par LIMH\tab 'Set Limits to Stop Motors when pulled High (to +5VDC) \par \par 'F command hadling of Ports C and D \par F=4\tab 'This will cause the motor to servo in place when a limit is reached \par F=0\tab 'Setting F to a binary equiv. value not containg 4 will cause motor to free wheel when a limit is reached \par \par 'Note 4: This only shows the F command with respect to control of Ports C and D. \par '\tab It has other uses as well not covered here. \par \par '===================================================== \par 'Ports E and F: Default to Anilink Address and Data Communications Protocal \par '===================================================== \par 'Using Ports E and F as Anilink Port. \par \plain\f2\fs20\cf2 '----------------------------------------------------- \par PRINTA(#56,#12,#6,#1)\tab 'SETUP OF LCD Display at Address A \par \plain\f3\fs20\cf2 PRINTA("Printing to LCD Disp") \par \par a=DINB0\tab \tab 'Reading an 8-Bit Port at Address B on an Anilink Device \par \pard\li1440\fi-1440\plain\f3\fs20\cf2 DOUTC0,255\tab 'Writting out all ones to an 8-Bit Port at Address C on an 'Anilink Device \par \pard\plain\f3\fs20\cf2 \par \plain\f2\fs20\cf2 '----------------------------------------------------- \par \plain\f3\fs20\cf2 'Using Ports E and F for RS-485 Communications: \par \plain\f2\fs20\cf2 '----------------------------------------------------- \par \plain\f3\fs20\cf2 'Opening up Ports E and F as an RS-485 Port \par OCHN(RS4,1,N,38400,1,8,C) \par 'Type:(RS-485), Port:(1), Parity:(None), Buad Rate:(38400), Stop Bits:(1), Data Bits:(8),Usage: (Command mode) \par \par PRINT1("T=50 MT",#13)\tab \tab 'Telling another motor to go into Torque Mode \par \par 'Close Ports E and F as RS-485 Port \par CCHN(RS4,1) \par \plain\f2\fs20\cf2 '----------------------------------------------------- \par \plain\f3\fs20\cf2 'Using Ports E and F as General I/O Ports \par \plain\f2\fs20\cf2 '----------------------------------------------------- \par \plain\f3\fs20\cf2 UEI\tab 'Set Port E as an Input Port \par UEO \tab 'Set Port E as an Output Port \par UE=0\tab 'Set it to 0VDC \par x=UEA\tab 'Assign the 10 Bit analog value of Port E to the variable x \par \par UFI\tab 'Set Port F as an Input Port \par UFO \tab 'Set Port F as an Output Port \par UF=0\tab 'Set it to 0VDC \par x=UFA\tab 'Assign the 10 Bit analog value of Port F to the variable x \par \par '===================================================== \par 'Port G:\tab Defaults as Sync Iput Pin (when pulled to ground, has same effect as G command) \par '===================================================== \par 'Setting Port G up as handshake signal for \par 'using the main RS-232 Port with an RS-232 to RS-485 adapter \par RS4\tab \par 'Note 5: RS4 command should not be used without the intent of using the addapter mentioned above \par \par UG\tab 'resetting Port G as default sync. port. \par \par UGI\tab 'Set Port G as an Input Port \par UGO \tab 'Set Port G as an Output Port \par UG=0\tab 'Set it to 0VDC \par x=UGA\tab 'Assign the 10 Bit analog value of Port G to the variable x \par \par \par \par END \par \plain\f2\fs24\cf2 \par }