Editing SimpleMotion V2 API documentation

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help page.

Latest revision Your text
Line 44: Line 44:
 
===General===
 
===General===
 
{{APIdoc|smuint32|smGetVersion|()|Return SM lib version number in hexadecimal format.
 
{{APIdoc|smuint32|smGetVersion|()|Return SM lib version number in hexadecimal format.
Ie V 2.5.1 would be 0x020501 and 1.2.33 0x010233|
+
Ie V 2.5.1 would be 0x020501 and 1.2.33 0x010233}}
;return value
+
:SMV2 library version
+
}}
+
  
{{APIdoc|smbus|smOpenBus|( const char * devicename )|Open SM RS485 communication bus.|
+
{{APIdoc|smbus|smOpenBus|( const char * devicename )|Open SM RS485 communication bus.}}
 
;devicename:  
 
;devicename:  
 
:"USB2VSD" or com port as "COMx" where x=1-n, i.e. "COM15". In UNIX systems this is device path such as "/dev/ttyUSB0".
 
:"USB2VSD" or com port as "COMx" where x=1-n, i.e. "COM15". In UNIX systems this is device path such as "/dev/ttyUSB0".
 
;return value
 
;return value
 
:handle to be used with all other commands, -1 if fails
 
:handle to be used with all other commands, -1 if fails
}}
 
 
 
Usage:
 
Usage:
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
Line 66: Line 61:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
{{APIdoc|SM_STATUS|smCloseBus|( const smbus bushandle )|Close connection to given bus handle number. This frees communication link therefore makes it available for other apps for opening.|
+
{{APIdoc|SM_STATUS|smCloseBus|( const smbus bushandle )|Close connection to given bus handle number. This frees communication link therefore makes it available for other apps for opening.}}
 
;return value
 
;return value
 
:a SM_STATUS value, i.e. SM_OK if command succeed. The SM_STATUS return value from all other functions have similar meaning.
 
:a SM_STATUS value, i.e. SM_OK if command succeed. The SM_STATUS return value from all other functions have similar meaning.
}}
 
 
Usage:
 
Usage:
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
Line 81: Line 75:
 
:A pointer to output stream such as stderr, stdout or a file handle.
 
:A pointer to output stream such as stderr, stdout or a file handle.
  
{{APIdoc|SM_STATUS|getCumulativeStatus|( const smbus handle )|Returns all occurred SM_STATUS bits after smOpenBus or resetCumulativeStatus call|
+
{{APIdoc|SM_STATUS|getCumulativeStatus|( const smbus handle )|Returns all occurred SM_STATUS bits after smOpenBus or resetCumulativeStatus call}}
;handle
+
:SimpleMotion bus handle as returned from smOpenBus
+
}}
+
 
For example, this returns SM_OK if all past function calls completed without errors (does not report errors that target device may have, just SM communication related errors). I.e. will return SM_OK|SM_ERR_LENGTH (=decimal value 33) in case of some command returned SM_OK and another SM_ERR_LENGTH.  
 
For example, this returns SM_OK if all past function calls completed without errors (does not report errors that target device may have, just SM communication related errors). I.e. will return SM_OK|SM_ERR_LENGTH (=decimal value 33) in case of some command returned SM_OK and another SM_ERR_LENGTH.  
  
 
This function is provided to ease error checking by eliminating the need to inspect return value of each individual function call separately. Instead, programmer may occasionally call this function to check if any errors have occurred during longer period of time.
 
This function is provided to ease error checking by eliminating the need to inspect return value of each individual function call separately. Instead, programmer may occasionally call this function to check if any errors have occurred during longer period of time.
  
{{APIdoc|void|resetCumulativeStatus|( const smbus handle )|Reset cumulative status so getCumultiveStatus returns 0 after calling this until one of the other functions are called|
+
{{APIdoc|void|resetCumulativeStatus|( const smbus handle )|Reset cumulative status so getCumultiveStatus returns 0 after calling this until one of the other functions are called}}
;handle
+
:SimpleMotion bus handle as returned from smOpenBus
+
}}
+
  
 
===Simple communication===
 
===Simple communication===
Line 109: Line 97:
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
 
}}
 
}}
 
+
{{APIdoc|SM_STATUS|smRead2Parameters|( const smbus handle, const smaddr nodeAddress, const smint16 paramId1, smint32 *paramVal1,const smint16 paramId2, smint32 *paramVal2 )|Read two parameter value from the target device with a single function call, this executes faster than two calls of smRead1Parameter}}
{{APIdoc|SM_STATUS|smRead2Parameters|( const smbus handle, const smaddr nodeAddress, const smint16 paramId1, smint32 *paramVal1,const smint16 paramId2, smint32 *paramVal2 )|Read two parameter value from the target device with a single function call, this executes faster than two calls of smRead1Parameter|
+
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 125: Line 112:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
{{APIdoc|SM_STATUS|smRead3Parameters|( const smbus handle, const smaddr nodeAddress, const smint16 paramId1, smint32 *paramVal1,const smint16 paramId2, smint32 *paramVal2 ,const smint16 paramId3, smint32 *paramVal3 )|Read three parameter value from the target device with a single function call, this executes faster than equivalent operation by using smRead1Parameter or smRead2Parameter|
+
{{APIdoc|SM_STATUS|smRead3Parameters|( const smbus handle, const smaddr nodeAddress, const smint16 paramId1, smint32 *paramVal1,const smint16 paramId2, smint32 *paramVal2 ,const smint16 paramId3, smint32 *paramVal3 )|Read three parameter value from the target device with a single function call, this executes faster than equivalent operation by using smRead1Parameter or smRead2Parameter}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 146: Line 132:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
{{APIdoc|SM_STATUS|smSetParameter|( const smbus handle, const smaddr nodeAddress, const smint16 paramId, smint32 paramVal )|Write single parameter value to the target device|
+
 
 +
{{APIdoc|SM_STATUS|smSetParameter|( const smbus handle, const smaddr nodeAddress, const smint16 paramId, smint32 paramVal )|Write single parameter value to the target device}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 159: Line 145:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
 
===Low level communication===
 
===Low level communication===
Line 166: Line 151:
 
Low level communication involves assembing an outbound transmission packet from subpackets (with Append calls), sending it out and getting respose fromn the target device (with Excecute call) and reading out the return packet subpackets (with Get calls).
 
Low level communication involves assembing an outbound transmission packet from subpackets (with Append calls), sending it out and getting respose fromn the target device (with Excecute call) and reading out the return packet subpackets (with Get calls).
  
{{APIdoc|SM_STATUS|smAppendSMCommandToQueue|( smbus handle, int smpCmdType, smint32 paramvalue  )|Appends SM subpacket command to a command queue|
+
{{APIdoc|SM_STATUS|smAppendSMCommandToQueue|( smbus handle, int smpCmdType, smint32 paramvalue  )|Appends SM subpacket command to a command queue}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 175: Line 160:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
{{APIdoc|SM_STATUS|smExecuteCommandQueue|( const smbus bushandle, const smaddr targetaddress )|Sends all subpacket commands to the target device, and reads the response packet from target|
+
{{APIdoc|SM_STATUS|smExecuteCommandQueue|( const smbus bushandle, const smaddr targetaddress )|Sends all subpacket commands to the target device, and reads the response packet from target}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 184: Line 168:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
{{APIdoc|STATUS |smGetQueuedSMCommandReturnValue|(  const smbus bushandle, smint32 *retValue )|Fetches an return value from returned subpacket after the call of smExecuteCommandQueue|
+
{{APIdoc|STATUS |smGetQueuedSMCommandReturnValue|(  const smbus bushandle, smint32 *retValue )|Fetches an return value from returned subpacket after the call of smExecuteCommandQueue}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 193: Line 176:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
 
===Buffered low level communucation===
 
===Buffered low level communucation===
 
Buffered subpackets are executed by the target device in background at timer based schedule. This allows uploading a set of commands to drives that are excecuted at predefined execution rate. Typical application for this is motion control where trajectory points are uploaded to multiple devices and drives will follow the trajectory as commended by the buffered subpackets. Execution clock of all devices in the bus can be synchronized to ensure simultaneous execution of commands over infinite periods of time (eliminate clock drifting).
 
Buffered subpackets are executed by the target device in background at timer based schedule. This allows uploading a set of commands to drives that are excecuted at predefined execution rate. Typical application for this is motion control where trajectory points are uploaded to multiple devices and drives will follow the trajectory as commended by the buffered subpackets. Execution clock of all devices in the bus can be synchronized to ensure simultaneous execution of commands over infinite periods of time (eliminate clock drifting).
  
{{APIdoc|SM_STATUS|smUploadCommandQueueToDeviceBuffer|( const smbus bushandle, const smaddr targetaddress )|Uploads subpackets to the target device buffer. Subpackets are are added to local buffer with smAppendSMCommandToQueue prior to calling this function. This function also downloads returning subpackets that are already executed in the device and updates the value given by smBytesReceived. Returned subpackets may be extracted by smGetQueuedSMCommandReturnValue function.|
+
{{APIdoc|SM_STATUS|smUploadCommandQueueToDeviceBuffer|( const smbus bushandle, const smaddr targetaddress )|Uploads subpackets to the target device buffer. Subpackets are are added to local buffer with smAppendSMCommandToQueue prior to calling this function. This function also downloads returning subpackets that are already executed in the device and updates the value given by smBytesReceived. Returned subpackets may be extracted by smGetQueuedSMCommandReturnValue function.}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 205: Line 187:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
{{APIdoc|SM_STATUS|smBytesReceived|( const smbus bushandle, smint32 *bytesinbuffer )|Gives the amount of how many bytes waiting to be read with smGetQueuedSMCommandReturnValue|
+
 
 +
{{APIdoc|SM_STATUS|smBytesReceived|( const smbus bushandle, smint32 *bytesinbuffer )|Gives the amount of how many bytes waiting to be read with smGetQueuedSMCommandReturnValue}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 214: Line 196:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
{{APIdoc|SM_STATUS|smGetBufferClock|( const smbus handle, const smaddr targetaddr, smuint16 *clock )|Read buffered execution clock value from a device and synchronize clocks of all other bus devices to this clock value. When used, call this at least once per every three seconds to avoid side-effects from value rollover. The first call of this function begins the execution of buffered commands (on single device, or multiple devices simultaneusly).|
+
 
 +
{{APIdoc|SM_STATUS|smGetBufferClock|( const smbus handle, const smaddr targetaddr, smuint16 *clock )|Read buffered execution clock value from a device and synchronize clocks of all other bus devices to this clock value. When used, call this at least once per every three seconds to avoid side-effects from value rollover. The first call of this function begins the execution of buffered commands (on single device, or multiple devices simultaneusly).}}
 
;handle
 
;handle
 
:SimpleMotion bus handle as returned from smOpenBus
 
:SimpleMotion bus handle as returned from smOpenBus
Line 223: Line 205:
 
;Return value
 
;Return value
 
:{{SM_STATUS}}
 
:{{SM_STATUS}}
}}
 
  
 
{{APIdoc|SM_STATUS|smFastUpdateCycle|( smbus handle, smuint8 nodeAddress, smuint16 write1, smuint16 write2, smuint16 *read1, smuint16 *read2)|smFastUpdateCycle-function uses special SimpleMotion command to perform fast turaround communication. May be used with cyclic real time control. Written & read data content may be application & mode specific. This function may be called alone and it completes whole write & read cycle. '''This function is under development, do not use before this notice removed.''' |
 
{{APIdoc|SM_STATUS|smFastUpdateCycle|( smbus handle, smuint8 nodeAddress, smuint16 write1, smuint16 write2, smuint16 *read1, smuint16 *read2)|smFastUpdateCycle-function uses special SimpleMotion command to perform fast turaround communication. May be used with cyclic real time control. Written & read data content may be application & mode specific. This function may be called alone and it completes whole write & read cycle. '''This function is under development, do not use before this notice removed.''' |
Line 237: Line 218:
 
*[[List of SimpleMotion parameters]]
 
*[[List of SimpleMotion parameters]]
 
*[[SimpleMotion motion control strategies]] - examples etc
 
*[[SimpleMotion motion control strategies]] - examples etc
 
[[Category:SimpleMotion]]
 

Please note that all contributions to Granite Devices Knowledge Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Granite Devices Knowledge Wiki:Copyrights for details). Do not submit copyrighted work without permission!

Select categories:

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)