Messa in campo 4 file - 26/06/2020 Francia
Dependencies: mbed X_NUCLEO_IHM03A1_for
Fork of FORIGO_Modula_V7_3_VdcStep_maggio2020 by
iodefinition.hpp@45:162116db828a, 2020-07-20 (annotated)
- Committer:
- nerit
- Date:
- Mon Jul 20 09:06:29 2020 +0000
- Revision:
- 45:162116db828a
- Parent:
- 37:0a225902cf48
versione di prova per verifica accelerazione tamburo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nerit | 3:a469bbd294b5 | 1 | |
nerit | 3:a469bbd294b5 | 2 | Watchdog wd; |
nerit | 37:0a225902cf48 | 3 | #if defined(runner) |
nerit | 37:0a225902cf48 | 4 | #if defined(speedMaster) |
nerit | 37:0a225902cf48 | 5 | InterruptIn tractorSpeedRead(PB_1); // define interrupt pin for tractor speed calculation MASTER MODE |
nerit | 37:0a225902cf48 | 6 | DigitalOut quinconceOut(PC_9); // sincro per quinconcio out |
nerit | 37:0a225902cf48 | 7 | #else |
nerit | 37:0a225902cf48 | 8 | InterruptIn tractorSpeedRead(PC_5); // define interrupt pin for tractor speed calculation SLAVE MODE |
nerit | 37:0a225902cf48 | 9 | InterruptIn quinconceIn(PA_9); |
nerit | 37:0a225902cf48 | 10 | DigitalIn quinconceOut(PC_9,PullUp); // sincro per quinconcio out |
nerit | 37:0a225902cf48 | 11 | #endif |
nerit | 37:0a225902cf48 | 12 | |
nerit | 37:0a225902cf48 | 13 | InterruptIn DcEncoder(PB_2); // define input for reading speed of seed wheel with fixed 25 hole |
nerit | 37:0a225902cf48 | 14 | InterruptIn seedCheck(PC_6); // define input for reading seed passage to picks |
nerit | 37:0a225902cf48 | 15 | InterruptIn pwmCheck(PB_13); |
nerit | 37:0a225902cf48 | 16 | |
nerit | 37:0a225902cf48 | 17 | DigitalOut speedClock(PC_8); // define out for speed clock repeater |
nerit | 37:0a225902cf48 | 18 | DigitalIn TBzeroPinInputRev(PB_11); // define input of reading zero position of distributor wheel |
nerit | 37:0a225902cf48 | 19 | DigitalIn seedWheelZeroPinInputRev(PB_12); // define input of reading zero position of seeding wheel |
nerit | 37:0a225902cf48 | 20 | DigitalIn seedLevel(PB_0); // define input for reading seed level on tank |
nerit | 37:0a225902cf48 | 21 | DigitalIn buttonUser(PC_13); // pulsante su scheda |
nerit | 37:0a225902cf48 | 22 | |
nerit | 37:0a225902cf48 | 23 | |
nerit | 37:0a225902cf48 | 24 | PwmOut SDmotorPWM(PB_13); // define frequency command for seeding whell motor driver |
nerit | 37:0a225902cf48 | 25 | DigitalOut SDmotorInB(PB_14); // sd motor half bridge direction selector |
nerit | 37:0a225902cf48 | 26 | DigitalOut SDmotorInA(PB_15); // SD motor half bridge direction selector |
nerit | 37:0a225902cf48 | 27 | DigitalIn enDiag_A(PB_5); // SD motor fault condition input A |
nerit | 37:0a225902cf48 | 28 | DigitalIn enDiag_B(PB_4); // SD motor fault condition input A |
nerit | 37:0a225902cf48 | 29 | AnalogIn SDcurrent(PA_4); // SD power current feedback |
nerit | 37:0a225902cf48 | 30 | |
nerit | 37:0a225902cf48 | 31 | //DigitalOut TBmotor_CS(PB_6); // PowerStep01 SPI ChipSelect |
nerit | 37:0a225902cf48 | 32 | //DigitalOut TBmotor_CK(PA_5); // PowerStep01 SPI Clock |
nerit | 37:0a225902cf48 | 33 | //DigitalOut TBmotor_SDI(PA_7); // PowerStep01 Serial Data Input MOSI sulla cpu |
nerit | 37:0a225902cf48 | 34 | //DigitalOut TBmotor_SDO(PA_6); // PowerStep01 Serial Data Output MISO sulla cpu |
nerit | 37:0a225902cf48 | 35 | //DigitalIn TBmotor_Busy(PC_7); // PowerStep01 Driver busy |
nerit | 37:0a225902cf48 | 36 | //DigitalIn TBmotor_Flag(PA_8); // PowerStep01 Driver Flag |
nerit | 37:0a225902cf48 | 37 | DigitalOut TBmotorStepOut(PB_3); // PowerStep01 Step Input |
nerit | 37:0a225902cf48 | 38 | DigitalOut TBmotor_SW(PB_10); // PowerStep01 Switch |
nerit | 37:0a225902cf48 | 39 | DigitalOut TBmotorRst(PC_4); // PowerStep01 Driver reset |
nerit | 37:0a225902cf48 | 40 | int TBmotorDirecti; |
nerit | 37:0a225902cf48 | 41 | //DigitalOut passo(PB_3); |
nerit | 37:0a225902cf48 | 42 | //DigitalOut led(LED1); |
nerit | 37:0a225902cf48 | 43 | //DigitalOut cs1(PB_6); |
nerit | 37:0a225902cf48 | 44 | |
nerit | 37:0a225902cf48 | 45 | |
nerit | 37:0a225902cf48 | 46 | |
nerit | 37:0a225902cf48 | 47 | #if defined(canbusActive) |
nerit | 37:0a225902cf48 | 48 | CAN can1(PA_11,PA_12,100000); // CAN BUS channel for communication with other slave and master consolle |
nerit | 37:0a225902cf48 | 49 | int checkState=0; |
nerit | 37:0a225902cf48 | 50 | #endif |
nerit | 37:0a225902cf48 | 51 | //CANMessage txMsg; |
nerit | 37:0a225902cf48 | 52 | CANMessage rxMsg; |
nerit | 37:0a225902cf48 | 53 | |
nerit | 37:0a225902cf48 | 54 | #if defined(pcSerial) |
nerit | 37:0a225902cf48 | 55 | Serial pc(USBTX, USBRX,230400); // serial channel for PC communication |
nerit | 37:0a225902cf48 | 56 | #endif |
nerit | 3:a469bbd294b5 | 57 | #endif |
nerit | 3:a469bbd294b5 | 58 | |
nerit | 37:0a225902cf48 | 59 | #if defined(oldStepperDriver) |
nerit | 3:a469bbd294b5 | 60 | |
nerit | 37:0a225902cf48 | 61 | #if defined(speedMaster) |
nerit | 37:0a225902cf48 | 62 | InterruptIn tractorSpeedRead(PB_1); // define interrupt pin for tractor speed calculation MASTER MODE |
nerit | 37:0a225902cf48 | 63 | DigitalOut quinconceOut(PA_5); // sincro per quinconcio out |
nerit | 37:0a225902cf48 | 64 | DigitalOut speedClock(PA_6); // define out for speed clock repeater |
nerit | 37:0a225902cf48 | 65 | InterruptIn DcEncoder(PB_2); // define input for reading speed of seed wheel with fixed 25 hole |
nerit | 37:0a225902cf48 | 66 | #else |
nerit | 37:0a225902cf48 | 67 | InterruptIn tractorSpeedRead(PB_6); // define interrupt pin for tractor speed calculation SLAVE MODE |
nerit | 37:0a225902cf48 | 68 | InterruptIn quinconceIn(PA_9); |
nerit | 37:0a225902cf48 | 69 | DigitalIn quinconceOut(PA_5,PullUp); // sincro per quinconcio out |
nerit | 37:0a225902cf48 | 70 | InterruptIn DcEncoder(PB_2); // define input for reading speed of seed wheel with fixed 25 hole |
nerit | 37:0a225902cf48 | 71 | DigitalOut speedClock(PA_6); // define out for speed clock repeater |
nerit | 37:0a225902cf48 | 72 | DigitalIn seedLevel(PB_1); // define input for reading seed level on tank |
nerit | 37:0a225902cf48 | 73 | #endif |
nerit | 37:0a225902cf48 | 74 | |
nerit | 37:0a225902cf48 | 75 | DigitalIn TBzeroPinInputRev(PB_11); // define input of reading zero position of distributor wheel |
nerit | 37:0a225902cf48 | 76 | DigitalIn seedWheelZeroPinInputRev(PB_12); // define input of reading zero position of seeding wheel |
nerit | 37:0a225902cf48 | 77 | InterruptIn seedCheck(PA_7); // define input for reading seed passage to picks |
nerit | 37:0a225902cf48 | 78 | DigitalIn buttonUser(PC_13); // pulsante su scheda |
nerit | 37:0a225902cf48 | 79 | |
nerit | 37:0a225902cf48 | 80 | |
nerit | 37:0a225902cf48 | 81 | InterruptIn pwmCheck(PB_13); |
nerit | 37:0a225902cf48 | 82 | PwmOut SDmotorPWM(PB_13); // define frequency command for seeding whell motor driver |
nerit | 37:0a225902cf48 | 83 | DigitalOut SDmotorInB(PB_14); // sd motor half bridge direction selector |
nerit | 37:0a225902cf48 | 84 | DigitalOut SDmotorInA(PB_15); // SD motor half bridge direction selector |
nerit | 37:0a225902cf48 | 85 | DigitalIn enDiag_A(PB_5); // SD motor fault condition input A |
nerit | 37:0a225902cf48 | 86 | DigitalIn enDiag_B(PB_4); // SD motor fault condition input A |
nerit | 37:0a225902cf48 | 87 | AnalogIn SDcurrent(PA_4); // SD power current feedback |
nerit | 37:0a225902cf48 | 88 | |
nerit | 37:0a225902cf48 | 89 | DigitalOut TBmotor_M1(PC_8); // TB motor step division M1 |
nerit | 37:0a225902cf48 | 90 | DigitalOut TBmotor_M2(PC_6); // TB motor step division M2 |
nerit | 37:0a225902cf48 | 91 | DigitalOut TBmotor_M3(PC_5); // TB motor step division M3 |
nerit | 37:0a225902cf48 | 92 | DigitalOut TBmotorRst(PC_4); // TB motor driver reset |
nerit | 37:0a225902cf48 | 93 | DigitalOut TBmotorStepOut(PB_3); // TB motor step command |
nerit | 37:0a225902cf48 | 94 | DigitalOut TBmotorDirecti(PA_10); // TB motor direction command |
nerit | 37:0a225902cf48 | 95 | |
nerit | 37:0a225902cf48 | 96 | /* |
nerit | 37:0a225902cf48 | 97 | #if defined(speedMaster) |
nerit | 37:0a225902cf48 | 98 | //DigitalOut led(LED1); // ATTENZIONE: LED1 E' SU PA5 / D13 |
nerit | 37:0a225902cf48 | 99 | #else |
nerit | 37:0a225902cf48 | 100 | DigitalOut led(PC_7); // ATTENZIONE: LED1 E' SU PA5 / D13 |
nerit | 37:0a225902cf48 | 101 | #endif |
nerit | 37:0a225902cf48 | 102 | */ |
nerit | 37:0a225902cf48 | 103 | |
nerit | 37:0a225902cf48 | 104 | //DigitalIn zeroRequestIn(PB_6); // define input of zero request for slave module |
nerit | 37:0a225902cf48 | 105 | //DigitalIn runRequestIn(PB_9); // define input of run request for slave module |
nerit | 37:0a225902cf48 | 106 | |
nerit | 37:0a225902cf48 | 107 | #if defined(canbusActive) |
nerit | 37:0a225902cf48 | 108 | CAN can1(PA_11,PA_12,100000); // CAN BUS channel for communication with other slave and master consolle |
nerit | 37:0a225902cf48 | 109 | int checkState=0; |
nerit | 37:0a225902cf48 | 110 | #endif |
nerit | 37:0a225902cf48 | 111 | CANMessage txMsg; |
nerit | 37:0a225902cf48 | 112 | CANMessage rxMsg; |
nerit | 37:0a225902cf48 | 113 | |
nerit | 37:0a225902cf48 | 114 | #if defined(pcSerial) |
nerit | 37:0a225902cf48 | 115 | Serial pc(USBTX, USBRX,250000); // serial channel for PC communication |
nerit | 37:0a225902cf48 | 116 | #else |
nerit | 37:0a225902cf48 | 117 | #if defined(speedTime) |
nerit | 37:0a225902cf48 | 118 | Serial pc(USBTX, USBRX,250000); // serial channel for PC communication |
nerit | 37:0a225902cf48 | 119 | #endif |
nerit | 37:0a225902cf48 | 120 | #endif |
nerit | 3:a469bbd294b5 | 121 | |
nerit | 37:0a225902cf48 | 122 | #endif |