Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.54 KB | None | 0 0
  1. #ifndef MAIN_H
  2. #define MAIN_H
  3.  
  4. #include "mbed.h"
  5. #include "x_nucleo_plc01a1_class.h"
  6.  
  7. //IO defintions
  8. DigitalOut LD2(LED1); //I guess this is LED1 cause the count starts at 0?)
  9. AnalogOut out(PA_4);
  10.  
  11. //Class instances
  12. Ticker tickevent1;
  13. Ticker tickevent2;
  14. Ticker tickevent3;
  15.  
  16. //Function Prototypes
  17. void dacticker();
  18. void ledticker();
  19. void relayticker();
  20.  
  21. //Variable definitions
  22. double temp = 0.00;
  23. bool setup_complete = false;
  24.  
  25. /**********************************************************
  26. ******************** PLC BOARD VARS ***********************
  27. /**********************************************************/
  28.  
  29. uint8_t inputArray[2] = {0x00, 0x00};       /* Array for input data from Digital Input Termination Device */
  30. uint8_t outputArray[2] = {0x00, 0x00};      /* Array for output data to Solid State Relay */ //I actually still have no idea what goes in [0]...
  31. uint8_t Ch_On = 0x00;                       /* Number of channels in ON state */
  32.  
  33. uint8_t relay_input = 0x80;                 /* Select the output of the PLC relays */
  34.  
  35. void DigitalInputArrayHandler(X_NUCLEO_PLC01A1 &plc);
  36. void SsrelayHandler(X_NUCLEO_PLC01A1 &plc, uint8_t VNI_out);
  37. void setup(SPI &spi, int bits, int mode, int frequency_hz);
  38.  
  39. /* Initializing SPI bus. */  
  40. SPI spi(X_NUCLEO_PLC01A1_PIN_SPI_MOSI, X_NUCLEO_PLC01A1_PIN_SPI_MISO, X_NUCLEO_PLC01A1_PIN_SPI_SCLK);
  41.  
  42. /* Initializing X_NUCLEO_PLC01A1 IO Channels Component. */
  43. X_NUCLEO_PLC01A1 plc(X_NUCLEO_PLC01A1_PIN_SPI_CS1, X_NUCLEO_PLC01A1_PIN_SPI_CS2, X_NUCLEO_PLC01A1_PIN_OUT_EN, spi);
  44.  
  45. #endif // MAIN_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement