Messa in campo 4 file - 26/06/2020 Francia

Dependencies:   mbed X_NUCLEO_IHM03A1_for

Fork of FORIGO_Modula_V7_3_VdcStep_maggio2020 by Francesco Pistone

Committer:
nerit
Date:
Wed Feb 13 07:18:01 2019 +0000
Revision:
3:a469bbd294b5
Child:
5:2a3a64b52f54
a1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nerit 3:a469bbd294b5 1
nerit 3:a469bbd294b5 2 Watchdog wd;
nerit 3:a469bbd294b5 3
nerit 3:a469bbd294b5 4 #if defined(speedMaster)
nerit 3:a469bbd294b5 5 InterruptIn tractorSpeedRead(PB_1); // define interrupt pin for tractor speed calculation MASTER MODE
nerit 3:a469bbd294b5 6 DigitalOut quinconceOut(PC_9); // sincro per quinconcio out
nerit 3:a469bbd294b5 7 DigitalOut speedClock(PC_8); // define out for speed clock repeater
nerit 3:a469bbd294b5 8 InterruptIn DcEncoder(PB_2); // define input for reading speed of seed wheel with fixed 25 hole
nerit 3:a469bbd294b5 9 #else
nerit 3:a469bbd294b5 10 InterruptIn tractorSpeedRead(PC_5); // define interrupt pin for tractor speed calculation SLAVE MODE
nerit 3:a469bbd294b5 11 InterruptIn quinconceIn(PA_9);
nerit 3:a469bbd294b5 12 DigitalIn quinconceOut(PC_9,PullUp); // sincro per quinconcio out
nerit 3:a469bbd294b5 13 InterruptIn DcEncoder(PB_2); // define input for reading speed of seed wheel with fixed 25 hole
nerit 3:a469bbd294b5 14 DigitalOut speedClock(PC_8); // define out for speed clock repeater
nerit 3:a469bbd294b5 15 #endif
nerit 3:a469bbd294b5 16
nerit 3:a469bbd294b5 17 DigitalIn TBzeroPinInputRev(PB_11,PullUp); // define input of reading zero position of distributor wheel
nerit 3:a469bbd294b5 18 DigitalIn seedWheelZeroPinInputRev(PB_12); // define input of reading zero position of seeding wheel
nerit 3:a469bbd294b5 19 DigitalIn seedLevel(PB_1); // define input for reading seed level on tank
nerit 3:a469bbd294b5 20 InterruptIn seedCheck(PC_6); // define input for reading seed passage to picks
nerit 3:a469bbd294b5 21 DigitalIn buttonUser(PC_13); // pulsante su scheda
nerit 3:a469bbd294b5 22
nerit 3:a469bbd294b5 23
nerit 3:a469bbd294b5 24 InterruptIn pwmCheck(PB_13);
nerit 3:a469bbd294b5 25 PwmOut SDmotorPWM(PB_13); // define frequency command for seeding whell motor driver
nerit 3:a469bbd294b5 26 DigitalOut SDmotorInB(PB_14); // sd motor half bridge direction selector
nerit 3:a469bbd294b5 27 DigitalOut SDmotorInA(PB_15); // SD motor half bridge direction selector
nerit 3:a469bbd294b5 28 DigitalIn enDiag_A(PB_5); // SD motor fault condition input A
nerit 3:a469bbd294b5 29 DigitalIn enDiag_B(PB_4); // SD motor fault condition input A
nerit 3:a469bbd294b5 30 AnalogIn SDcurrent(PA_4); // SD power current feedback
nerit 3:a469bbd294b5 31
nerit 3:a469bbd294b5 32 //DigitalOut TBmotor_M1(PC_8); // TB motor step division M1
nerit 3:a469bbd294b5 33 //DigitalOut TBmotor_M2(PC_6); // TB motor step division M2
nerit 3:a469bbd294b5 34 //DigitalOut TBmotor_M3(PC_5); // TB motor step division M3
nerit 3:a469bbd294b5 35 //DigitalOut TBmotorRst(PC_4); // TB motor driver reset
nerit 3:a469bbd294b5 36 //DigitalOut TBmotorStepOut(PB_3); // TB motor step command
nerit 3:a469bbd294b5 37 //DigitalOut TBmotorDirecti(PA_10); // TB motor direction command
nerit 3:a469bbd294b5 38
nerit 3:a469bbd294b5 39 DigitalOut TBmotor_CS(PB_6); // PowerStep01 SPI ChipSelect
nerit 3:a469bbd294b5 40 DigitalOut TBmotor_CK(PA_5); // PowerStep01 SPI Clock
nerit 3:a469bbd294b5 41 DigitalOut TBmotor_SDI(PA_7); // PowerStep01 Serial Data Input MOSI sulla cpu
nerit 3:a469bbd294b5 42 DigitalOut TBmotor_SDO(PA_6); // PowerStep01 Serial Data Output MISO sulla cpu
nerit 3:a469bbd294b5 43 DigitalIn TBmotor_Busy(PC_7); // PowerStep01 Driver busy
nerit 3:a469bbd294b5 44 DigitalIn TBmotor_Flag(PA_8); // PowerStep01 Driver Flag
nerit 3:a469bbd294b5 45 DigitalOut TBmotorStepOut(PB_3); // PowerStep01 Step Input
nerit 3:a469bbd294b5 46 DigitalOut TBmotor_SW(PB_10); // PowerStep01 Switch
nerit 3:a469bbd294b5 47 DigitalOut TBmotorRst(PC_4); // PowerStep01 Driver reset
nerit 3:a469bbd294b5 48 int TBmotorDirecti;
nerit 3:a469bbd294b5 49 DigitalOut passo(PB_3);
nerit 3:a469bbd294b5 50 DigitalOut led(LED1);
nerit 3:a469bbd294b5 51 DigitalOut cs1(PB_6);
nerit 3:a469bbd294b5 52
nerit 3:a469bbd294b5 53
nerit 3:a469bbd294b5 54
nerit 3:a469bbd294b5 55 /*
nerit 3:a469bbd294b5 56 #if defined(speedMaster)
nerit 3:a469bbd294b5 57 DigitalOut led(LED1); // ATTENZIONE: LED1 E' SU PA5 / D13
nerit 3:a469bbd294b5 58 #else
nerit 3:a469bbd294b5 59 DigitalOut led(PC_7); // ATTENZIONE: LED1 E' SU PA5 / D13
nerit 3:a469bbd294b5 60 #endif
nerit 3:a469bbd294b5 61 */
nerit 3:a469bbd294b5 62 //DigitalIn zeroRequestIn(PB_6); // define input of zero request for slave module
nerit 3:a469bbd294b5 63 //DigitalIn runRequestIn(PB_9); // define input of run request for slave module
nerit 3:a469bbd294b5 64
nerit 3:a469bbd294b5 65 #if defined(canbusActive)
nerit 3:a469bbd294b5 66 CAN can1(PA_11,PA_12,100000); // CAN BUS channel for communication with other slave and master consolle
nerit 3:a469bbd294b5 67 int checkState=0;
nerit 3:a469bbd294b5 68 #endif
nerit 3:a469bbd294b5 69 CANMessage txMsg;
nerit 3:a469bbd294b5 70 CANMessage rxMsg;
nerit 3:a469bbd294b5 71
nerit 3:a469bbd294b5 72 #if defined(pcSerial)
nerit 3:a469bbd294b5 73 Serial pc(USBTX, USBRX,250000); // serial channel for PC communication
nerit 3:a469bbd294b5 74 #else
nerit 3:a469bbd294b5 75 #if defined(speedTime)
nerit 3:a469bbd294b5 76 Serial pc(USBTX, USBRX,256000); // serial channel for PC communication
nerit 3:a469bbd294b5 77 #endif
nerit 3:a469bbd294b5 78 #endif
nerit 3:a469bbd294b5 79