Line 1... |
Line 1... |
1 |
#!/usr/bin/python |
1 |
#!/usr/bin/python |
2 |
# ------------------------------------------- |
2 |
# ------------------------------------------- |
3 |
# HBSTEP01B Stepper Motor control test code |
3 |
# HBSTEP01B Stepper Motor control test code |
4 |
# ------------------------------------------- |
4 |
# ------------------------------------------- |
- |
|
5 |
# |
- |
|
6 |
# Program uses MLAB Python modules library from https://github.com/MLAB-project/pymlab |
- |
|
7 |
|
5 |
|
8 |
|
6 |
#uncomment for debbug purposes |
9 |
#uncomment for debbug purposes |
7 |
#import logging |
10 |
#import logging |
8 |
#logging.basicConfig(level=logging.DEBUG) |
11 |
#logging.basicConfig(level=logging.DEBUG) |
9 |
|
12 |
|
Line 62... |
Line 65... |
62 |
spi.SPI_write_byte(self.CS, 0x10) |
65 |
spi.SPI_write_byte(self.CS, 0x10) |
63 |
spi.SPI_write_byte(self.CS, 0x06) # DEC |
66 |
spi.SPI_write_byte(self.CS, 0x06) # DEC |
64 |
spi.SPI_write_byte(self.CS, 0x00) |
67 |
spi.SPI_write_byte(self.CS, 0x00) |
65 |
spi.SPI_write_byte(self.CS, 0x10) |
68 |
spi.SPI_write_byte(self.CS, 0x10) |
66 |
spi.SPI_write_byte(self.CS, 0x0A) # KVAL_RUN |
69 |
spi.SPI_write_byte(self.CS, 0x0A) # KVAL_RUN |
67 |
spi.SPI_write_byte(self.CS, 0x90) |
70 |
spi.SPI_write_byte(self.CS, 0xFF) |
68 |
spi.SPI_write_byte(self.CS, 0x0B) # KVAL_ACC |
71 |
spi.SPI_write_byte(self.CS, 0x0B) # KVAL_ACC |
69 |
spi.SPI_write_byte(self.CS, 0x90) |
72 |
spi.SPI_write_byte(self.CS, 0xFF) |
70 |
spi.SPI_write_byte(self.CS, 0x0C) # KVAL_DEC |
73 |
spi.SPI_write_byte(self.CS, 0x0C) # KVAL_DEC |
71 |
spi.SPI_write_byte(self.CS, 0x90) |
74 |
spi.SPI_write_byte(self.CS, 0xFF) |
72 |
spi.SPI_write_byte(self.CS, 0x18) # CONFIG |
75 |
spi.SPI_write_byte(self.CS, 0x18) # CONFIG |
73 |
spi.SPI_write_byte(self.CS, 0b00111000) |
76 |
spi.SPI_write_byte(self.CS, 0b00111000) |
74 |
spi.SPI_write_byte(self.CS, 0b00000000) |
77 |
spi.SPI_write_byte(self.CS, 0b00000000) |
75 |
|
78 |
|
76 |
def MaxSpeed(self, speed): |
79 |
def MaxSpeed(self, speed): |