Skip to content

Instantly share code, notes, and snippets.

@MrTrick
Last active December 16, 2015 16:59
Show Gist options
  • Save MrTrick/5466942 to your computer and use it in GitHub Desktop.
Save MrTrick/5466942 to your computer and use it in GitHub Desktop.
For one round of charlieplexing, sets PORT and DIR LEDs to be lit have their byte set non-zero.
# PORTC = 0b00001000;
00000053 LDI R24,0x08 Load immediate
00000054 OUT 0x08,R24 Out to I/O location
# DDRC = 0b0001|(leds[0]?0b0010:0)|(leds[1]?0b0100:0)|(leds[2]?0b1000:0);
00000055 LDS R24,0x0104 Load direct from data space
00000057 TST R24 Test for Zero or Minus
00000058 BREQ PC+0x03 Branch if equal
00000059 LDI R24,0x03 Load immediate
0000005A RJMP PC+0x0002 Relative jump
0000005B LDI R24,0x01 Load immediate
0000005C LDS R25,0x0105 Load direct from data space
0000005E TST R25 Test for Zero or Minus
0000005F BREQ PC+0x03 Branch if equal
00000060 LDI R25,0x04 Load immediate
00000061 RJMP PC+0x0002 Relative jump
00000062 LDI R25,0x00 Load immediate
00000063 OR R24,R25 Logical OR
00000064 LDS R25,0x0106 Load direct from data space
00000066 TST R25 Test for Zero or Minus
00000067 BREQ PC+0x03 Branch if equal
00000068 LDI R25,0x08 Load immediate
00000069 RJMP PC+0x0002 Relative jump
0000006A LDI R25,0x00 Load immediate
0000006B OR R24,R25 Logical OR
0000006C OUT 0x07,R24 Out to I/O location
0000006D LDI R24,0x00 Load immediate
0000006E LDI R25,0x00 Load immediate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment