![]() ![]() #define TXC0 TXC #define RXEN0 RXEN #define TXEN0 TXEN #define RXCIE0 RXCIE #define UDRIE0 UDRIE #define U2X0 U2X #define UPE0 UPE #define UDRE0 UDRE #elif defined(TXC1) // Some devices have uart1 but no uart0 #define TXC0 TXC1 #define RXEN0 RXEN1 #define TXEN0 TXEN1 #define RXCIE0 RXCIE1 #define UDRIE0 UDRIE1 #define U2X0 U2X1 #define UPE0 UPE1 #define UDRE0 UDRE1 #else #error No UART found in HardwareSerial.cpp #endif #endif // !defined TXC0 #if !defined(UPE) & defined(PE) #define UPE PE #endif // On ATmega8, the uart and its bits are not numbered, so there is no TXC0 etc. #include "Arduino.h" #define SetBit(reg, bita) reg |= (1<<bita) #define ClearBit(reg, bita) reg &= (~(1<<bita)) #define InvBit(reg, bita) reg ^= (1<<bita) #define BitIsSet(reg, bita) ((reg & (1<<bita)) != 0) #define BitIsClear(reg, bita) ((reg & (1<<bita)) = 0) // Arduino Duemilanove, Diecimila, and NG #if defined(_AVR_ATmega168_) || defined(_AVR_ATmega328P_) || defined(_AVR_ATmega328_) #define LedPinOut() DDRB |= (1<<5) #define LedPinOn() PORTB |= (1<<5) #define LedPinOFF() PORTB &= (~(1<<5)) // Arduino Mega #elif defined(_AVR_ATmega1280_) || defined(_AVR_ATmega2560_) #define LedPinOut() DDRB |= (1<<7) #define LedPinOn() PORTB |= (1<<7) #define LedPinOFF() PORTB &= (~(1<<7)) // Leonardo #elif defined(_AVR_ATmega32U4_) #define LedPinOut() DDRC |= (1<<7) #define LedPinOn() PORTC |= (1<<7) #define LedPinOFF() PORTC &= (~(1<<7)) // anything else #else #error "Board not supported" #endif #if defined(Serial_0) //UART0 #if defined(UBRRH) & defined(UBRRL) #define UDRn UDR #define UBRRnH UBRRH #define UBRRnL UBRRL #define UCSRnA UCSRA #define UCSRnB UCSRB #define UCSRnC UCSRC #else #define UDRn UDR0 #define UBRRnH UBRR0H #define UBRRnL UBRR0L #define UCSRnA UCSR0A #define UCSRnB UCSR0B #define UCSRnC UCSR0C #endif #if defined(USART_RX_vect) #define BYTEin USART_RX_vect #elif defined(USART0_RX_vect) #define BYTEin USART0_RX_vect #elif defined(USART_RXC_vect) #define BYTEin USART_RXC_vect //ATmega8 #else #error "Board not supported" #endif #endif //UART0 #if defined(Serial_1) //UART1 #define UDRn UDR1 #define UBRRnH UBRR1H #define UBRRnL UBRR1L #define UCSRnA UCSR1A #define UCSRnB UCSR1B #define UCSRnC UCSR1C #if defined(UART1_RX_vect) #defineěYTEin UART1_RX_vect #elif defined(USART1_RX_vect) #define BYTEin USART1_RX_vect #else #error "Board not supported" #endif #endif //UART1 #if defined(Serial_2) //UART2 #define UDRn UDR2 #define UBRRnH UBRR2H #define UBRRnL UBRR2L #define UCSRnA UCSR2A #define UCSRnB UCSR2B #define UCSRnC UCSR2C #define BYTEin USART2_RX_vect #endif //UART2 #if defined(Serial_3) //UART3 #define UDRn UDR3 #define UBRRnH UBRR3H #define UBRRnL UBRR3L #define UCSRnA UCSR3A #define UCSRnB UCSR3B #define UCSRnC UCSR3C #define BYTEin USART3_RX_vect #endif //UART3 #if !defined(TXC0) #if defined(TXC) // Some chips like ATmega8 don't have UPE, only PE. ![]() 4 pumps, 2 microcompressors and 2 solenoid valves are powered from the Darlington ULN2803 assembly. For radio communication, the HC-12 radio module is used, which perfectly catches a signal even under water. Power is supplied from a separate stabilizer L4941BV with a minimum difference between input and output voltage, which allows for stable operation of the equipment. ![]() (2 axes will be used - one for the trim angle and the second for automatic heading). The IMU sensor allows you to detect tilt angles in three axes. The battery charge is monitored by the INA219 current sensor. To save pins (usually 6 pins are required to connect the L293D driver), the CD4069UBE logic chip is used. In the future, the submarine plans to install 2 engines with screws. Unlike the original Arduino board and its Chinese copies, the board has a 2nd hardware UART on board, which allows you to connect the gps module to determine the coordinates of the submarine using satellite navigation and it allows you to use all the analog pins as digital ones - so I have 2 free pins for connecting sensors. The board is made on the AT Mega 328PB microcontroller. Electronics is assembled on the basis of the Russian version of the Arduino board called Iskra Nano Pro. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |