Test to measure frequency on digital inputs of nanoWipom board


Test to measure frequency on digital inputs.
The test also counts falling edges on 2 digital inputs (DIN2-3) that belong to TIMER9 inputs.
Install X17,X19-X25,X27 jumpers.
Short the corresponding terminals ( (DIN2+ and DIN2-) OR (DIN3+ and DIN3-) ) of X26 to check an opto-isolated inputs.

Toolkit:STM Development System

Location:/bipom/devtools/STM32/examples/nanoWipom/freq_cnt_input

Code Example


#define MINIMAL_MEASURED_FREQUENCY	100

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

int main(void) 
{
	/* Initialize all port pins */
	NWDIO_Init();
	
	delayMs(250);
	
	/* Initialize FREQUENCY/COUNTER DIN2, DIN3 inputs */
	FREQCNT_Init(DIN2_FREQCNT_CHANNEL,MINIMAL_MEASURED_FREQUENCY);
	FREQCNT_Init(DIN3_FREQCNT_CHANNEL,MINIMAL_MEASURED_FREQUENCY);
	//

	tprintf("\n\rNanoWipom %s %s",__DATE__,__TIME__);
	tprintf("\n\rFREQUENCY/COUNTER INPUT TEST REV 1.01");
	//

	for(;;)
	{
		FREQCNT_SetCounter(DIN2_FREQCNT_CHANNEL,0);
		FREQCNT_SetCounter(DIN3_FREQCNT_CHANNEL,0);
		delayMs(1000);
		tprintf("\n\rDIN2 FREQUENCY=%06u COUNTER=%06u",
			FREQCNT_GetFrequency(DIN2_FREQCNT_CHANNEL),
				FREQCNT_GetCounter(DIN2_FREQCNT_CHANNEL));
		tprintf("\n\rDIN3 FREQUENCY=%06u COUNTER=%06u",
			FREQCNT_GetFrequency(DIN3_FREQCNT_CHANNEL),
				FREQCNT_GetCounter(DIN3_FREQCNT_CHANNEL));		
	}
	return 0;
}