boardio.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef _8X2A_IO_
  2. #define _8X2A_IO_
  3. /*#define MOTA_EN LATAbits.LATA4
  4. #define MOTA_IN1 LATAbits.LATA3
  5. #define MOTA_IN2 LATAbits.LATA2
  6. #define SETPORT_MOTA do{ TRISAbits.TRISA4=TRISAbits.TRISA3=TRISAbits.TRISA2=0;} while(0)
  7. #define MOTB_EN LATBbits.LATB5
  8. #define MOTB_IN1 LATAbits.LATA1
  9. #define MOTB_IN2 LATAbits.LATA0
  10. #define SETPORT_MOTB do{ TRISBbits.TRISB5=TRISAbits.TRISA1=TRISAbits.TRISA0=0;} while(0)
  11. #define MOTC_EN LATCbits.LATC2
  12. #define MOTC_IN1 LATBbits.LATB4
  13. #define MOTC_IN2 LATAbits.LATA6
  14. #define SETPORT_MOTC do{ TRISCbits.TRISC2=TRISBbits.TRISB4=TRISAbits.TRISA6=0;} while(0)
  15. #define MOTD_EN LATCbits.LATC0
  16. #define MOTD_IN1 LATBbits.LATB3
  17. #define MOTD_IN2 LATAbits.LATA7
  18. #define SETPORT_MOTD do{ TRISCbits.TRISC0=TRISBbits.TRISB3=TRISAbits.TRISA7=0;} while(0)*/
  19. // CONNECTORS :
  20. #define K1PORT C
  21. #define K1BIT 1
  22. #define K2PORT C
  23. #define K2BIT 3
  24. #define K2AN 15
  25. #define K3PORT C
  26. #define K3BIT 4
  27. #define K3AN 16
  28. #define K4PORT C
  29. #define K4BIT 5
  30. #define K4AN 17
  31. #define K5PORT C
  32. #define K5BIT 6
  33. #define K5AN 18
  34. #define K6PORT C
  35. #define K6BIT 7
  36. #define K6AN 19
  37. #define K7PORT B
  38. #define K7BIT 0
  39. #define K7AN 12
  40. #define K7INT 0
  41. #define K8PORT B
  42. #define K8BIT 1
  43. #define K8AN 10
  44. #define K8INT 1
  45. #define K9PORT B
  46. #define K9BIT 2
  47. #define K9AN 8
  48. #define K9INT 2
  49. // MOTOR A :
  50. #define MA1PORT A
  51. #define MA1BIT 3
  52. #define MA1AN 3
  53. #define MA2PORT A
  54. #define MA2BIT 2
  55. #define MA2AN 2
  56. #define MAENPORT A
  57. #define MAENBIT 4
  58. #define MAEN2 KZ2
  59. #define MOTA_PWM 5
  60. #define MOTA_CONFIG() do{}while(0)
  61. // MOTOR B :
  62. #define MB1PORT A
  63. #define MB1BIT 1
  64. #define MB1AN 1
  65. #define MB2PORT A
  66. #define MB2BIT 0
  67. #define MB2AN 0
  68. #define MBENPORT B
  69. #define MBENBIT 5
  70. #define MBEN2 KZ2
  71. #define MOTB_PWM 3
  72. #define MOTB_CONFIG() do{}while(0)
  73. // MOTOR C :
  74. #define MC1PORT B
  75. #define MC1BIT 4
  76. #define MC1AN 11
  77. #define MC2PORT A
  78. #define MC2BIT 6
  79. #define MCENPORT C
  80. #define MCENBIT 2
  81. #define MCEN2 KZ2
  82. #define MOTC_PWM 1
  83. #define MOTC_CONFIG() do{\
  84. /* init PWM1 to pulse MOTC_IN1 (P1D) : */ PSTR1CON=0; PSTR1CONbits.STR1D=1; \
  85. }while(0)
  86. // MOTOR D :
  87. #define MD1PORT B
  88. #define MD1BIT 3
  89. #define MD1AN 9
  90. #define MD2PORT A
  91. #define MD2BIT 7
  92. #define MDENPORT C
  93. #define MDENBIT 0
  94. #define MDEN2 KZ2
  95. #define MOTD_PWM 2
  96. #define MOTD_CONFIG() do{}while(0)
  97. //---- Aux serial port :
  98. #define AUXSERIAL_NUM 1
  99. #define AUXSERIAL_TX K5
  100. #define AUXSERIAL_RX K6
  101. #endif