mikroavr

modbus_lte_modem

Jan 24th, 2021
679
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define RXD1 32
  2. #define TXD1 25
  3. #define EN_MODBUS 33
  4. #define serialModbus Serial1
  5.  
  6. #define RXD2 17
  7. #define TXD2 16
  8. #define PKEY 5
  9. #define RST 4
  10. #define serialLTE Serial2
  11.  
  12. void setup() {
  13.   // put your setup code here, to run once:
  14.   Serial.begin(115200);
  15.   serialModbus.begin(9600, SERIAL_8N1, RXD1, TXD1);
  16.   serialLTE.begin(9600, SERIAL_8N1, RXD2, TXD2);
  17.  
  18.   pinMode(EN_MODBUS, OUTPUT);
  19.   pinMode(RST, OUTPUT);
  20.   pinMode(PKEY, OUTPUT);
  21.  
  22.   digitalWrite(PKEY, LOW);
  23.   digitalWrite(RST, HIGH);delay(1000);
  24.   digitalWrite(RST, LOW);delay(1000);
  25.   digitalWrite(RST, HIGH);delay(1000);
  26.   digitalWrite(EN_MODBUS, HIGH);delay(1000);
  27. }
  28.  
  29. void loop() {
  30.   // put your main code here, to run repeatedly:
  31.  
  32. }
RAW Paste Data