Question: Create a decoder function The first component needed is a decoder function that will translate three 8 - bit color values into 2 4 consecutive

Create a decoder function
The first component needed is a decoder function that will translate three 8-bit color values into 24 consecutive calls to write_0() or write_1(). The typical method used for this type of serialization of data is called mask and shift, but there are many ways to implement it. You will have to choose a method and implement it.
Finally, dont forget to hold the output low for >50us to latch the data into the iLED (wait_100us();)
Write a function that does the above with the following declaration:
void writeColor(int r, int g, int b);
Simulate your hardcoded color loop() function and look at the resulting output on the Logic Analyzer.
QUESTION: How many cycles does your hard coded program take to write 24-bits?
Replace the hard-coded calls to write_0(), write_1(), and wait_100us() with your new writeColor() function.
Simulate your new function.
QUESTION: How many cycles does your new function take to write 24-bits?
Verify your new function operates correctly in hardware.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!