Thread: LED Blinking
View Single Post
TrueJournals's Avatar
Posts: 480 | Thanked: 377 times | Joined on Apr 2008 @ Chicago-ish
#23
The different sections of the line are separated by semicolons. So, priority is the first part, then a semicolon, then the "ScreenOn" value, then a semicolon, etc. So, I'll use your example and point out each section of the programming.

0;1;0;40002000200040ff200020000000;0000;0000

To make this easier, I'm going to assign an index to each section of the command. I'll split the string up by the semicolons. We'll say the first character (a zero, in this case) has an index of 1. The second part of the split (a one), has an index of 2, etc, etc.

0;1;0;40002000200040ff200020000000;0000;0000
Index 1 defines the priority. If two patterns trigger at once, items with a higher priority (lower number for this section), take precedence, because only one pattern can be going at once. Since the priority is 1 (0 being the highest priority, 255 being the lowest), this pattern will display instead of almost any other pattern (the exception is patterns that have a priority of 0)

0;1;0;40002000200040ff200020000000;0000;0000
Index 2 defines whether or not the pattern should fire based on what state the display is in. In this case, it's a 1, which mce.ini tells us means "show pattern even when the display is on". So, this pattern will display no matter what.

0;1;0;40002000200040ff200020000000;0000;0000
Index three gives the timeout. This can tell the pattern to stop firing after a certain amount of time. In this case, it's a zero, which means that the pattern will never stop firing (unless it's told to).

0;1;0;40002000200040ff200020000000;0000;0000
Index four starts the actual programming of the LED. Index four gives the programming of the RED LED. It also gets a bit more complicated here. We have to split this section up into strings of four characters each in order to understand the programming. This is what the pattern looks like, split into four-character strings, with each string separated by a pipe (|):
4000|2000|2000|40ff|2000|2000|0000
So, there are seven different commands given to the red LED. Let's take a look at them one by one:
  1. 4000 -- This sets the brightness of the LED (anything starting with a 40 will change the brightness). I believe this tells the LED to turn off (0 brightness). I believe that ff would be 100% brightness.
  2. 2000 -- This bumps the brightness up over a certain amount of time. This gets REALLY confusing. The first two characters, 20, tell how long it should take to change the brightness. 20 is in the 01 - 3f range, so we get "short" steps. If I understand this, we get 19 "short" steps of time ~0.49ms, so this should take about 9.31 milliseconds. The next two characters, 00, defines how many steps in brightness the LED should take. 00 is no change, so the pattern will pause for about 9.31 milliseconds.
  3. 2000 -- Because this is the same command as above, this will also create a 9.31 millisecond pause.
  4. 40ff -- Again we see a 40. This says to change the channel brightness. This time, we're changing it to ff, which should be 100% brightness. So, this command turns the LED on.
  5. 2000 -- This creates another 9.31 ms pause.
  6. 2000 -- This creates another 9.31 ms pause.
  7. 0000 -- This tells the pattern to loop ("jump to the start of the pattern").
So, the red LED will turn off, pause for (2*9.31 ms =) 18.62 milliseconds, turn on, pause for another 18.62 milliseconds, then loop.

0;1;0;40002000200040ff200020000000;0000;0000
Index five gives the pattern for the GREEN LED. This is a very exciting pattern. It simply tells the pattern to repeat again and again and again. So... nothing happens with the green LED.

0;1;0;40002000200040ff200020000000;0000;0000
Index six gives the pattern for the BLUE LED. Again, very exciting. The blue LED does... nothing.

I hope this helps you understand how the programming works.
__________________
Disclaimer: If a program I wrote doesn't work/breaks your tablet... It's not my fault
mcedit | Utility Calculators (WIP) | PyRDesktop
My Blog | Twitter
 

The Following 3 Users Say Thank You to TrueJournals For This Useful Post: