You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project demonstrates an implementation of a 2-axis computer numerical
7
-
control (CNC) machine which makes use of the Direct Memory Address (DMA),
8
-
Numerically Controlled Oscillator (NCO) and other Core Independent Peripherals
6
+
control (CNC) machine which makes use of the Numerically Controlled Oscillator (NCO), Direct Memory Address (DMA) and other Core Independent Peripherals
9
7
(CIPs) to handle acceleration and movement with minimal input from the
10
8
microcontroller core.
11
-
with minimal
12
9
13
10
14
11
## Theory of Operation
@@ -18,7 +15,7 @@ This is a general overview of the application. A more complete explanation can
18
15
19
16
Numerically Controlled Oscillators are a peripheral which work by creating
20
17
an output frequency which is a precise fraction of the input frequency.
21
-
This frequency is a function of two values, the input frequency, and the
18
+
This output frequency is a function of two values, the input frequency, and the
22
19
value of the increment register of the NCO.
23
20
This project makes use of three NCOs, a master NCO which determines overall speed,
24
21
and a slave NCO for each axis which determines the proportion of speed in each
@@ -28,7 +25,7 @@ This is a general overview of the application. A more complete explanation can
28
25
29
26
For instance, if the goal is to move 200 mm in the X axis, and 100 mm in the Y
30
27
axis, the X NCO can be set to produce twice the frequency of output as the
31
-
Y NCO. This means that that X will move twice as fast, and therefore cover twice
28
+
Y NCO. This means that X will move twice as fast, and therefore cover twice
32
29
the distance.
33
30
34
31
Additionally, because both frequencies are a function of the master
@@ -37,10 +34,7 @@ doubled, while maintaining the same proportion (e.g. X will still be going twice
37
34
as fast as Y, and will therefore still cover twice the distance).
38
35
39
36
Direct Memory Address (DMA) is a module which can copy data from one memory
40
-
location to another when triggered. Acceleration of the machine can be achieved
41
-
by using the DMA to gradually increase or decrease the value in the increment
42
-
register of the NCO, resulting in the frequency of the master NCO, and therefore
43
-
the speed of movement in the two axes, increasing or decreasing proportionally.
37
+
location to another without any CPU intervention. DMA operation can be configured to start and/or abort based on several built-in trigger options. Acceleration of the machine can be achieved by using the DMA to gradually increase or decrease the value in the increment register of the NCO, resulting in the frequency of the master NCO, and therefore the speed of movement in the two axes, increasing or decreasing proportionally.
44
38
45
39
The distance travelled in each direction can be known by counting the number of
46
40
pulses from the master NCO. In short, this is because if the master
@@ -50,21 +44,12 @@ moved the steppers in both axes the correct distance.
50
44
51
45
## Related Documentation
52
46
53
-
<!-- Any information about an application note or tech brief can be linked here. Use unbreakable links!
54
-
In addition a link to the device family landing page and relevant peripheral pages as well:
55
-
- [AN3381 - Brushless DC Fan Speed Control Using Temperature Input and Tachometer Feedback](https://microchip.com/00003381/)
56
-
- [PIC18F-Q10 Family Product Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q10-product-family) -->
57
-
47
+
<!-- - [AN1234 - Whatever the Title Is](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q84-product-family) THIS LINK MIGHT NOT BE VALID. REMOVE BEFORE FLIGHT. -->
58
48
-[PIC18F-Q84 Family Product Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q84-product-family) THIS LINK MIGHT NOT BE VALID. REMOVE BEFORE FLIGHT.
59
49
50
+
60
51
## Software Used
61
52
62
-
<!-- All software used in this example must be listed here. Use unbreakable links!
63
-
- MPLAB® X IDE 5.30 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide)
64
-
- MPLAB® XC8 2.10 or a newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers)
65
-
- MPLAB® Code Configurator (MCC) 3.95.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
- Curiosity Nano Base for Click boards™ [(AC164162)](https://www.microchip.com/Developmenttools/ProductDetails/AC164162)
@@ -98,37 +76,40 @@ the end effector selected should be raised when the pin controlling it is low,
98
76
and lowered when the pin is high. This can be modified as needed to work with
99
77
a selected end effector.
100
78
79
+

80
+
101
81
## Setup
102
82
103
83
Most configuration is done through the config.h file. The configurations are:
104
84
105
85
-`TICKS_PER_METER`: the number of steps of the stepper motor required to move the
106
86
end effector one meter
107
-
-`X_MAX`/`YMAX`: the maximum range, in steps, of the X and Y axes
87
+
-`X_MAX`/`Y_MAX`: the maximum range, in steps, of the X and Y axes
108
88
-`X_BACKWARDS`/`Y_BACKWARDS`: whether to reverse the direction of the stepper
109
89
motor on this axis
110
90
-`BUFFER_NUMBER_PACKETS`: the size of the command buffer. This can be left at the
111
91
default 5
112
92
113
-
Pinout is defined with two constants, `NAME_PIN_PORT` and `NAME_PIN_POS`. To
114
-
have pin Y_ENABLE on RA6, the code would be
93
+
Pinout of the various pins (e.g. limit switches, the Click™ boards, the
94
+
actuator, etc) is defined in config.h with two constants per pin,
95
+
`NAME_PIN_PORT` and `NAME_PIN_POS`.
96
+
For example, to have pin Y_ENABLE on RA6, the code would be
115
97
116
98
```
117
99
#define Y_ENABLE_PIN_PORT RA
118
100
#define Y_ENABLE_PIN_POS 6
119
101
```
120
102
121
-
As configured, the Y axis Stepper Click board™ should go in slot 1, and the x
122
-
axis should be in slot 3.
103
+
As configured, the Y axis Stepper Click board™ should go in slot 1, and the X
104
+
axis should be in slot 3 of the curiosity nano base board.
123
105
124
-
By default the limit switch pin for the y axis is RA1, and the x axis is RC7.
106
+
By default the limit switch pin for the Y axis is RA1, and the X axis is RC7.
125
107
The actuator is on pin RF2.
126
108
127
109
If an alternate method of controlling the actuator is desired, the relevant
128
110
functions to modify are `Platform_RaiseActuator()` and `Platform_LowerActuator()` in
129
111
platform.c which by default simply set ACTUATOR_PIN high/low.
130
112
131
-
<!-- Explain how to connect hardware and set up software. Depending on complexity, step-by-step instructions and/or tables and/or images can be used -->
132
113
133
114
## Operation
134
115
@@ -145,7 +126,6 @@ Movement in the Z axis and the X/Y plane simultaneously is not supported.
145
126
146
127
## Summary
147
128
148
-
<!-- Summarize what the example has shown -->
149
129
150
130
The example G-Code included with the PC application creates the star shown below.
0 commit comments