Advertisement
aso4200

nyskov.h

May 10th, 2022
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.70 KB | None | 0 0
  1. //definitions for Nyskov turntable on SMJK layout
  2. //Version 20211116
  3.  
  4. #ifndef NYSKOV
  5. #define NYSKOV
  6. #endif
  7.  
  8. /*
  9. Pins for Nyskov turntable:
  10. 2 til 5=stepper motor driver
  11. 6=sensor zero point
  12. 7=button for setup mode
  13. 8 to 12=bits for controlling PCB card for driving current
  14. 13=LED for setup mode
  15. A0=selector with resistor for track position
  16. A1=button for direction forward
  17. A2=button for direction reverse
  18. A3=button for start turntable rotating
  19. A4=button for turntable make half a turn
  20. A5=button for save pos in setup mode
  21. Activate of setup is done holding button 'setup mode' in SETUPWAITTIME milli seconds
  22. */
  23.  
  24. #define HIGHSTEP 10 //stepper value for button half a turn in setup mode
  25. #define SETUPWAITTIME 5000 //wait time in milli seconds for activeting setup mode
  26. #define CANCELMOVETIME 1500 //wait time in milli seconds for cancel an active move
  27. #define MAGICFILENUMBER 130 //Unik number for save in static ram, that must match when read back
  28. #define TWO_PUSH_DIRECTION
  29. #define ONE_PUSH_SETUP
  30. #define PUSH_NORMALY_OPEN
  31. #define DRIVING_CURRENT
  32. #ifdef NS_TEST //use for home test
  33. #define STEPPERSPEED 80 //speed for stepper motor
  34. #define STEPPERSTARTSP 20 //speed for motor start
  35. #define STEP_UP_VAL 5 //step values for acceleration of stepper motor
  36. #define GEAR_BLUR 23 //corrections value for slup in stepper gear
  37. const int MotorStepsPrTurn=64;  //steps for steppermotor one turn
  38. const int GearStepsPrTurn=2048; //steps for turntable one turn
  39. #else
  40. #define STEPPERSPEED 10 //speed for stepper motor
  41. #define STEPPERSTARTSP 2 //speed for motor start
  42. #define STEP_UP_VAL 1 //step values for acceleration of stepper motor
  43. #define GEAR_BLUR 0 //corrections value for slup in stepper gear
  44. const int MotorStepsPrTurn=200; //steps for steppermotor one turn
  45. const int GearStepsPrTurn=2400; //steps for turntable one turn
  46. #endif
  47.  
  48. const int pin_zero_point=6;
  49. const int pin_setup_mode=7;
  50. #ifdef DRIVING_CURRENT
  51. const int pin_dc_bit0=8;
  52. const int pin_dc_bit1=9;
  53. const int pin_dc_bit2=10;
  54. const int pin_dc_bit3=11;
  55. const int pin_dc_bit_active=12;
  56. UBYTE dc_bit_active;
  57. bool driving_curr=false;
  58. #endif
  59. const int pin_setup_led=13;
  60. const int pin_selector=A0;
  61. #ifdef TWO_PUSH_DIRECTION
  62. const int pin_turn_direction_forw=A1;
  63. const int pin_turn_direction_backw=A2;
  64. #endif
  65. const int pin_turn_move=A3;
  66. const int pin_half_turn=A4;
  67. const int pin_setup_save=A5;
  68.  
  69. Stepper myStepper(MotorStepsPrTurn, 2, 3, 4, 5); //initialize stepper on pins 2 to 5
  70.  
  71. #ifdef NS_TEST
  72. #define TRACK_NO 5
  73. UWORD track_pos_steps[TRACK_NO]={0,250,500,750,1000}; //default values for track pos
  74. #else
  75. #define TRACK_NO 11
  76. UWORD track_pos_steps[TRACK_NO]={0,644,713,784,857,928,995,1064,1133,1200,1274}; //default values for track pos
  77. #endif
  78.  
  79. #ifdef DRIVING_CURRENT
  80. #ifndef DCURRENT_H
  81. #include "dcurrent.h"
  82. #endif
  83. #endif
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement