aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source/c_output.iom
blob: fc26efd7123a4c267f0ba51c8cc61da68df7339a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// Date init       14.12.2004
//
// Revision date   $Date:: 14-11-07 12:40                                    $
//
// Filename        $Workfile:: c_output.iom                                  $
//
// Version         $Revision:: 1                                             $
//
// Archive         $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/c_outp $
//
// Platform        C
//

#ifndef   COUTPUT_IOM
#define   COUTPUT_IOM

#define   NO_OF_OUTPUTS     3
#define   pMapOutPut        ((IOMAPOUTPUT*)(pHeaders[ENTRY_OUTPUT]->pIOMap))

// Constants reffering to mode
enum
{
  MOTORON    = 0x01,
  BRAKE      = 0x02,
  REGULATED  = 0x04,
  REG_METHOD = 0xF0   /* Regulation methods - to be designed! */
};

// Constants related to Flags
enum
{
  UPDATE_MODE		          = 0x01,
  UPDATE_SPEED		          = 0x02,
  UPDATE_TACHO_LIMIT          = 0x04,
  UPDATE_RESET_COUNT          = 0x08,
  UPDATE_PID_VALUES	          = 0x10,
  UPDATE_RESET_BLOCK_COUNT    = 0x20,
  UPDATE_RESET_ROTATION_COUNT = 0x40,
  PENDING_UPDATES             = 0x80  
};

// Constant related to RunState
#define MOTOR_RUN_STATE_IDLE      0x00
#define MOTOR_RUN_STATE_RAMPUP    0x10
#define MOTOR_RUN_STATE_RUNNING   0x20
#define MOTOR_RUN_STATE_RAMPDOWN  0x40

// Constant related to RegMode
enum
{
  REGULATION_MODE_IDLE,
  REGULATION_MODE_MOTOR_SPEED,
  REGULATION_MODE_MOTOR_SYNC
};
											
typedef   struct
{
  SLONG   TachoCnt;						/* R  - Holds current number of counts, since last reset, updated every 1 mS */
  SLONG   BlockTachoCount;				/* R  - Holds current number of counts for the current output block */
  SLONG   RotationCount;			    /* R  - Holds current number of counts for the rotation counter to the output */
  ULONG   TachoLimit;					/* RW - Holds number of counts to travel, 0 => Run forever */
  SWORD   MotorRPM;						/* !! Is not updated, will be removed later !! */
  UBYTE   Flags;						/* RW - Holds flags for which data should be updated */
  UBYTE   Mode;							/* RW - Holds motor mode: Run, Break, regulated, ... */
  SBYTE   Speed;						/* RW - Holds the wanted speed */
  SBYTE   ActualSpeed;					/* R  - Holds the current motor speed */
  UBYTE   RegPParameter;				/* RW - Holds the P-constant use din the regulation, Is set to a default value at init => Setting this value is optional for the user */
  UBYTE   RegIParameter;				/* RW - Holds the I-constant use din the regulation, Is set to a default value at init => Setting this value is optional for the user */
  UBYTE   RegDParameter;				/* RW - Holds the D-constant use din the regulation, Is set to a default value at init => Setting this value is optional for the user */
  UBYTE	  RunState;					    /* RW - Holds the current RunState in the output module */
  UBYTE   RegMode;						/* RW - Tells which regulation mode should be used */
  UBYTE   Overloaded;					/* R  - True if the motor has been overloaded within speed control regulation */ 
  SBYTE   SyncTurnParameter;			/* RW - Holds the turning parameter need within MoveBlock */   
  UBYTE   Options;
  UBYTE   SpareTwo; 
  UBYTE   SpareThree;
}OUTPUT;


typedef   struct
{
  OUTPUT  Outputs[NO_OF_OUTPUTS];
  UBYTE   PwnFreq;
}IOMAPOUTPUT;



#endif