PLC 16 in / 8 rev / an in-out / CAN

Dependencies:   PCAL955x mbed mbed-rtos AT45

Committer:
Oleg_B
Date:
Sun Feb 07 05:08:51 2021 +0000
Revision:
0:d05a7158dbad
main prog for PLC1608

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Oleg_B 0:d05a7158dbad 1 // -------------------------------------------------------------//
Oleg_B 0:d05a7158dbad 2
Oleg_B 0:d05a7158dbad 3
Oleg_B 0:d05a7158dbad 4 //------- discr output ------------
Oleg_B 0:d05a7158dbad 5 DigitalOut led (PA_6); // выход LED на плате
Oleg_B 0:d05a7158dbad 6
Oleg_B 0:d05a7158dbad 7 //----- port UART --------------
Oleg_B 0:d05a7158dbad 8 //Serial uart(PA_0, PA_1); // tx, rx
Oleg_B 0:d05a7158dbad 9 DigitalOut led_r (PA_1); // выход LED
Oleg_B 0:d05a7158dbad 10 DigitalOut led_b (PA_0); // выход LED
Oleg_B 0:d05a7158dbad 11
Oleg_B 0:d05a7158dbad 12
Oleg_B 0:d05a7158dbad 13
Oleg_B 0:d05a7158dbad 14 DigitalOut y_1 (PC_4); // выход 1
Oleg_B 0:d05a7158dbad 15 DigitalOut y_2 (PC_5); // выход 2
Oleg_B 0:d05a7158dbad 16 DigitalOut y_3 (PC_6); // выход 3
Oleg_B 0:d05a7158dbad 17 DigitalOut y_4 (PC_7); // выход 4
Oleg_B 0:d05a7158dbad 18 DigitalOut y_5 (PC_8); // выход 4
Oleg_B 0:d05a7158dbad 19 DigitalOut y_6 (PC_9); // выход 4
Oleg_B 0:d05a7158dbad 20 DigitalOut y_7 (PC_10); // выход 4
Oleg_B 0:d05a7158dbad 21 DigitalOut y_8 (PC_11); // выход 4
Oleg_B 0:d05a7158dbad 22
Oleg_B 0:d05a7158dbad 23 DigitalOut txd (PA_0); // for test
Oleg_B 0:d05a7158dbad 24
Oleg_B 0:d05a7158dbad 25 //------- discr input i2c PCA9555 ------------
Oleg_B 0:d05a7158dbad 26 PCAL9555 gpio_exp( PB_9, PB_8, 0x42); // SDA, SCL, Slave_address
Oleg_B 0:d05a7158dbad 27 GpioBusIn inps( gpio_exp, X1_7, X1_6, X1_5, X1_4, X1_3, X1_2, X1_1, X1_0, X0_7, X0_6, X0_5, X0_4, X0_3, X0_2, X0_1, X0_0 );
Oleg_B 0:d05a7158dbad 28
Oleg_B 0:d05a7158dbad 29
Oleg_B 0:d05a7158dbad 30 //------- analog input --------------------
Oleg_B 0:d05a7158dbad 31 AnalogIn aninp1(PC_0);
Oleg_B 0:d05a7158dbad 32 AnalogIn aninp2(PC_1);
Oleg_B 0:d05a7158dbad 33 AnalogIn aninp3(PC_2);
Oleg_B 0:d05a7158dbad 34 AnalogIn aninp4(PC_3);
Oleg_B 0:d05a7158dbad 35
Oleg_B 0:d05a7158dbad 36 //------- analog output ------------------
Oleg_B 0:d05a7158dbad 37 AnalogOut anout1(PA_4);
Oleg_B 0:d05a7158dbad 38 AnalogOut anout2(PA_5);
Oleg_B 0:d05a7158dbad 39
Oleg_B 0:d05a7158dbad 40
Oleg_B 0:d05a7158dbad 41 //-------- for SERIAL interface ----------
Oleg_B 0:d05a7158dbad 42 Serial pc(PA_2, PA_3); // tx, rx
Oleg_B 0:d05a7158dbad 43
Oleg_B 0:d05a7158dbad 44
Oleg_B 0:d05a7158dbad 45 //----------- SPI interface AT45 FLASH -----------
Oleg_B 0:d05a7158dbad 46 SPI spi(PB_15, PB_14, PB_13); // mosi, miso, sclk
Oleg_B 0:d05a7158dbad 47 AT45 spif(&spi, PB_12); // cs
Oleg_B 0:d05a7158dbad 48
Oleg_B 0:d05a7158dbad 49 //--------- CAN_BUS --------------------
Oleg_B 0:d05a7158dbad 50 CAN can(PA_11,PA_12);
Oleg_B 0:d05a7158dbad 51
Oleg_B 0:d05a7158dbad 52 //--------- sys timer -----------------
Oleg_B 0:d05a7158dbad 53 Timer st;
Oleg_B 0:d05a7158dbad 54