Код: Выделить всё
//Changing the operating state control, the next switch-mode converter to a running state
if( (sys_status == 0x10) && ((GPIOA_IDR & (1<<6)) == 0) )sys_status = 0x30;Код: Выделить всё
//Changing the operating state control, the next switch-mode converter to a running state
if( (sys_status == 0x10) && ((GPIOA_IDR & (1<<6)) == 0) )sys_status = 0x30;Код: Выделить всё
//Changing the operating state control, the next switch-mode converter to a running state
if( (sys_status == 0x10) && ((GPIOA_IDR & (1<<6)) == 0) )sys_status = 0x30;Код: Выделить всё
if((uart0_rxbuf[0] == 0x01)&&(uart0_rxbuf[1] == 0x55)&&(uart0_rxbuf[2] == 0xaa)&&(uart0_rxbuf[11] == 0x12)&&(uart0_rxbuf[12] == 0xef)&&(uart0_rxbuf[13] == 0xff)) Код: Выделить всё
UART0_setup();
// uart0_txptr = 0;
// uart0_txall = 2;
// COM0_OUT;
// USART1->DR = 0x55;Код: Выделить всё
//============== Abnormal after treatment 9600bps 8 N 1
default:
/* Set up UART Baud rate 38400bps */
USART_InitStructure.USART_BaudRate = 38400;Код: Выделить всё
switch(program[0x1C])
{
//=============No parity communication setting area ======
case(0x01):
/* Set up UART Baud rate 4800bps */
USART_InitStructure.USART_BaudRate = 4800;Код: Выделить всё
А вот что касается реализации - я не использовал код, который тут выложен.
Всё пришлось проходить с самого начала.
Если будут вопросы по реализации - пишите, постараюсь помочь.

В Modbus RTU разделителем сообщений (фреймов, содержащих запросы и ответы) является тишина на линии в течение не менее 3,5 символов. С учетом того, что стандартный символ передается УАРТом 11-ю битами, получаем длительность этого периода ( называют его t3.5), равную 38,5 периодов бодрейта. Например, для 9600 бод — 4,01 мс (38,5/9600).
