stepRocker Open Source TMCL  1.00
 All Data Structures Files Functions Variables Typedefs Enumerations Macros
Commands.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Project: stepRocker Mini TMCL (for stepRocker V2.2)
3 
4  Module: Commands.h
5  Definitions needed for the TMCL interpreter
6 
7 
8  Copyright (C) 2016 TRINAMIC Motion Control GmbH & Co KG
9  Waterloohain 5
10  D - 22769 Hamburg, Germany
11  http://www.trinamic.com/
12 
13  This program is free software; you can redistribute it and/or modify it
14  freely.
15 
16  This program is distributed "as is" in the hope that it will be useful, but
17  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18  or FITNESS FOR A PARTICULAR PURPOSE.
19 *******************************************************************************/
20 
21 
33 //States of the command interpreter
34 #define TCS_IDLE 0
35 #define TCS_UART 1
36 #define TCS_UART_ERROR 2
37 #define TCS_CAN7 3
38 #define TCS_CAN8 4
39 #define TCS_USB 5
40 #define TCS_USB_ERROR 6
41 
42 //Supported TMCL commands
43 #define TMCL_ROR 1
44 #define TMCL_ROL 2
45 #define TMCL_MST 3
46 #define TMCL_MVP 4
47 #define TMCL_SAP 5
48 #define TMCL_GAP 6
49 #define TMCL_GetVersion 136
50 #define TMCL_Boot 0xf2
51 #define TMCL_SoftwareReset 0xff
52 
53 //Type codes of the MVP command
54 #define MVP_ABS 0
55 #define MVP_REL 1
56 #define MVP_COORD 2
57 
58 //Relative positioning options
59 #define RMO_TARGET 0
60 #define RMO_ACTINT 1
61 #define RMO_ACTENC 2
62 
63 //Unit conversion mode
64 #define UNIT_MODE_INTERNAL 0
65 #define UNIT_MODE_PPS 1
66 
67 //TMCL status codes
68 #define REPLY_OK 100
69 #define REPLY_CHKERR 1
70 #define REPLY_INVALID_CMD 2
71 #define REPLY_WRONG_TYPE 3
72 #define REPLY_INVALID_VALUE 4
73 #define REPLY_EEPROM_LOCKED 5
74 #define REPLY_CMD_NOT_AVAILABLE 6
75 #define REPLY_CMD_LOAD_ERROR 7
76 #define REPLY_WRITE_PROTECTED 8
77 #define REPLY_MAX_EXCEEDED 9
78 
79 //Reply format
80 #define RF_STANDARD 0
81 #define RF_SPECIAL 1
82 
83 //Data structures needed by the TMCL interpreter
85 typedef struct
86 {
90  union
91  {
92  long Int32;
93  UCHAR Byte[4];
94  } Value;
95 } TTMCLCommand;
96 
98 typedef struct
99 {
102  union
103  {
104  long Int32;
105  UCHAR Byte[4];
106  } Value;
107 } TTMCLReply;
108 
109 
110 //Prototypes of exported functions
111 void InitTMCL(void);
112 void ProcessCommand(void);
void ProcessCommand(void)
Fetch and execute TMCL commands.
Definition: Commands.c:198
UCHAR Status
status code
Definition: Commands.h:100
TMCL reply.
Definition: Commands.h:98
UCHAR Opcode
opcode of executed command
Definition: Commands.h:101
TMCL command.
Definition: Commands.h:85
UCHAR Opcode
command opcode
Definition: Commands.h:87
void InitTMCL(void)
Initialize TMCL interpreter.
Definition: Commands.c:158
long Int32
value parameter as 32 bit integer
Definition: Commands.h:92
unsigned char UCHAR
8 bits unsigned
Definition: stepRocker.h:31
UCHAR Motor
motor/bank parameter
Definition: Commands.h:89
UCHAR Type
type parameter
Definition: Commands.h:88
long Int32
reply value as 32 bit integer
Definition: Commands.h:104