RS485 switches test on Wipom board


Switch control pins of RS485 port from FreeRTOS task.

Toolkit:STM Development System

Location:/bipom/devtools/STM32/examples/Wipom/rs485_switches

Code Example


#define SWITCH_DELAY			500

//********************************************************************************

static void vSWITCH( void *pvParameters )
{
	(void) pvParameters;
	while(1) 
	{
		SetRE0();
		vTaskDelay(SWITCH_DELAY);
		ResetRE0();
		vTaskDelay(SWITCH_DELAY);
		SetDE0();
		vTaskDelay(SWITCH_DELAY);
		ResetDE0();
		vTaskDelay(SWITCH_DELAY);
		//

		SetRE1();
		vTaskDelay(SWITCH_DELAY);
		ResetRE1();
		vTaskDelay(SWITCH_DELAY);
		SetDE1();
		vTaskDelay(SWITCH_DELAY);
		ResetDE1();
		vTaskDelay(SWITCH_DELAY);
  	}
}

//********************************************************************************

int main(void) 
{
	delayMs(250);
	
	tprintf("\n\rMini-Max/STM32F1");
	tprintf("\n\rRS485 SWITCH  TEST REV 1.01");
	wipom_rs485_init();
	//

	if(pdPASS != 
		xTaskCreate (vSWITCH, ( const signed portCHAR * const )"SWITCH", 
			configMINIMAL_STACK_SIZE<<4, NULL, tskIDLE_PRIORITY, NULL ))
	{
		tprintf("\n\rERROR: can't create SWITCH task");
	}
	/* Now all the tasks have been started - start the scheduler. */
	vTaskStartScheduler();
	for(;;);
	return 0;
}