Jump to content

DCS-BIOS over RS485


Hansolo

Recommended Posts

7 minutes ago, No1sonuk said:

Ah, OK.  So if the expected DCS-BIOS messages are being sent, it might be the control reference messages to DCS conversions themselves are wrong.  That might be a DCS_BIOS script coding issue, and I don't know it works.
Which version of DCS-BIOS are you using?

I am using the FlightPanels branch of DCS-BIOS and it should be all up to date. I can call on @BlackLibraryon this maybe. Its possible after all that nobody else is trying to do what I am doing! 😁 

I am trying out your suggestions as we speak. I currently get an error:

JADRO-oct-12-22-timer-SLV-No1son-test:102:22: error: 'valueDial_1' cannot be used as a function
     if ( valueDial_1() == 2) {

 


#define DCSBIOS_IRQ_SERIAL */
/*#define DCSBIOS_RS485_SLAVE 47

/*
  The Arduino pin that is connected to the
  /RE and DE pins on the RS-485 transceiver.
*/
/* #define TXENABLE_PIN 2 */

#include <DcsBios.h>

#include <timer.h>

Timer tm;

int valueDial_1;

int DCS_valueDial_1; // JADRO 1MHZ Knob

/* paste code snippets from the reference documentation here */

void onPltJadro1mChange(unsigned int newValue) {
    DCS_valueDial_1 = newValue;
}
DcsBios::IntegerBuffer pltJadro1mBuffer(0x69f8, 0x000f, 0, onPltJadro1mChange);

void setup() {
  DcsBios::setup();

  DDRC = B00000000; // DIAL 1 1MHZ
  PORTC = B00111111; // DIAL 1 Sets (digital 8-13) with internal pull up
 
 tm.startTimer(500, setDials);
 
}

// JADRO 1MHZ Knob//////////////////////
void inputDial_1()
{
  int valueDial = PINC; // temporary int for port conversion
  
  if (valueDial == B00010110) {
    valueDial_1 = 2;
  }

  if (valueDial == B00001100) {
    valueDial_1 = 3;
  }

  if (valueDial == B00010100) {
    valueDial_1 = 4;
  }

  if (valueDial == B00000110) {
    valueDial_1 = 5;
  }

  if (valueDial == B00001010) {
    valueDial_1 = 6;
  }

  if (valueDial == B00000011) {
    valueDial_1 = 7;
  }

  if (valueDial == B00000101) {
    valueDial_1 = 8;
  }

  if (valueDial == B00010001) {
    valueDial_1 = 9;
  }

  if (valueDial == B00010010) {
    valueDial_1 = 10;
  }

}

////////END OF 1MHZ knob

void loop() {
  DcsBios::loop();
    tm.runTimers(); 
}

void setDials(int timer){

  inputDial_1();  // Read the dials
 
  
  // Check and adjust selector dial 1MHZ
 if (DCS_valueDial_1 != valueDial_1) {    // use the global variables
   
    
    if ( valueDial_1() == 2) {
      sendDcsBiosMessage("PLT_JADRO_1M", "2");
    }
    if ( valueDial_1() == 3) {
      sendDcsBiosMessage("PLT_JADRO_1M", "3");
    }
    if ( valueDial_1() == 4) {
      sendDcsBiosMessage("PLT_JADRO_1M", "4");
    }
    if ( valueDial_1() ==5) {
      sendDcsBiosMessage("PLT_JADRO_1M", "5");
    }
    if ( valueDial_1() == 6) {
      sendDcsBiosMessage("PLT_JADRO_1M", "6");
    }
    if ( valueDial_1() == 7) {
      sendDcsBiosMessage("PLT_JADRO_1M", "7");
    }
    if ( valueDial_1() == 8) {
      sendDcsBiosMessage("PLT_JADRO_1M", "8");
    }
    if ( valueDial_1() == 9) {
      sendDcsBiosMessage("PLT_JADRO_1M", "9");
    }
    if ( valueDial_1() == 10) {
      sendDcsBiosMessage("PLT_JADRO_1M", "10");
    }
    
}

 


Edited by molevitch

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

2 hours ago, molevitch said:

I am using the FlightPanels branch of DCS-BIOS and it should be all up to date. I can call on @BlackLibraryon this maybe. Its possible after all that nobody else is trying to do what I am doing! 😁 

I am trying out your suggestions as we speak. I currently get an error:

JADRO-oct-12-22-timer-SLV-No1son-test:102:22: error: 'valueDial_1' cannot be used as a function
     if ( valueDial_1() == 2) {
 

Looks like you didn't notice the subtle difference I made in the dial code.
"if ( valueDial_1() == 2) {" becomes "if ( valueDial_1 == 2) {"  - remove "()" after valueDial_1.

You might also need an extra } at the end - my snippet was intended as an example of the beginning of the setDials function.  If you stop it there, you'll need to make sure there are the correct number of }.

Link to comment
Share on other sites

38 minutes ago, No1sonuk said:

Looks like you didn't notice the subtle difference I made in the dial code.
"if ( valueDial_1() == 2) {" becomes "if ( valueDial_1 == 2) {"  - remove "()" after valueDial_1.

You might also need an extra } at the end - my snippet was intended as an example of the beginning of the setDials function.  If you stop it there, you'll need to make sure there are the correct number of }.

DOH! OK, told you I was crap at code. I am much better at drawing and making things....

Edited, extra } added, and it compiles...

Now I will have a go at testing it.

 


Edited by molevitch
  • Like 1

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Thanks for all your help. I've learned some more about writing sketches and coding. I will talk to BlackLibrary/Warlord about it, see what he can suggest.

Happy flying/pitbuilding!

 

  • Like 1

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

  • 4 weeks later...

All, I have some Arduino Pro Micros, what is the slave connection to RS485 for these?

it has a TX0 and RX1 instead of the Nano's TX1 and RX0, and according to the pinot diagram pin D2 is actually the RX1 pin. I am assuming that there is no reason I can't select the D1 pin (actually labelled pin 2 on the board) for the TXenable pin, right?

however the fact that the RX and TX are sort of transposed is confusing

Cheers

 

Les 

Link to comment
Share on other sites

On the nano, there's only one port, so "TX1" and "RX0" are TX and RX, digital pins 1 and 0.

On the Mega, there are multiple ports, so TX0 and RX0 are the main port. TX1 and RX1 are the second port and so on.


Edited by No1sonuk
Nano digital pin nos transposed
Link to comment
Share on other sites

Sorry, didn't notice you said micro.

With the ones that have only one port, the TX and RX part are what's important. 

The digital port pins are probably different because the Nano uses a 328 processor and the Pro micro uses a 32u4.

It should be OK as long as you select the right board in the IDE.

Link to comment
Share on other sites

Thanks once more Vinc, that resolved it. I was successful in recovering it, and then programming it with the USB connection APU Temp sketch used with nanos, and it worked fine.

However once I converted the sketch to the RS485 version, I got a load of error messages, which I think mean that I have the TX / RX  / TX enable pins set wrong

Take a look at this lot....!

If I read this correctly it will mean that I have to not only change the code, but also it will be different pinouts so will not be directly interchangeable with the sockets I made for Nano's, am I right? Not that it would be a disaster, it would just mean that I wouldn't be able to use them with my current bank of gauges without hardware modifications

Cheers

Les  

In file included from f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:34:0,
                 from F:\Users\LES\Documents\Arduino\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro.ino:7:
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h: In member function 'void DcsBios::RS485Slave::set_txen()':
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:44: error: 'RXEN0' was not declared in this scope
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                            ^~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:44: note: suggested alternative: 'RXEN1'
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                            ^~~~~
                                            RXEN1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:57: error: 'RXCIE0' was not declared in this scope
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                                         ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:57: note: suggested alternative: 'RXCIE1'
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                                         ^~~~~~
                                                         RXCIE1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:110: error: 'TXEN0' was not declared in this scope
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                                                                                              ^~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:110: note: suggested alternative: 'TXEN1'
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                                                                                              ^~~~~
                                                                                                              TXEN1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:123: error: 'TXCIE0' was not declared in this scope
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                                                                                                           ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:83:123: note: suggested alternative: 'TXCIE1'
   inline void set_txen() { *ucsrb &= ~((1<<RXEN0) | (1<<RXCIE0)); *txen_port |= txen_pin_mask; *ucsrb |= (1<<TXEN0) | (1<<TXCIE0); };
                                                                                                                           ^~~~~~
                                                                                                                           TXCIE1
In file included from f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:34:0,
                 from F:\Users\LES\Documents\Arduino\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro.ino:7:
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h: In member function 'void DcsBios::RS485Slave::clear_txen()':
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:46: error: 'TXEN0' was not declared in this scope
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                              ^~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:46: note: suggested alternative: 'TXEN1'
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                              ^~~~~
                                              TXEN1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:59: error: 'TXCIE0' was not declared in this scope
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                                           ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:59: note: suggested alternative: 'TXCIE1'
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                                           ^~~~~~
                                                           TXCIE1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:113: error: 'RXEN0' was not declared in this scope
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                                                                                                 ^~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:113: note: suggested alternative: 'RXEN1'
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                                                                                                 ^~~~~
                                                                                                                 RXEN1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:126: error: 'RXCIE0' was not declared in this scope
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                                                                                                              ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:84:126: note: suggested alternative: 'RXCIE1'
   inline void clear_txen() { *ucsrb &= ~((1<<TXEN0) | (1<<TXCIE0)); *txen_port &= ~txen_pin_mask; *ucsrb |= (1<<RXEN0) | (1<<RXCIE0); };
                                                                                                                              ^~~~~~
                                                                                                                              RXCIE1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h: In member function 'void DcsBios::RS485Slave::tx_byte(uint8_t)':
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:85:72: error: 'TXC0' was not declared in this scope
   inline void tx_byte(uint8_t c) { set_txen(); *udr = c; *ucsra |= (1<<TXC0); }
                                                                        ^~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:85:72: note: suggested alternative: 'TXC1'
   inline void tx_byte(uint8_t c) { set_txen(); *udr = c; *ucsra |= (1<<TXC0); }
                                                                        ^~~~
                                                                        TXC1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h: In member function 'void DcsBios::RS485Slave::tx_delay_byte()':
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:86:48: error: 'TXEN0' was not declared in this scope
   inline void tx_delay_byte() { *ucsrb |= ((1<<TXEN0) | (1<<TXCIE0)); *udr = 0; }
                                                ^~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:86:48: note: suggested alternative: 'TXEN1'
   inline void tx_delay_byte() { *ucsrb |= ((1<<TXEN0) | (1<<TXCIE0)); *udr = 0; }
                                                ^~~~~
                                                TXEN1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:86:61: error: 'TXCIE0' was not declared in this scope
   inline void tx_delay_byte() { *ucsrb |= ((1<<TXEN0) | (1<<TXCIE0)); *udr = 0; }
                                                             ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:86:61: note: suggested alternative: 'TXCIE1'
   inline void tx_delay_byte() { *ucsrb |= ((1<<TXEN0) | (1<<TXCIE0)); *udr = 0; }
                                                             ^~~~~~
                                                             TXCIE1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h: In member function 'void DcsBios::RS485Slave::set_udrie()':
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:87:43: error: 'UDRIE0' was not declared in this scope
   inline void set_udrie() { *ucsrb |= (1<<UDRIE0); }
                                           ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:87:43: note: suggested alternative: 'UDRIE1'
   inline void set_udrie() { *ucsrb |= (1<<UDRIE0); }
                                           ^~~~~~
                                           UDRIE1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h: In member function 'void DcsBios::RS485Slave::clear_udrie()':
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:88:46: error: 'UDRIE0' was not declared in this scope
   inline void clear_udrie() { *ucsrb &= ~(1<<UDRIE0); }
                                              ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.h:88:46: note: suggested alternative: 'UDRIE1'
   inline void clear_udrie() { *ucsrb &= ~(1<<UDRIE0); }
                                              ^~~~~~
                                              UDRIE1
In file included from f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:35:0,
                 from F:\Users\LES\Documents\Arduino\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro.ino:7:
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc: At global scope:
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:25: error: 'UDR0' was not declared in this scope
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                         ^~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:25: note: suggested alternative: 'UDR1'
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                         ^~~~
                         UDR1
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:32: error: 'UCSR0A' was not declared in this scope
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                                ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:32: note: suggested alternative: 'UCSR1A'
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                                ^~~~~~
                                UCSR1A
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:41: error: 'UCSR0B' was not declared in this scope
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                                         ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:41: note: suggested alternative: 'UCSR1B'
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                                         ^~~~~~
                                         UCSR1B
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:50: error: 'UCSR0C' was not declared in this scope
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                                                  ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:178:50: note: suggested alternative: 'UCSR1C'
  RS485Slave rs485slave(&UDR0, &UCSR0A, &UCSR0B, &UCSR0C, TXENABLE_PIN);
                                                  ^~~~~~
                                                  UCSR1C
In file included from F:\Users\LES\Documents\Arduino\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro.ino:7:0:
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc: In function 'void DcsBios::setup()':
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:18:14: error: 'PRR' was not declared in this scope
 #define PRR0 PRR
              ^
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:184:3: note: in expansion of macro 'PRR0'
   PRR0 &= ~(1<<PRUSART0);
   ^~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:18:14: note: suggested alternative: 'PRR0'
 #define PRR0 PRR
              ^
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:184:3: note: in expansion of macro 'PRR0'
   PRR0 &= ~(1<<PRUSART0);
   ^~~~
In file included from f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:35:0,
                 from F:\Users\LES\Documents\Arduino\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro\X27_168_APU_temp_gauge_no_stepper_driver_zeroing_for_Pro_micro.ino:7:
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:185:3: error: 'UBRR0H' was not declared in this scope
   UBRR0H = 0;
   ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:185:3: note: suggested alternative: 'UBRR1H'
   UBRR0H = 0;
   ^~~~~~
   UBRR1H
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:186:3: error: 'UBRR0L' was not declared in this scope
   UBRR0L = 3; // 250000 bps
   ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:186:3: note: suggested alternative: 'UBRR1L'
   UBRR0L = 3; // 250000 bps
   ^~~~~~
   UBRR1L
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:187:3: error: 'UCSR0A' was not declared in this scope
   UCSR0A = 0;
   ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:187:3: note: suggested alternative: 'UCSR1A'
   UCSR0A = 0;
   ^~~~~~
   UCSR1A
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:188:3: error: 'UCSR0C' was not declared in this scope
   UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
   ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:188:3: note: suggested alternative: 'UCSR1C'
   UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
   ^~~~~~
   UCSR1C
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:188:16: error: 'UCSZ00' was not declared in this scope
   UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
                ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:188:16: note: suggested alternative: 'UCSZ10'
   UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
                ^~~~~~
                UCSZ10
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:188:30: error: 'UCSZ01' was not declared in this scope
   UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
                              ^~~~~~
f:\Users\LES\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/internal/DcsBiosNgRS485Slave.cpp.inc:188:30: note: suggested alternative: 'UCSZ11'
   UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
                              ^~~~~~
                              UCSZ11
Multiple libraries were found for "SwitecX25.h"
  Used: F:\Users\LES\Documents\Arduino\libraries\SwitecX25
  Not used: F:\Users\LES\Documents\Arduino\libraries\SwitecX25-X12
exit status 1

Compilation error: exit status 1

 

Link to comment
Share on other sites

That’s a new one on me, never heard that term before. I assume also that trying to update the library is going to be beyond me, so I’m happy to simply use the ProMicro boards for non-Rs485 uses; there are still quite a few, including a dash mounted volume control that needs an arduino 

if I was to ask what ‘bit-banging’ was, would I regret it?!

cheers 

Les

Link to comment
Share on other sites

I have been told that there should be a resistor between the A and B pins at each slave and reference to the RS485 schematics online shows this. I have not got any, is this something I need to do? 
 

it won’t be difficult to do, but before I do I would need to know whether it would be necessary and if so what value

cheers

Les

Link to comment
Share on other sites

2 hours ago, Roger01 said:

Hello, any chance to use a Mega328p for Master instead of a Mega2560?

Thanks 🙏

The Mega2560 is used because the processor has multiple hardware serial ports. That's necessary to run as a master because it has to use one for USB and another for the RS485 bus.

The 328 can't do that because it only has one hardware serial port.


Edited by No1sonuk
  • Thanks 1
Link to comment
Share on other sites

In one of my occasional (and probably ill-advised) forays into other forums to try and find solutions to issues I have developing new or improved panels, it was pointed out to me that there should be a 120 Ohm resistor between the A and B pins of the master, and apparently over the pins in the 'last' device in the network. Since my network looks like one a drunken spider web, it won't have them at the end, but should I be putting in a resistor over the mega master A and B pins? 

Les


Edited by lesthegrngo
Link to comment
Share on other sites

  • 2 weeks later...

Hi all, I am wiring in all the devices more permanently, however I want to know which is the best way to lay out the RS485 connections.

At the moment the wiring design I have is like a tree; it starts with one main connection, which then connects to two or three connections, with wires gong to hubs. Each hub has three or four RS485 connections for each device and so on

However the impression I get talking (and I use that work loosely) to the guys on the specific forums is that the RS485 network should be like a train line, one long line with 'stations' along it when the connections to the devices are made. While it would add extra wiring it would not be impossible to do, however I want to do the right thing first time. The train line version will take extra planning to get the return wiring for each console. The way the 'experts' were talking it would all go horribly wrong if I adopted what they termed the 'spider web' network

For practical considerations none of the devices will be more than 120cm away from the 'master' RS485 connection  

So should I favour one design philosophy over the other?

Les

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...