Since you said that if the interviewer asked you the same question, you could mange. Now you're trying to know. You also claim that I also don't know.
Here's how I would do it.
Most micros have a port that can be written to all at once. For this example, we'll call it PORTA and we'll assume it's at least 4-bits wide.
The program in a simple form.
Code:
for x=0 to 15
PORTA = x
next x
The output of PORTA will be:
Code:
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Output 0 changes every clock cycle
Output 1 changes every 2 clock cycles
Output 2 changes every 4 clock cycles
Output 3 changes every 8 clock cycles
4 pins. 4 different frequencies
.
View attachment 115087