new

Dependencies:   mbed CANMsg

Committer:
nerit
Date:
Thu Dec 27 13:43:31 2018 +0000
Revision:
10:d85ed006056e
Parent:
7:c9fd242538d9
Hardware Versione 5 su elementi del 27-12-18

Who changed what in which revision?

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