Looking to hook up a rs485 module to my arduino mega. hooking up the RX and TX pins is pretty straight forward, but what pin do I use for the DE, which controls the direction of transmission and how do I toggle it in software when sending and receiving?
RS485 is like RS232, it is NOT TTL serial. You would need a 485 chip to convert the signal to TTL.
Pluggin a RS232 unit in the Atmega will not work either.
no external items req on the chip RS485 in TTL out and power. Look at MAX485 on net for detail.
Ohh I almost forgot. A lot of industrial 485 units require a 'command' before it will send out info. that is why you can have multiple units on one TX/RX pair. Also, some inits require a 'terminator resistor'
I didn't use Arduino with serial comm. But what do you mean by direction? Since you cross the Rx and Tx pins there's no need for other pins.. If however the xmission line is more than 10 meters then you may want to connect the GND as well.. Some devices are TTL levels like HC-6 Bluetooth modules so be careful.