stepRocker servo 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 //TMCL status codes
59 #define REPLY_OK 100
60 #define REPLY_CHKERR 1
61 #define REPLY_INVALID_CMD 2
62 #define REPLY_WRONG_TYPE 3
63 #define REPLY_INVALID_VALUE 4
64 #define REPLY_EEPROM_LOCKED 5
65 #define REPLY_CMD_NOT_AVAILABLE 6
66 #define REPLY_CMD_LOAD_ERROR 7
67 #define REPLY_WRITE_PROTECTED 8
68 #define REPLY_MAX_EXCEEDED 9
69 
70 //Reply format
71 #define RF_STANDARD 0
72 #define RF_SPECIAL 1
73 
74 //Data structures needed by the TMCL interpreter
76 typedef struct
77 {
81  union
82  {
83  long Int32;
84  UCHAR Byte[4];
85  } Value;
86 } TTMCLCommand;
87 
89 typedef struct
90 {
93  union
94  {
95  long Int32;
96  UCHAR Byte[4];
97  } Value;
98 } TTMCLReply;
99 
100 
101 //Prototypes of exported functions
102 void InitTMCL(void);
103 void ProcessCommand(void);
void ProcessCommand(void)
Fetch and execute TMCL commands.
Definition: Commands.c:164
UCHAR Status
status code
Definition: Commands.h:91
TMCL reply.
Definition: Commands.h:89
UCHAR Opcode
opcode of executed command
Definition: Commands.h:92
TMCL command.
Definition: Commands.h:76
UCHAR Opcode
command opcode
Definition: Commands.h:78
void InitTMCL(void)
Initialize TMCL interpreter.
Definition: Commands.c:148
long Int32
value parameter as 32 bit integer
Definition: Commands.h:83
unsigned char UCHAR
8 bits unsigned
Definition: stepRocker.h:31
UCHAR Motor
motor/bank parameter
Definition: Commands.h:80
UCHAR Type
type parameter
Definition: Commands.h:79
long Int32
reply value as 32 bit integer
Definition: Commands.h:95