
shiftin_try6_wLED.ino.elf:     file format elf32-avr


Disassembly of section .text:

00000000 <__vectors>:
   0:	0c 94 a2 00 	jmp	0x144	; 0x144 <__ctors_end>
   4:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
   8:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
   c:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  10:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  14:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  18:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  1c:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  20:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  24:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  28:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  2c:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  30:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  34:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  38:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  3c:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  40:	0c 94 75 04 	jmp	0x8ea	; 0x8ea <__vector_16>
  44:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  48:	0c 94 43 04 	jmp	0x886	; 0x886 <__vector_18>
  4c:	0c 94 1d 04 	jmp	0x83a	; 0x83a <__vector_19>
  50:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  54:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  58:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  5c:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  60:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>
  64:	0c 94 ca 00 	jmp	0x194	; 0x194 <__bad_interrupt>

00000068 <__trampolines_end>:
  68:	00 00       	nop
  6a:	00 00       	nop
  6c:	24 00       	.word	0x0024	; ????
  6e:	27 00       	.word	0x0027	; ????
  70:	2a 00       	.word	0x002a	; ????

00000072 <port_to_output_PGM>:
  72:	00 00 00 00 25 00 28 00 2b 00                       ....%.(.+.

0000007c <port_to_input_PGM>:
  7c:	00 00 00 00 23 00 26 00 29 00                       ....#.&.).

00000086 <digital_pin_to_port_PGM>:
  86:	04 04 04 04 04 04 04 04 02 02 02 02 02 02 03 03     ................
  96:	03 03 03 03                                         ....

0000009a <digital_pin_to_bit_mask_PGM>:
  9a:	01 02 04 08 10 20 40 80 01 02 04 08 10 20 01 02     ..... @...... ..
  aa:	04 08 10 20                                         ... 

000000ae <digital_pin_to_timer_PGM>:
  ae:	00 00 00 08 00 02 01 00 00 03 04 07 00 00 00 00     ................
  be:	00 00 00 00                                         ....

000000c2 <charTable>:
  c2:	7e 30 6d 79 33 5b 5f 70 7f 7b 77 1f 0d 3d 4f 47     ~0my3[_p.{w..=OG
	...
  ee:	80 01 80 00 7e 30 6d 79 33 5b 5f 70 7f 7b 00 00     ....~0my3[_p.{..
  fe:	00 00 00 00 00 77 1f 0d 3d 4f 47 00 37 00 00 00     .....w..=OG.7...
 10e:	0e 00 00 00 67 00 00 00 00 00 00 00 00 00 00 00     ....g...........
 11e:	00 00 00 08 00 77 1f 0d 3d 4f 47 00 37 00 00 00     .....w..=OG.7...
 12e:	0e 00 15 1d 67 00 00 00 00 00 00 00 00 00 00 00     ....g...........
 13e:	00 00 00 00                                         ....

00000142 <__ctors_start>:
 142:	bf 04       	cpc	r11, r15

00000144 <__ctors_end>:
 144:	11 24       	eor	r1, r1
 146:	1f be       	out	0x3f, r1	; 63
 148:	cf ef       	ldi	r28, 0xFF	; 255
 14a:	d8 e0       	ldi	r29, 0x08	; 8
 14c:	de bf       	out	0x3e, r29	; 62
 14e:	cd bf       	out	0x3d, r28	; 61

00000150 <__do_copy_data>:
 150:	11 e0       	ldi	r17, 0x01	; 1
 152:	a0 e0       	ldi	r26, 0x00	; 0
 154:	b1 e0       	ldi	r27, 0x01	; 1
 156:	e4 e5       	ldi	r30, 0x54	; 84
 158:	ff e0       	ldi	r31, 0x0F	; 15
 15a:	02 c0       	rjmp	.+4      	; 0x160 <__do_copy_data+0x10>
 15c:	05 90       	lpm	r0, Z+
 15e:	0d 92       	st	X+, r0
 160:	a6 31       	cpi	r26, 0x16	; 22
 162:	b1 07       	cpc	r27, r17
 164:	d9 f7       	brne	.-10     	; 0x15c <__do_copy_data+0xc>

00000166 <__do_clear_bss>:
 166:	22 e0       	ldi	r18, 0x02	; 2
 168:	a6 e1       	ldi	r26, 0x16	; 22
 16a:	b1 e0       	ldi	r27, 0x01	; 1
 16c:	01 c0       	rjmp	.+2      	; 0x170 <.do_clear_bss_start>

0000016e <.do_clear_bss_loop>:
 16e:	1d 92       	st	X+, r1

00000170 <.do_clear_bss_start>:
 170:	ac 33       	cpi	r26, 0x3C	; 60
 172:	b2 07       	cpc	r27, r18
 174:	e1 f7       	brne	.-8      	; 0x16e <.do_clear_bss_loop>

00000176 <__do_global_ctors>:
 176:	10 e0       	ldi	r17, 0x00	; 0
 178:	c2 ea       	ldi	r28, 0xA2	; 162
 17a:	d0 e0       	ldi	r29, 0x00	; 0
 17c:	04 c0       	rjmp	.+8      	; 0x186 <__do_global_ctors+0x10>
 17e:	21 97       	sbiw	r28, 0x01	; 1
 180:	fe 01       	movw	r30, r28
 182:	0e 94 9d 07 	call	0xf3a	; 0xf3a <__tablejump2__>
 186:	c1 3a       	cpi	r28, 0xA1	; 161
 188:	d1 07       	cpc	r29, r17
 18a:	c9 f7       	brne	.-14     	; 0x17e <__do_global_ctors+0x8>
 18c:	0e 94 7a 05 	call	0xaf4	; 0xaf4 <main>
 190:	0c 94 a8 07 	jmp	0xf50	; 0xf50 <_exit>

00000194 <__bad_interrupt>:
 194:	0c 94 00 00 	jmp	0	; 0x0 <__vectors>

00000198 <Print::write(unsigned char const*, unsigned int)>:

// Public Methods //////////////////////////////////////////////////////////////

/* default implementation: may be overridden */
size_t Print::write(const uint8_t *buffer, size_t size)
{
 198:	cf 92       	push	r12
 19a:	df 92       	push	r13
 19c:	ef 92       	push	r14
 19e:	ff 92       	push	r15
 1a0:	0f 93       	push	r16
 1a2:	1f 93       	push	r17
 1a4:	cf 93       	push	r28
 1a6:	df 93       	push	r29
 1a8:	6c 01       	movw	r12, r24
 1aa:	7a 01       	movw	r14, r20
 1ac:	8b 01       	movw	r16, r22
  size_t n = 0;
 1ae:	c0 e0       	ldi	r28, 0x00	; 0
 1b0:	d0 e0       	ldi	r29, 0x00	; 0
  while (size--) {
 1b2:	ce 15       	cp	r28, r14
 1b4:	df 05       	cpc	r29, r15
 1b6:	89 f0       	breq	.+34     	; 0x1da <Print::write(unsigned char const*, unsigned int)+0x42>
    if (write(*buffer++)) n++;
 1b8:	d8 01       	movw	r26, r16
 1ba:	6d 91       	ld	r22, X+
 1bc:	8d 01       	movw	r16, r26
 1be:	d6 01       	movw	r26, r12
 1c0:	ed 91       	ld	r30, X+
 1c2:	fc 91       	ld	r31, X
 1c4:	01 90       	ld	r0, Z+
 1c6:	f0 81       	ld	r31, Z
 1c8:	e0 2d       	mov	r30, r0
 1ca:	c6 01       	movw	r24, r12
 1cc:	09 95       	icall
 1ce:	89 2b       	or	r24, r25
 1d0:	11 f4       	brne	.+4      	; 0x1d6 <Print::write(unsigned char const*, unsigned int)+0x3e>
 1d2:	7e 01       	movw	r14, r28
 1d4:	02 c0       	rjmp	.+4      	; 0x1da <Print::write(unsigned char const*, unsigned int)+0x42>
 1d6:	21 96       	adiw	r28, 0x01	; 1
 1d8:	ec cf       	rjmp	.-40     	; 0x1b2 <Print::write(unsigned char const*, unsigned int)+0x1a>
    else break;
  }
  return n;
}
 1da:	c7 01       	movw	r24, r14
 1dc:	df 91       	pop	r29
 1de:	cf 91       	pop	r28
 1e0:	1f 91       	pop	r17
 1e2:	0f 91       	pop	r16
 1e4:	ff 90       	pop	r15
 1e6:	ef 90       	pop	r14
 1e8:	df 90       	pop	r13
 1ea:	cf 90       	pop	r12
 1ec:	08 95       	ret

000001ee <Print::flush()>:
    size_t println(unsigned long, int = DEC);
    size_t println(double, int = 2);
    size_t println(const Printable&);
    size_t println(void);

    virtual void flush() { /* Empty implementation for backward compatibility */ }
 1ee:	08 95       	ret

000001f0 <Print::availableForWrite()>:
      return write((const uint8_t *)buffer, size);
    }

    // default to zero, meaning "a single write may block"
    // should be overriden by subclasses with buffering
    virtual int availableForWrite() { return 0; }
 1f0:	80 e0       	ldi	r24, 0x00	; 0
 1f2:	90 e0       	ldi	r25, 0x00	; 0
 1f4:	08 95       	ret

000001f6 <HardwareSerial::availableForWrite()>:
{
#if (SERIAL_TX_BUFFER_SIZE>256)
  uint8_t oldSREG = SREG;
  cli();
#endif
  tx_buffer_index_t head = _tx_buffer_head;
 1f6:	fc 01       	movw	r30, r24
 1f8:	53 8d       	ldd	r21, Z+27	; 0x1b
  tx_buffer_index_t tail = _tx_buffer_tail;
 1fa:	44 8d       	ldd	r20, Z+28	; 0x1c
 1fc:	25 2f       	mov	r18, r21
 1fe:	30 e0       	ldi	r19, 0x00	; 0
 200:	84 2f       	mov	r24, r20
 202:	90 e0       	ldi	r25, 0x00	; 0
#if (SERIAL_TX_BUFFER_SIZE>256)
  SREG = oldSREG;
#endif
  if (head >= tail) return SERIAL_TX_BUFFER_SIZE - 1 - head + tail;
 204:	82 1b       	sub	r24, r18
 206:	93 0b       	sbc	r25, r19
 208:	54 17       	cp	r21, r20
 20a:	10 f0       	brcs	.+4      	; 0x210 <HardwareSerial::availableForWrite()+0x1a>
 20c:	cf 96       	adiw	r24, 0x3f	; 63
 20e:	08 95       	ret
  return tail - head - 1;
 210:	01 97       	sbiw	r24, 0x01	; 1
}
 212:	08 95       	ret

00000214 <HardwareSerial::read()>:
    return _rx_buffer[_rx_buffer_tail];
  }
}

int HardwareSerial::read(void)
{
 214:	fc 01       	movw	r30, r24
  // if the head isn't ahead of the tail, we don't have any characters
  if (_rx_buffer_head == _rx_buffer_tail) {
 216:	91 8d       	ldd	r25, Z+25	; 0x19
 218:	82 8d       	ldd	r24, Z+26	; 0x1a
 21a:	98 17       	cp	r25, r24
 21c:	61 f0       	breq	.+24     	; 0x236 <HardwareSerial::read()+0x22>
    return -1;
  } else {
    unsigned char c = _rx_buffer[_rx_buffer_tail];
 21e:	82 8d       	ldd	r24, Z+26	; 0x1a
 220:	df 01       	movw	r26, r30
 222:	a8 0f       	add	r26, r24
 224:	b1 1d       	adc	r27, r1
 226:	5d 96       	adiw	r26, 0x1d	; 29
 228:	8c 91       	ld	r24, X
    _rx_buffer_tail = (rx_buffer_index_t)(_rx_buffer_tail + 1) % SERIAL_RX_BUFFER_SIZE;
 22a:	92 8d       	ldd	r25, Z+26	; 0x1a
 22c:	9f 5f       	subi	r25, 0xFF	; 255
 22e:	9f 73       	andi	r25, 0x3F	; 63
 230:	92 8f       	std	Z+26, r25	; 0x1a
    return c;
 232:	90 e0       	ldi	r25, 0x00	; 0
 234:	08 95       	ret

int HardwareSerial::read(void)
{
  // if the head isn't ahead of the tail, we don't have any characters
  if (_rx_buffer_head == _rx_buffer_tail) {
    return -1;
 236:	8f ef       	ldi	r24, 0xFF	; 255
 238:	9f ef       	ldi	r25, 0xFF	; 255
  } else {
    unsigned char c = _rx_buffer[_rx_buffer_tail];
    _rx_buffer_tail = (rx_buffer_index_t)(_rx_buffer_tail + 1) % SERIAL_RX_BUFFER_SIZE;
    return c;
  }
}
 23a:	08 95       	ret

0000023c <HardwareSerial::peek()>:
{
  return ((unsigned int)(SERIAL_RX_BUFFER_SIZE + _rx_buffer_head - _rx_buffer_tail)) % SERIAL_RX_BUFFER_SIZE;
}

int HardwareSerial::peek(void)
{
 23c:	fc 01       	movw	r30, r24
  if (_rx_buffer_head == _rx_buffer_tail) {
 23e:	91 8d       	ldd	r25, Z+25	; 0x19
 240:	82 8d       	ldd	r24, Z+26	; 0x1a
 242:	98 17       	cp	r25, r24
 244:	31 f0       	breq	.+12     	; 0x252 <HardwareSerial::peek()+0x16>
    return -1;
  } else {
    return _rx_buffer[_rx_buffer_tail];
 246:	82 8d       	ldd	r24, Z+26	; 0x1a
 248:	e8 0f       	add	r30, r24
 24a:	f1 1d       	adc	r31, r1
 24c:	85 8d       	ldd	r24, Z+29	; 0x1d
 24e:	90 e0       	ldi	r25, 0x00	; 0
 250:	08 95       	ret
}

int HardwareSerial::peek(void)
{
  if (_rx_buffer_head == _rx_buffer_tail) {
    return -1;
 252:	8f ef       	ldi	r24, 0xFF	; 255
 254:	9f ef       	ldi	r25, 0xFF	; 255
  } else {
    return _rx_buffer[_rx_buffer_tail];
  }
}
 256:	08 95       	ret

00000258 <HardwareSerial::available()>:
  // clear any received data
  _rx_buffer_head = _rx_buffer_tail;
}

int HardwareSerial::available(void)
{
 258:	fc 01       	movw	r30, r24
  return ((unsigned int)(SERIAL_RX_BUFFER_SIZE + _rx_buffer_head - _rx_buffer_tail)) % SERIAL_RX_BUFFER_SIZE;
 25a:	91 8d       	ldd	r25, Z+25	; 0x19
 25c:	22 8d       	ldd	r18, Z+26	; 0x1a
 25e:	89 2f       	mov	r24, r25
 260:	90 e0       	ldi	r25, 0x00	; 0
 262:	80 5c       	subi	r24, 0xC0	; 192
 264:	9f 4f       	sbci	r25, 0xFF	; 255
 266:	82 1b       	sub	r24, r18
 268:	91 09       	sbc	r25, r1
}
 26a:	8f 73       	andi	r24, 0x3F	; 63
 26c:	99 27       	eor	r25, r25
 26e:	08 95       	ret

00000270 <Serial0_available()>:
#endif

// Function that can be weakly referenced by serialEventRun to prevent
// pulling in this file if it's not otherwise used.
bool Serial0_available() {
  return Serial.available();
 270:	87 e4       	ldi	r24, 0x47	; 71
 272:	91 e0       	ldi	r25, 0x01	; 1
 274:	0e 94 2c 01 	call	0x258	; 0x258 <HardwareSerial::available()>
 278:	21 e0       	ldi	r18, 0x01	; 1
 27a:	89 2b       	or	r24, r25
 27c:	09 f4       	brne	.+2      	; 0x280 <Serial0_available()+0x10>
 27e:	20 e0       	ldi	r18, 0x00	; 0
}
 280:	82 2f       	mov	r24, r18
 282:	08 95       	ret

00000284 <HardwareSerial::_tx_udr_empty_irq()>:
}

// Actual interrupt handlers //////////////////////////////////////////////////////////////

void HardwareSerial::_tx_udr_empty_irq(void)
{
 284:	fc 01       	movw	r30, r24
  // If interrupts are enabled, there must be more data in the output
  // buffer. Send the next byte
  unsigned char c = _tx_buffer[_tx_buffer_tail];
 286:	84 8d       	ldd	r24, Z+28	; 0x1c
 288:	df 01       	movw	r26, r30
 28a:	a8 0f       	add	r26, r24
 28c:	b1 1d       	adc	r27, r1
 28e:	a3 5a       	subi	r26, 0xA3	; 163
 290:	bf 4f       	sbci	r27, 0xFF	; 255
 292:	2c 91       	ld	r18, X
  _tx_buffer_tail = (_tx_buffer_tail + 1) % SERIAL_TX_BUFFER_SIZE;
 294:	84 8d       	ldd	r24, Z+28	; 0x1c
 296:	90 e0       	ldi	r25, 0x00	; 0
 298:	01 96       	adiw	r24, 0x01	; 1
 29a:	8f 73       	andi	r24, 0x3F	; 63
 29c:	99 27       	eor	r25, r25
 29e:	84 8f       	std	Z+28, r24	; 0x1c

  *_udr = c;
 2a0:	a6 89       	ldd	r26, Z+22	; 0x16
 2a2:	b7 89       	ldd	r27, Z+23	; 0x17
 2a4:	2c 93       	st	X, r18

  // clear the TXC bit -- "can be cleared by writing a one to its bit
  // location". This makes sure flush() won't return until the bytes
  // actually got written
  sbi(*_ucsra, TXC0);
 2a6:	a0 89       	ldd	r26, Z+16	; 0x10
 2a8:	b1 89       	ldd	r27, Z+17	; 0x11
 2aa:	8c 91       	ld	r24, X
 2ac:	80 64       	ori	r24, 0x40	; 64
 2ae:	8c 93       	st	X, r24

  if (_tx_buffer_head == _tx_buffer_tail) {
 2b0:	93 8d       	ldd	r25, Z+27	; 0x1b
 2b2:	84 8d       	ldd	r24, Z+28	; 0x1c
 2b4:	98 13       	cpse	r25, r24
 2b6:	06 c0       	rjmp	.+12     	; 0x2c4 <HardwareSerial::_tx_udr_empty_irq()+0x40>
    // Buffer empty, so disable interrupts
    cbi(*_ucsrb, UDRIE0);
 2b8:	02 88       	ldd	r0, Z+18	; 0x12
 2ba:	f3 89       	ldd	r31, Z+19	; 0x13
 2bc:	e0 2d       	mov	r30, r0
 2be:	80 81       	ld	r24, Z
 2c0:	8f 7d       	andi	r24, 0xDF	; 223
 2c2:	80 83       	st	Z, r24
 2c4:	08 95       	ret

000002c6 <HardwareSerial::write(unsigned char)>:
  // If we get here, nothing is queued anymore (DRIE is disabled) and
  // the hardware finished tranmission (TXC is set).
}

size_t HardwareSerial::write(uint8_t c)
{
 2c6:	ef 92       	push	r14
 2c8:	ff 92       	push	r15
 2ca:	0f 93       	push	r16
 2cc:	1f 93       	push	r17
 2ce:	cf 93       	push	r28
 2d0:	df 93       	push	r29
 2d2:	ec 01       	movw	r28, r24
  _written = true;
 2d4:	81 e0       	ldi	r24, 0x01	; 1
 2d6:	88 8f       	std	Y+24, r24	; 0x18
  // If the buffer and the data register is empty, just write the byte
  // to the data register and be done. This shortcut helps
  // significantly improve the effective datarate at high (>
  // 500kbit/s) bitrates, where interrupt overhead becomes a slowdown.
  if (_tx_buffer_head == _tx_buffer_tail && bit_is_set(*_ucsra, UDRE0)) {
 2d8:	9b 8d       	ldd	r25, Y+27	; 0x1b
 2da:	8c 8d       	ldd	r24, Y+28	; 0x1c
 2dc:	98 13       	cpse	r25, r24
 2de:	05 c0       	rjmp	.+10     	; 0x2ea <HardwareSerial::write(unsigned char)+0x24>
 2e0:	e8 89       	ldd	r30, Y+16	; 0x10
 2e2:	f9 89       	ldd	r31, Y+17	; 0x11
 2e4:	80 81       	ld	r24, Z
 2e6:	85 fd       	sbrc	r24, 5
 2e8:	24 c0       	rjmp	.+72     	; 0x332 <HardwareSerial::write(unsigned char)+0x6c>
 2ea:	f6 2e       	mov	r15, r22
    *_udr = c;
    sbi(*_ucsra, TXC0);
    return 1;
  }
  tx_buffer_index_t i = (_tx_buffer_head + 1) % SERIAL_TX_BUFFER_SIZE;
 2ec:	0b 8d       	ldd	r16, Y+27	; 0x1b
 2ee:	10 e0       	ldi	r17, 0x00	; 0
 2f0:	0f 5f       	subi	r16, 0xFF	; 255
 2f2:	1f 4f       	sbci	r17, 0xFF	; 255
 2f4:	0f 73       	andi	r16, 0x3F	; 63
 2f6:	11 27       	eor	r17, r17
 2f8:	e0 2e       	mov	r14, r16
	
  // If the output buffer is full, there's nothing for it other than to 
  // wait for the interrupt handler to empty it a bit
  while (i == _tx_buffer_tail) {
 2fa:	8c 8d       	ldd	r24, Y+28	; 0x1c
 2fc:	e8 12       	cpse	r14, r24
 2fe:	0c c0       	rjmp	.+24     	; 0x318 <HardwareSerial::write(unsigned char)+0x52>
    if (bit_is_clear(SREG, SREG_I)) {
 300:	0f b6       	in	r0, 0x3f	; 63
 302:	07 fc       	sbrc	r0, 7
 304:	fa cf       	rjmp	.-12     	; 0x2fa <HardwareSerial::write(unsigned char)+0x34>
      // Interrupts are disabled, so we'll have to poll the data
      // register empty flag ourselves. If it is set, pretend an
      // interrupt has happened and call the handler to free up
      // space for us.
      if(bit_is_set(*_ucsra, UDRE0))
 306:	e8 89       	ldd	r30, Y+16	; 0x10
 308:	f9 89       	ldd	r31, Y+17	; 0x11
 30a:	80 81       	ld	r24, Z
 30c:	85 ff       	sbrs	r24, 5
 30e:	f5 cf       	rjmp	.-22     	; 0x2fa <HardwareSerial::write(unsigned char)+0x34>
	_tx_udr_empty_irq();
 310:	ce 01       	movw	r24, r28
 312:	0e 94 42 01 	call	0x284	; 0x284 <HardwareSerial::_tx_udr_empty_irq()>
 316:	f1 cf       	rjmp	.-30     	; 0x2fa <HardwareSerial::write(unsigned char)+0x34>
    } else {
      // nop, the interrupt handler will free up space for us
    }
  }

  _tx_buffer[_tx_buffer_head] = c;
 318:	8b 8d       	ldd	r24, Y+27	; 0x1b
 31a:	fe 01       	movw	r30, r28
 31c:	e8 0f       	add	r30, r24
 31e:	f1 1d       	adc	r31, r1
 320:	e3 5a       	subi	r30, 0xA3	; 163
 322:	ff 4f       	sbci	r31, 0xFF	; 255
 324:	f0 82       	st	Z, r15
  _tx_buffer_head = i;
 326:	0b 8f       	std	Y+27, r16	; 0x1b
	
  sbi(*_ucsrb, UDRIE0);
 328:	ea 89       	ldd	r30, Y+18	; 0x12
 32a:	fb 89       	ldd	r31, Y+19	; 0x13
 32c:	80 81       	ld	r24, Z
 32e:	80 62       	ori	r24, 0x20	; 32
 330:	07 c0       	rjmp	.+14     	; 0x340 <HardwareSerial::write(unsigned char)+0x7a>
  // If the buffer and the data register is empty, just write the byte
  // to the data register and be done. This shortcut helps
  // significantly improve the effective datarate at high (>
  // 500kbit/s) bitrates, where interrupt overhead becomes a slowdown.
  if (_tx_buffer_head == _tx_buffer_tail && bit_is_set(*_ucsra, UDRE0)) {
    *_udr = c;
 332:	ee 89       	ldd	r30, Y+22	; 0x16
 334:	ff 89       	ldd	r31, Y+23	; 0x17
 336:	60 83       	st	Z, r22
    sbi(*_ucsra, TXC0);
 338:	e8 89       	ldd	r30, Y+16	; 0x10
 33a:	f9 89       	ldd	r31, Y+17	; 0x11
 33c:	80 81       	ld	r24, Z
 33e:	80 64       	ori	r24, 0x40	; 64
 340:	80 83       	st	Z, r24
  _tx_buffer_head = i;
	
  sbi(*_ucsrb, UDRIE0);
  
  return 1;
}
 342:	81 e0       	ldi	r24, 0x01	; 1
 344:	90 e0       	ldi	r25, 0x00	; 0
 346:	df 91       	pop	r29
 348:	cf 91       	pop	r28
 34a:	1f 91       	pop	r17
 34c:	0f 91       	pop	r16
 34e:	ff 90       	pop	r15
 350:	ef 90       	pop	r14
 352:	08 95       	ret

00000354 <HardwareSerial::flush()>:
  if (head >= tail) return SERIAL_TX_BUFFER_SIZE - 1 - head + tail;
  return tail - head - 1;
}

void HardwareSerial::flush()
{
 354:	cf 93       	push	r28
 356:	df 93       	push	r29
 358:	ec 01       	movw	r28, r24
  // If we have never written a byte, no need to flush. This special
  // case is needed since there is no way to force the TXC (transmit
  // complete) bit to 1 during initialization
  if (!_written)
 35a:	88 8d       	ldd	r24, Y+24	; 0x18
 35c:	88 23       	and	r24, r24
 35e:	c9 f0       	breq	.+50     	; 0x392 <HardwareSerial::flush()+0x3e>
    return;

  while (bit_is_set(*_ucsrb, UDRIE0) || bit_is_clear(*_ucsra, TXC0)) {
 360:	ea 89       	ldd	r30, Y+18	; 0x12
 362:	fb 89       	ldd	r31, Y+19	; 0x13
 364:	80 81       	ld	r24, Z
 366:	85 fd       	sbrc	r24, 5
 368:	05 c0       	rjmp	.+10     	; 0x374 <HardwareSerial::flush()+0x20>
 36a:	a8 89       	ldd	r26, Y+16	; 0x10
 36c:	b9 89       	ldd	r27, Y+17	; 0x11
 36e:	8c 91       	ld	r24, X
 370:	86 fd       	sbrc	r24, 6
 372:	0f c0       	rjmp	.+30     	; 0x392 <HardwareSerial::flush()+0x3e>
    if (bit_is_clear(SREG, SREG_I) && bit_is_set(*_ucsrb, UDRIE0))
 374:	0f b6       	in	r0, 0x3f	; 63
 376:	07 fc       	sbrc	r0, 7
 378:	f5 cf       	rjmp	.-22     	; 0x364 <HardwareSerial::flush()+0x10>
 37a:	80 81       	ld	r24, Z
 37c:	85 ff       	sbrs	r24, 5
 37e:	f2 cf       	rjmp	.-28     	; 0x364 <HardwareSerial::flush()+0x10>
	// Interrupts are globally disabled, but the DR empty
	// interrupt should be enabled, so poll the DR empty flag to
	// prevent deadlock
	if (bit_is_set(*_ucsra, UDRE0))
 380:	a8 89       	ldd	r26, Y+16	; 0x10
 382:	b9 89       	ldd	r27, Y+17	; 0x11
 384:	8c 91       	ld	r24, X
 386:	85 ff       	sbrs	r24, 5
 388:	ed cf       	rjmp	.-38     	; 0x364 <HardwareSerial::flush()+0x10>
	  _tx_udr_empty_irq();
 38a:	ce 01       	movw	r24, r28
 38c:	0e 94 42 01 	call	0x284	; 0x284 <HardwareSerial::_tx_udr_empty_irq()>
 390:	e7 cf       	rjmp	.-50     	; 0x360 <HardwareSerial::flush()+0xc>
  }
  // If we get here, nothing is queued anymore (DRIE is disabled) and
  // the hardware finished tranmission (TXC is set).
}
 392:	df 91       	pop	r29
 394:	cf 91       	pop	r28
 396:	08 95       	ret

00000398 <serialEventRun()>:
#endif

void serialEventRun(void)
{
#if defined(HAVE_HWSERIAL0)
  if (Serial0_available && serialEvent && Serial0_available()) serialEvent();
 398:	80 e0       	ldi	r24, 0x00	; 0
 39a:	90 e0       	ldi	r25, 0x00	; 0
 39c:	89 2b       	or	r24, r25
 39e:	29 f0       	breq	.+10     	; 0x3aa <serialEventRun()+0x12>
 3a0:	0e 94 38 01 	call	0x270	; 0x270 <Serial0_available()>
 3a4:	81 11       	cpse	r24, r1
 3a6:	0c 94 00 00 	jmp	0	; 0x0 <__vectors>
 3aa:	08 95       	ret

000003ac <turnOffPWM>:
//
//static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline));
//static inline void turnOffPWM(uint8_t timer)
static void turnOffPWM(uint8_t timer)
{
	switch (timer)
 3ac:	83 30       	cpi	r24, 0x03	; 3
 3ae:	81 f0       	breq	.+32     	; 0x3d0 <turnOffPWM+0x24>
 3b0:	28 f4       	brcc	.+10     	; 0x3bc <turnOffPWM+0x10>
 3b2:	81 30       	cpi	r24, 0x01	; 1
 3b4:	99 f0       	breq	.+38     	; 0x3dc <turnOffPWM+0x30>
 3b6:	82 30       	cpi	r24, 0x02	; 2
 3b8:	a1 f0       	breq	.+40     	; 0x3e2 <turnOffPWM+0x36>
 3ba:	08 95       	ret
 3bc:	87 30       	cpi	r24, 0x07	; 7
 3be:	a9 f0       	breq	.+42     	; 0x3ea <turnOffPWM+0x3e>
 3c0:	88 30       	cpi	r24, 0x08	; 8
 3c2:	b9 f0       	breq	.+46     	; 0x3f2 <turnOffPWM+0x46>
 3c4:	84 30       	cpi	r24, 0x04	; 4
 3c6:	d1 f4       	brne	.+52     	; 0x3fc <turnOffPWM+0x50>
	{
		#if defined(TCCR1A) && defined(COM1A1)
		case TIMER1A:   cbi(TCCR1A, COM1A1);    break;
		#endif
		#if defined(TCCR1A) && defined(COM1B1)
		case TIMER1B:   cbi(TCCR1A, COM1B1);    break;
 3c8:	80 91 80 00 	lds	r24, 0x0080	; 0x800080 <__TEXT_REGION_LENGTH__+0x7e0080>
 3cc:	8f 7d       	andi	r24, 0xDF	; 223
 3ce:	03 c0       	rjmp	.+6      	; 0x3d6 <turnOffPWM+0x2a>
static void turnOffPWM(uint8_t timer)
{
	switch (timer)
	{
		#if defined(TCCR1A) && defined(COM1A1)
		case TIMER1A:   cbi(TCCR1A, COM1A1);    break;
 3d0:	80 91 80 00 	lds	r24, 0x0080	; 0x800080 <__TEXT_REGION_LENGTH__+0x7e0080>
 3d4:	8f 77       	andi	r24, 0x7F	; 127
		#endif
		#if defined(TCCR1A) && defined(COM1B1)
		case TIMER1B:   cbi(TCCR1A, COM1B1);    break;
 3d6:	80 93 80 00 	sts	0x0080, r24	; 0x800080 <__TEXT_REGION_LENGTH__+0x7e0080>
 3da:	08 95       	ret
		#if defined(TCCR2) && defined(COM21)
		case  TIMER2:   cbi(TCCR2, COM21);      break;
		#endif
		
		#if defined(TCCR0A) && defined(COM0A1)
		case  TIMER0A:  cbi(TCCR0A, COM0A1);    break;
 3dc:	84 b5       	in	r24, 0x24	; 36
 3de:	8f 77       	andi	r24, 0x7F	; 127
 3e0:	02 c0       	rjmp	.+4      	; 0x3e6 <turnOffPWM+0x3a>
		#endif
		
		#if defined(TCCR0A) && defined(COM0B1)
		case  TIMER0B:  cbi(TCCR0A, COM0B1);    break;
 3e2:	84 b5       	in	r24, 0x24	; 36
 3e4:	8f 7d       	andi	r24, 0xDF	; 223
 3e6:	84 bd       	out	0x24, r24	; 36
 3e8:	08 95       	ret
		#endif
		#if defined(TCCR2A) && defined(COM2A1)
		case  TIMER2A:  cbi(TCCR2A, COM2A1);    break;
 3ea:	80 91 b0 00 	lds	r24, 0x00B0	; 0x8000b0 <__TEXT_REGION_LENGTH__+0x7e00b0>
 3ee:	8f 77       	andi	r24, 0x7F	; 127
 3f0:	03 c0       	rjmp	.+6      	; 0x3f8 <turnOffPWM+0x4c>
		#endif
		#if defined(TCCR2A) && defined(COM2B1)
		case  TIMER2B:  cbi(TCCR2A, COM2B1);    break;
 3f2:	80 91 b0 00 	lds	r24, 0x00B0	; 0x8000b0 <__TEXT_REGION_LENGTH__+0x7e00b0>
 3f6:	8f 7d       	andi	r24, 0xDF	; 223
 3f8:	80 93 b0 00 	sts	0x00B0, r24	; 0x8000b0 <__TEXT_REGION_LENGTH__+0x7e00b0>
 3fc:	08 95       	ret

000003fe <digitalRead>:

	SREG = oldSREG;
}

int digitalRead(uint8_t pin)
{
 3fe:	cf 93       	push	r28
 400:	df 93       	push	r29
	uint8_t timer = digitalPinToTimer(pin);
 402:	28 2f       	mov	r18, r24
 404:	30 e0       	ldi	r19, 0x00	; 0
 406:	f9 01       	movw	r30, r18
 408:	e2 55       	subi	r30, 0x52	; 82
 40a:	ff 4f       	sbci	r31, 0xFF	; 255
 40c:	84 91       	lpm	r24, Z
	uint8_t bit = digitalPinToBitMask(pin);
 40e:	f9 01       	movw	r30, r18
 410:	e6 56       	subi	r30, 0x66	; 102
 412:	ff 4f       	sbci	r31, 0xFF	; 255
 414:	d4 91       	lpm	r29, Z
	uint8_t port = digitalPinToPort(pin);
 416:	f9 01       	movw	r30, r18
 418:	ea 57       	subi	r30, 0x7A	; 122
 41a:	ff 4f       	sbci	r31, 0xFF	; 255
 41c:	c4 91       	lpm	r28, Z

	if (port == NOT_A_PIN) return LOW;
 41e:	cc 23       	and	r28, r28
 420:	91 f0       	breq	.+36     	; 0x446 <__LOCK_REGION_LENGTH__+0x46>

	// If the pin that support PWM output, we need to turn it off
	// before getting a digital reading.
	if (timer != NOT_ON_TIMER) turnOffPWM(timer);
 422:	81 11       	cpse	r24, r1
 424:	0e 94 d6 01 	call	0x3ac	; 0x3ac <turnOffPWM>

	if (*portInputRegister(port) & bit) return HIGH;
 428:	ec 2f       	mov	r30, r28
 42a:	f0 e0       	ldi	r31, 0x00	; 0
 42c:	ee 0f       	add	r30, r30
 42e:	ff 1f       	adc	r31, r31
 430:	e4 58       	subi	r30, 0x84	; 132
 432:	ff 4f       	sbci	r31, 0xFF	; 255
 434:	a5 91       	lpm	r26, Z+
 436:	b4 91       	lpm	r27, Z
 438:	ec 91       	ld	r30, X
 43a:	ed 23       	and	r30, r29
 43c:	81 e0       	ldi	r24, 0x01	; 1
 43e:	90 e0       	ldi	r25, 0x00	; 0
 440:	21 f4       	brne	.+8      	; 0x44a <__LOCK_REGION_LENGTH__+0x4a>
 442:	80 e0       	ldi	r24, 0x00	; 0
 444:	02 c0       	rjmp	.+4      	; 0x44a <__LOCK_REGION_LENGTH__+0x4a>
{
	uint8_t timer = digitalPinToTimer(pin);
	uint8_t bit = digitalPinToBitMask(pin);
	uint8_t port = digitalPinToPort(pin);

	if (port == NOT_A_PIN) return LOW;
 446:	80 e0       	ldi	r24, 0x00	; 0
 448:	90 e0       	ldi	r25, 0x00	; 0
	// before getting a digital reading.
	if (timer != NOT_ON_TIMER) turnOffPWM(timer);

	if (*portInputRegister(port) & bit) return HIGH;
	return LOW;
}
 44a:	df 91       	pop	r29
 44c:	cf 91       	pop	r28
 44e:	08 95       	ret

00000450 <digitalWrite>:
		#endif
	}
}

void digitalWrite(uint8_t pin, uint8_t val)
{
 450:	1f 93       	push	r17
 452:	cf 93       	push	r28
 454:	df 93       	push	r29
	uint8_t timer = digitalPinToTimer(pin);
 456:	28 2f       	mov	r18, r24
 458:	30 e0       	ldi	r19, 0x00	; 0
 45a:	f9 01       	movw	r30, r18
 45c:	e2 55       	subi	r30, 0x52	; 82
 45e:	ff 4f       	sbci	r31, 0xFF	; 255
 460:	84 91       	lpm	r24, Z
	uint8_t bit = digitalPinToBitMask(pin);
 462:	f9 01       	movw	r30, r18
 464:	e6 56       	subi	r30, 0x66	; 102
 466:	ff 4f       	sbci	r31, 0xFF	; 255
 468:	d4 91       	lpm	r29, Z
	uint8_t port = digitalPinToPort(pin);
 46a:	f9 01       	movw	r30, r18
 46c:	ea 57       	subi	r30, 0x7A	; 122
 46e:	ff 4f       	sbci	r31, 0xFF	; 255
 470:	c4 91       	lpm	r28, Z
	volatile uint8_t *out;

	if (port == NOT_A_PIN) return;
 472:	cc 23       	and	r28, r28
 474:	c9 f0       	breq	.+50     	; 0x4a8 <digitalWrite+0x58>
 476:	16 2f       	mov	r17, r22

	// If the pin that support PWM output, we need to turn it off
	// before doing a digital write.
	if (timer != NOT_ON_TIMER) turnOffPWM(timer);
 478:	81 11       	cpse	r24, r1
 47a:	0e 94 d6 01 	call	0x3ac	; 0x3ac <turnOffPWM>

	out = portOutputRegister(port);
 47e:	ec 2f       	mov	r30, r28
 480:	f0 e0       	ldi	r31, 0x00	; 0
 482:	ee 0f       	add	r30, r30
 484:	ff 1f       	adc	r31, r31
 486:	ee 58       	subi	r30, 0x8E	; 142
 488:	ff 4f       	sbci	r31, 0xFF	; 255
 48a:	a5 91       	lpm	r26, Z+
 48c:	b4 91       	lpm	r27, Z

	uint8_t oldSREG = SREG;
 48e:	8f b7       	in	r24, 0x3f	; 63
	cli();
 490:	f8 94       	cli

	if (val == LOW) {
 492:	11 11       	cpse	r17, r1
 494:	05 c0       	rjmp	.+10     	; 0x4a0 <digitalWrite+0x50>
		*out &= ~bit;
 496:	9c 91       	ld	r25, X
 498:	ed 2f       	mov	r30, r29
 49a:	e0 95       	com	r30
 49c:	e9 23       	and	r30, r25
 49e:	02 c0       	rjmp	.+4      	; 0x4a4 <digitalWrite+0x54>
	} else {
		*out |= bit;
 4a0:	ec 91       	ld	r30, X
 4a2:	ed 2b       	or	r30, r29
 4a4:	ec 93       	st	X, r30
	}

	SREG = oldSREG;
 4a6:	8f bf       	out	0x3f, r24	; 63
}
 4a8:	df 91       	pop	r29
 4aa:	cf 91       	pop	r28
 4ac:	1f 91       	pop	r17
 4ae:	08 95       	ret

000004b0 <pinMode>:
#define ARDUINO_MAIN
#include "wiring_private.h"
#include "pins_arduino.h"

void pinMode(uint8_t pin, uint8_t mode)
{
 4b0:	cf 93       	push	r28
 4b2:	df 93       	push	r29
	uint8_t bit = digitalPinToBitMask(pin);
 4b4:	90 e0       	ldi	r25, 0x00	; 0
 4b6:	fc 01       	movw	r30, r24
 4b8:	e6 56       	subi	r30, 0x66	; 102
 4ba:	ff 4f       	sbci	r31, 0xFF	; 255
 4bc:	24 91       	lpm	r18, Z
	uint8_t port = digitalPinToPort(pin);
 4be:	fc 01       	movw	r30, r24
 4c0:	ea 57       	subi	r30, 0x7A	; 122
 4c2:	ff 4f       	sbci	r31, 0xFF	; 255
 4c4:	84 91       	lpm	r24, Z
	volatile uint8_t *reg, *out;

	if (port == NOT_A_PIN) return;
 4c6:	88 23       	and	r24, r24
 4c8:	61 f1       	breq	.+88     	; 0x522 <pinMode+0x72>

	// JWS: can I let the optimizer do this?
	reg = portModeRegister(port);
 4ca:	90 e0       	ldi	r25, 0x00	; 0
 4cc:	88 0f       	add	r24, r24
 4ce:	99 1f       	adc	r25, r25
 4d0:	fc 01       	movw	r30, r24
 4d2:	e8 59       	subi	r30, 0x98	; 152
 4d4:	ff 4f       	sbci	r31, 0xFF	; 255
 4d6:	c5 91       	lpm	r28, Z+
 4d8:	d4 91       	lpm	r29, Z
	out = portOutputRegister(port);
 4da:	fc 01       	movw	r30, r24
 4dc:	ee 58       	subi	r30, 0x8E	; 142
 4de:	ff 4f       	sbci	r31, 0xFF	; 255
 4e0:	a5 91       	lpm	r26, Z+
 4e2:	b4 91       	lpm	r27, Z

	if (mode == INPUT) { 
 4e4:	61 11       	cpse	r22, r1
 4e6:	09 c0       	rjmp	.+18     	; 0x4fa <pinMode+0x4a>
		uint8_t oldSREG = SREG;
 4e8:	9f b7       	in	r25, 0x3f	; 63
                cli();
 4ea:	f8 94       	cli
		*reg &= ~bit;
 4ec:	88 81       	ld	r24, Y
 4ee:	20 95       	com	r18
 4f0:	82 23       	and	r24, r18
 4f2:	88 83       	st	Y, r24
		*out &= ~bit;
 4f4:	ec 91       	ld	r30, X
 4f6:	2e 23       	and	r18, r30
 4f8:	0b c0       	rjmp	.+22     	; 0x510 <pinMode+0x60>
		SREG = oldSREG;
	} else if (mode == INPUT_PULLUP) {
 4fa:	62 30       	cpi	r22, 0x02	; 2
 4fc:	61 f4       	brne	.+24     	; 0x516 <pinMode+0x66>
		uint8_t oldSREG = SREG;
 4fe:	9f b7       	in	r25, 0x3f	; 63
                cli();
 500:	f8 94       	cli
		*reg &= ~bit;
 502:	38 81       	ld	r19, Y
 504:	82 2f       	mov	r24, r18
 506:	80 95       	com	r24
 508:	83 23       	and	r24, r19
 50a:	88 83       	st	Y, r24
		*out |= bit;
 50c:	ec 91       	ld	r30, X
 50e:	2e 2b       	or	r18, r30
 510:	2c 93       	st	X, r18
		SREG = oldSREG;
 512:	9f bf       	out	0x3f, r25	; 63
 514:	06 c0       	rjmp	.+12     	; 0x522 <pinMode+0x72>
	} else {
		uint8_t oldSREG = SREG;
 516:	8f b7       	in	r24, 0x3f	; 63
                cli();
 518:	f8 94       	cli
		*reg |= bit;
 51a:	e8 81       	ld	r30, Y
 51c:	2e 2b       	or	r18, r30
 51e:	28 83       	st	Y, r18
		SREG = oldSREG;
 520:	8f bf       	out	0x3f, r24	; 63
	}
}
 522:	df 91       	pop	r29
 524:	cf 91       	pop	r28
 526:	08 95       	ret

00000528 <micros>:
	return m;
}

unsigned long micros() {
	unsigned long m;
	uint8_t oldSREG = SREG, t;
 528:	3f b7       	in	r19, 0x3f	; 63
	
	cli();
 52a:	f8 94       	cli
	m = timer0_overflow_count;
 52c:	80 91 1d 01 	lds	r24, 0x011D	; 0x80011d <timer0_overflow_count>
 530:	90 91 1e 01 	lds	r25, 0x011E	; 0x80011e <timer0_overflow_count+0x1>
 534:	a0 91 1f 01 	lds	r26, 0x011F	; 0x80011f <timer0_overflow_count+0x2>
 538:	b0 91 20 01 	lds	r27, 0x0120	; 0x800120 <timer0_overflow_count+0x3>
#if defined(TCNT0)
	t = TCNT0;
 53c:	26 b5       	in	r18, 0x26	; 38
#else
	#error TIMER 0 not defined
#endif

#ifdef TIFR0
	if ((TIFR0 & _BV(TOV0)) && (t < 255))
 53e:	a8 9b       	sbis	0x15, 0	; 21
 540:	05 c0       	rjmp	.+10     	; 0x54c <micros+0x24>
 542:	2f 3f       	cpi	r18, 0xFF	; 255
 544:	19 f0       	breq	.+6      	; 0x54c <micros+0x24>
		m++;
 546:	01 96       	adiw	r24, 0x01	; 1
 548:	a1 1d       	adc	r26, r1
 54a:	b1 1d       	adc	r27, r1
#else
	if ((TIFR & _BV(TOV0)) && (t < 255))
		m++;
#endif

	SREG = oldSREG;
 54c:	3f bf       	out	0x3f, r19	; 63
	
	return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond());
 54e:	ba 2f       	mov	r27, r26
 550:	a9 2f       	mov	r26, r25
 552:	98 2f       	mov	r25, r24
 554:	88 27       	eor	r24, r24
 556:	82 0f       	add	r24, r18
 558:	91 1d       	adc	r25, r1
 55a:	a1 1d       	adc	r26, r1
 55c:	b1 1d       	adc	r27, r1
 55e:	bc 01       	movw	r22, r24
 560:	cd 01       	movw	r24, r26
 562:	42 e0       	ldi	r20, 0x02	; 2
 564:	66 0f       	add	r22, r22
 566:	77 1f       	adc	r23, r23
 568:	88 1f       	adc	r24, r24
 56a:	99 1f       	adc	r25, r25
 56c:	4a 95       	dec	r20
 56e:	d1 f7       	brne	.-12     	; 0x564 <micros+0x3c>
}
 570:	08 95       	ret

00000572 <checkCLKandBIN()>:
   
   

//sample on falling edge (middle of bit)
}
void checkCLKandBIN(void){
 572:	0f 93       	push	r16
 574:	1f 93       	push	r17
 576:	cf 93       	push	r28
 578:	df 93       	push	r29
	

#endif

	// busy wait
	__asm__ __volatile__ (
 57a:	03 e2       	ldi	r16, 0x23	; 35
 57c:	10 e0       	ldi	r17, 0x00	; 0
   * clk++
   * sample hzbinary
   * while clk low do nothing
   */
   //milliscompare = millis();
   while((hzclkval = digitalRead(hzclk)) == HIGH){
 57e:	87 e0       	ldi	r24, 0x07	; 7
 580:	0e 94 ff 01 	call	0x3fe	; 0x3fe <digitalRead>
 584:	d8 2f       	mov	r29, r24
 586:	80 93 16 01 	sts	0x0116, r24	; 0x800116 <__data_end>
 58a:	81 30       	cpi	r24, 0x01	; 1
 58c:	b9 f4       	brne	.+46     	; 0x5bc <checkCLKandBIN()+0x4a>
    if(readyet == 0){
 58e:	80 91 17 01 	lds	r24, 0x0117	; 0x800117 <readyet>
 592:	81 11       	cpse	r24, r1
 594:	0f c0       	rjmp	.+30     	; 0x5b4 <checkCLKandBIN()+0x42>
      hzbinval[clkval] = digitalRead(hzbinary);
 596:	c0 91 46 01 	lds	r28, 0x0146	; 0x800146 <clkval>
 59a:	86 e0       	ldi	r24, 0x06	; 6
 59c:	0e 94 ff 01 	call	0x3fe	; 0x3fe <digitalRead>
 5a0:	ec 2f       	mov	r30, r28
 5a2:	f0 e0       	ldi	r31, 0x00	; 0
 5a4:	ed 5d       	subi	r30, 0xDD	; 221
 5a6:	fe 4f       	sbci	r31, 0xFE	; 254
 5a8:	80 83       	st	Z, r24
      clkval++;
 5aa:	cf 5f       	subi	r28, 0xFF	; 255
 5ac:	c0 93 46 01 	sts	0x0146, r28	; 0x800146 <clkval>
      readyet = 1;
 5b0:	d0 93 17 01 	sts	0x0117, r29	; 0x800117 <readyet>
 5b4:	c8 01       	movw	r24, r16
 5b6:	01 97       	sbiw	r24, 0x01	; 1
 5b8:	f1 f7       	brne	.-4      	; 0x5b6 <checkCLKandBIN()+0x44>
 5ba:	e1 cf       	rjmp	.-62     	; 0x57e <checkCLKandBIN()+0xc>
    }
    delayMicroseconds(10);
   }
   while((hzclkval = digitalRead(hzclk)) == LOW){
 5bc:	87 e0       	ldi	r24, 0x07	; 7
 5be:	0e 94 ff 01 	call	0x3fe	; 0x3fe <digitalRead>
 5c2:	80 93 16 01 	sts	0x0116, r24	; 0x800116 <__data_end>
 5c6:	81 11       	cpse	r24, r1
 5c8:	03 c0       	rjmp	.+6      	; 0x5d0 <checkCLKandBIN()+0x5e>
    delayMicroseconds(1);
    readyet = 0;
 5ca:	10 92 17 01 	sts	0x0117, r1	; 0x800117 <readyet>
 5ce:	f6 cf       	rjmp	.-20     	; 0x5bc <checkCLKandBIN()+0x4a>

   //would be nice to add a picture to this source code (waveform)
   //or oscope picture
   //why isn't this possible?
  
}
 5d0:	df 91       	pop	r29
 5d2:	cf 91       	pop	r28
 5d4:	1f 91       	pop	r17
 5d6:	0f 91       	pop	r16
 5d8:	08 95       	ret

000005da <LedControl::spiTransfer(int, unsigned char, unsigned char)>:
        v|=B10000000;
    status[offset+digit]=v;
    spiTransfer(addr, digit+1,v);
}

void LedControl::spiTransfer(int addr, volatile byte opcode, volatile byte data) {
 5da:	2f 92       	push	r2
 5dc:	3f 92       	push	r3
 5de:	4f 92       	push	r4
 5e0:	5f 92       	push	r5
 5e2:	6f 92       	push	r6
 5e4:	7f 92       	push	r7
 5e6:	8f 92       	push	r8
 5e8:	9f 92       	push	r9
 5ea:	af 92       	push	r10
 5ec:	bf 92       	push	r11
 5ee:	cf 92       	push	r12
 5f0:	df 92       	push	r13
 5f2:	ef 92       	push	r14
 5f4:	ff 92       	push	r15
 5f6:	0f 93       	push	r16
 5f8:	1f 93       	push	r17
 5fa:	cf 93       	push	r28
 5fc:	df 93       	push	r29
 5fe:	00 d0       	rcall	.+0      	; 0x600 <LedControl::spiTransfer(int, unsigned char, unsigned char)+0x26>
 600:	cd b7       	in	r28, 0x3d	; 61
 602:	de b7       	in	r29, 0x3e	; 62
 604:	8c 01       	movw	r16, r24
 606:	49 83       	std	Y+1, r20	; 0x01
 608:	2a 83       	std	Y+2, r18	; 0x02
    //Create an array with the data to shift out
    int offset=addr*2;
 60a:	66 0f       	add	r22, r22
 60c:	77 1f       	adc	r23, r23
    int maxbytes=maxDevices*2;
 60e:	f8 01       	movw	r30, r16
 610:	ea 5a       	subi	r30, 0xAA	; 170
 612:	ff 4f       	sbci	r31, 0xFF	; 255
 614:	e0 80       	ld	r14, Z
 616:	f1 80       	ldd	r15, Z+1	; 0x01
 618:	ee 0c       	add	r14, r14
 61a:	ff 1c       	adc	r15, r15
 61c:	f8 01       	movw	r30, r16
 61e:	cf 01       	movw	r24, r30
 620:	80 1b       	sub	r24, r16
 622:	91 0b       	sbc	r25, r17

    for(int i=0;i<maxbytes;i++)
 624:	8e 15       	cp	r24, r14
 626:	9f 05       	cpc	r25, r15
 628:	14 f4       	brge	.+4      	; 0x62e <LedControl::spiTransfer(int, unsigned char, unsigned char)+0x54>
        spidata[i]=(byte)0;
 62a:	11 92       	st	Z+, r1
 62c:	f8 cf       	rjmp	.-16     	; 0x61e <LedControl::spiTransfer(int, unsigned char, unsigned char)+0x44>
    //put our device data into the array
    spidata[offset+1]=opcode;
 62e:	89 81       	ldd	r24, Y+1	; 0x01
 630:	f8 01       	movw	r30, r16
 632:	e6 0f       	add	r30, r22
 634:	f7 1f       	adc	r31, r23
 636:	81 83       	std	Z+1, r24	; 0x01
    spidata[offset]=data;
 638:	8a 81       	ldd	r24, Y+2	; 0x02
 63a:	80 83       	st	Z, r24
    //enable the line 
    digitalWrite(SPI_CS,LOW);
 63c:	58 01       	movw	r10, r16
 63e:	84 e5       	ldi	r24, 0x54	; 84
 640:	a8 0e       	add	r10, r24
 642:	b1 1c       	adc	r11, r1
 644:	60 e0       	ldi	r22, 0x00	; 0
 646:	f5 01       	movw	r30, r10
 648:	80 81       	ld	r24, Z
 64a:	0e 94 28 02 	call	0x450	; 0x450 <digitalWrite>
 64e:	e0 0e       	add	r14, r16
 650:	f1 1e       	adc	r15, r17
    //Now shift out the data 
    for(int i=maxbytes;i>0;i--)
        shiftOut(SPI_MOSI,SPI_CLK,MSBFIRST,spidata[i-1]);
 652:	48 01       	movw	r8, r16
 654:	f2 e5       	ldi	r31, 0x52	; 82
 656:	8f 0e       	add	r8, r31
 658:	91 1c       	adc	r9, r1
 65a:	38 01       	movw	r6, r16
 65c:	80 e5       	ldi	r24, 0x50	; 80
 65e:	68 0e       	add	r6, r24
 660:	71 1c       	adc	r7, r1
 662:	c7 01       	movw	r24, r14
 664:	80 1b       	sub	r24, r16
 666:	91 0b       	sbc	r25, r17
    spidata[offset+1]=opcode;
    spidata[offset]=data;
    //enable the line 
    digitalWrite(SPI_CS,LOW);
    //Now shift out the data 
    for(int i=maxbytes;i>0;i--)
 668:	18 16       	cp	r1, r24
 66a:	19 06       	cpc	r1, r25
 66c:	24 f5       	brge	.+72     	; 0x6b6 <LedControl::spiTransfer(int, unsigned char, unsigned char)+0xdc>
        shiftOut(SPI_MOSI,SPI_CLK,MSBFIRST,spidata[i-1]);
 66e:	f7 01       	movw	r30, r14
 670:	c2 90       	ld	r12, -Z
 672:	7f 01       	movw	r14, r30
 674:	f4 01       	movw	r30, r8
 676:	30 80       	ld	r3, Z
 678:	f3 01       	movw	r30, r6
 67a:	20 80       	ld	r2, Z
 67c:	87 e0       	ldi	r24, 0x07	; 7
 67e:	48 2e       	mov	r4, r24
 680:	51 2c       	mov	r5, r1

	for (i = 0; i < 8; i++)  {
		if (bitOrder == LSBFIRST)
			digitalWrite(dataPin, !!(val & (1 << i)));
		else	
			digitalWrite(dataPin, !!(val & (1 << (7 - i))));
 682:	d1 2c       	mov	r13, r1
 684:	b6 01       	movw	r22, r12
 686:	04 2c       	mov	r0, r4
 688:	02 c0       	rjmp	.+4      	; 0x68e <LedControl::spiTransfer(int, unsigned char, unsigned char)+0xb4>
 68a:	75 95       	asr	r23
 68c:	67 95       	ror	r22
 68e:	0a 94       	dec	r0
 690:	e2 f7       	brpl	.-8      	; 0x68a <LedControl::spiTransfer(int, unsigned char, unsigned char)+0xb0>
 692:	61 70       	andi	r22, 0x01	; 1
 694:	77 27       	eor	r23, r23
 696:	82 2d       	mov	r24, r2
 698:	0e 94 28 02 	call	0x450	; 0x450 <digitalWrite>
			
		digitalWrite(clockPin, HIGH);
 69c:	61 e0       	ldi	r22, 0x01	; 1
 69e:	83 2d       	mov	r24, r3
 6a0:	0e 94 28 02 	call	0x450	; 0x450 <digitalWrite>
		digitalWrite(clockPin, LOW);		
 6a4:	60 e0       	ldi	r22, 0x00	; 0
 6a6:	83 2d       	mov	r24, r3
 6a8:	0e 94 28 02 	call	0x450	; 0x450 <digitalWrite>
 6ac:	f1 e0       	ldi	r31, 0x01	; 1
 6ae:	4f 1a       	sub	r4, r31
 6b0:	51 08       	sbc	r5, r1
 6b2:	40 f7       	brcc	.-48     	; 0x684 <LedControl::spiTransfer(int, unsigned char, unsigned char)+0xaa>
 6b4:	d6 cf       	rjmp	.-84     	; 0x662 <LedControl::spiTransfer(int, unsigned char, unsigned char)+0x88>
    //latch the data onto the display
    digitalWrite(SPI_CS,HIGH);
 6b6:	61 e0       	ldi	r22, 0x01	; 1
 6b8:	f5 01       	movw	r30, r10
 6ba:	80 81       	ld	r24, Z
}    
 6bc:	0f 90       	pop	r0
 6be:	0f 90       	pop	r0
 6c0:	df 91       	pop	r29
 6c2:	cf 91       	pop	r28
 6c4:	1f 91       	pop	r17
 6c6:	0f 91       	pop	r16
 6c8:	ff 90       	pop	r15
 6ca:	ef 90       	pop	r14
 6cc:	df 90       	pop	r13
 6ce:	cf 90       	pop	r12
 6d0:	bf 90       	pop	r11
 6d2:	af 90       	pop	r10
 6d4:	9f 90       	pop	r9
 6d6:	8f 90       	pop	r8
 6d8:	7f 90       	pop	r7
 6da:	6f 90       	pop	r6
 6dc:	5f 90       	pop	r5
 6de:	4f 90       	pop	r4
 6e0:	3f 90       	pop	r3
 6e2:	2f 90       	pop	r2
    digitalWrite(SPI_CS,LOW);
    //Now shift out the data 
    for(int i=maxbytes;i>0;i--)
        shiftOut(SPI_MOSI,SPI_CLK,MSBFIRST,spidata[i-1]);
    //latch the data onto the display
    digitalWrite(SPI_CS,HIGH);
 6e4:	0c 94 28 02 	jmp	0x450	; 0x450 <digitalWrite>

000006e8 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]>:

void LedControl::setDigit(int addr, int digit, byte value, boolean dp) {
    int offset;
    byte v;

    if(addr<0 || addr>=maxDevices)
 6e8:	20 91 3a 02 	lds	r18, 0x023A	; 0x80023a <lc+0x56>
 6ec:	30 91 3b 02 	lds	r19, 0x023B	; 0x80023b <lc+0x57>
 6f0:	12 16       	cp	r1, r18
 6f2:	13 06       	cpc	r1, r19
 6f4:	b4 f4       	brge	.+44     	; 0x722 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]+0x3a>
        return;
    if(digit<0 || digit>7 || value>15)
 6f6:	88 30       	cpi	r24, 0x08	; 8
 6f8:	91 05       	cpc	r25, r1
 6fa:	98 f4       	brcc	.+38     	; 0x722 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]+0x3a>
 6fc:	60 31       	cpi	r22, 0x10	; 16
 6fe:	88 f4       	brcc	.+34     	; 0x722 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]+0x3a>
        return;
    offset=addr*8;
    v=pgm_read_byte_near(charTable + value); 
 700:	e6 2f       	mov	r30, r22
 702:	f0 e0       	ldi	r31, 0x00	; 0
 704:	ee 53       	subi	r30, 0x3E	; 62
 706:	ff 4f       	sbci	r31, 0xFF	; 255
 708:	24 91       	lpm	r18, Z
    if(dp)
        v|=B10000000;
    status[offset+digit]=v;
 70a:	fc 01       	movw	r30, r24
 70c:	ec 51       	subi	r30, 0x1C	; 28
 70e:	fe 4f       	sbci	r31, 0xFE	; 254
 710:	20 8b       	std	Z+16, r18	; 0x10
    spiTransfer(addr, digit+1,v);
 712:	41 e0       	ldi	r20, 0x01	; 1
 714:	48 0f       	add	r20, r24
 716:	60 e0       	ldi	r22, 0x00	; 0
 718:	70 e0       	ldi	r23, 0x00	; 0
 71a:	84 ee       	ldi	r24, 0xE4	; 228
 71c:	91 e0       	ldi	r25, 0x01	; 1
 71e:	0c 94 ed 02 	jmp	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
 722:	08 95       	ret

00000724 <LedControl::clearDisplay(int)>:
        return;
    if(intensity>=0 && intensity<16)	
        spiTransfer(addr, OP_INTENSITY,intensity);
}

void LedControl::clearDisplay(int addr) {
 724:	cf 92       	push	r12
 726:	df 92       	push	r13
 728:	ef 92       	push	r14
 72a:	ff 92       	push	r15
 72c:	0f 93       	push	r16
 72e:	1f 93       	push	r17
 730:	cf 93       	push	r28
 732:	df 93       	push	r29
    int offset;

    if(addr<0 || addr>=maxDevices)
 734:	77 fd       	sbrc	r23, 7
 736:	23 c0       	rjmp	.+70     	; 0x77e <LedControl::clearDisplay(int)+0x5a>
 738:	fc 01       	movw	r30, r24
 73a:	ea 5a       	subi	r30, 0xAA	; 170
 73c:	ff 4f       	sbci	r31, 0xFF	; 255
 73e:	20 81       	ld	r18, Z
 740:	31 81       	ldd	r19, Z+1	; 0x01
 742:	62 17       	cp	r22, r18
 744:	73 07       	cpc	r23, r19
 746:	dc f4       	brge	.+54     	; 0x77e <LedControl::clearDisplay(int)+0x5a>
 748:	eb 01       	movw	r28, r22
 74a:	7c 01       	movw	r14, r24
        return;
    offset=addr*8;
 74c:	6b 01       	movw	r12, r22
 74e:	83 e0       	ldi	r24, 0x03	; 3
 750:	cc 0c       	add	r12, r12
 752:	dd 1c       	adc	r13, r13
 754:	8a 95       	dec	r24
 756:	e1 f7       	brne	.-8      	; 0x750 <LedControl::clearDisplay(int)+0x2c>
 758:	01 e0       	ldi	r16, 0x01	; 1
 75a:	10 e0       	ldi	r17, 0x00	; 0
 75c:	f8 01       	movw	r30, r16
 75e:	ec 0d       	add	r30, r12
 760:	fd 1d       	adc	r31, r13
 762:	ee 0d       	add	r30, r14
 764:	ff 1d       	adc	r31, r15
    for(int i=0;i<8;i++) {
        status[offset+i]=0;
 766:	17 86       	std	Z+15, r1	; 0x0f
        spiTransfer(addr, i+1,status[offset+i]);
 768:	20 e0       	ldi	r18, 0x00	; 0
 76a:	40 2f       	mov	r20, r16
 76c:	be 01       	movw	r22, r28
 76e:	c7 01       	movw	r24, r14
 770:	0e 94 ed 02 	call	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
 774:	0f 5f       	subi	r16, 0xFF	; 255
 776:	1f 4f       	sbci	r17, 0xFF	; 255
    int offset;

    if(addr<0 || addr>=maxDevices)
        return;
    offset=addr*8;
    for(int i=0;i<8;i++) {
 778:	09 30       	cpi	r16, 0x09	; 9
 77a:	11 05       	cpc	r17, r1
 77c:	79 f7       	brne	.-34     	; 0x75c <LedControl::clearDisplay(int)+0x38>
        status[offset+i]=0;
        spiTransfer(addr, i+1,status[offset+i]);
    }
}
 77e:	df 91       	pop	r29
 780:	cf 91       	pop	r28
 782:	1f 91       	pop	r17
 784:	0f 91       	pop	r16
 786:	ff 90       	pop	r15
 788:	ef 90       	pop	r14
 78a:	df 90       	pop	r13
 78c:	cf 90       	pop	r12
 78e:	08 95       	ret

00000790 <Print::write(char const*) [clone .constprop.10]>:
    int getWriteError() { return write_error; }
    void clearWriteError() { setWriteError(0); }
  
    virtual size_t write(uint8_t) = 0;
    size_t write(const char *str) {
      if (str == NULL) return 0;
 790:	00 97       	sbiw	r24, 0x00	; 0
 792:	69 f0       	breq	.+26     	; 0x7ae <Print::write(char const*) [clone .constprop.10]+0x1e>
      return write((const uint8_t *)str, strlen(str));
 794:	fc 01       	movw	r30, r24
 796:	01 90       	ld	r0, Z+
 798:	00 20       	and	r0, r0
 79a:	e9 f7       	brne	.-6      	; 0x796 <Print::write(char const*) [clone .constprop.10]+0x6>
 79c:	31 97       	sbiw	r30, 0x01	; 1
 79e:	af 01       	movw	r20, r30
 7a0:	48 1b       	sub	r20, r24
 7a2:	59 0b       	sbc	r21, r25
 7a4:	bc 01       	movw	r22, r24
 7a6:	87 e4       	ldi	r24, 0x47	; 71
 7a8:	91 e0       	ldi	r25, 0x01	; 1
 7aa:	0c 94 cc 00 	jmp	0x198	; 0x198 <Print::write(unsigned char const*, unsigned int)>
    }
 7ae:	80 e0       	ldi	r24, 0x00	; 0
 7b0:	90 e0       	ldi	r25, 0x00	; 0
 7b2:	08 95       	ret

000007b4 <Print::printNumber(unsigned long, unsigned char) [clone .constprop.7]>:
  return n;
}

// Private Methods /////////////////////////////////////////////////////////////

size_t Print::printNumber(unsigned long n, uint8_t base)
 7b4:	8f 92       	push	r8
 7b6:	9f 92       	push	r9
 7b8:	af 92       	push	r10
 7ba:	bf 92       	push	r11
 7bc:	0f 93       	push	r16
 7be:	1f 93       	push	r17
 7c0:	cf 93       	push	r28
 7c2:	df 93       	push	r29
 7c4:	cd b7       	in	r28, 0x3d	; 61
 7c6:	de b7       	in	r29, 0x3e	; 62
 7c8:	a1 97       	sbiw	r28, 0x21	; 33
 7ca:	0f b6       	in	r0, 0x3f	; 63
 7cc:	f8 94       	cli
 7ce:	de bf       	out	0x3e, r29	; 62
 7d0:	0f be       	out	0x3f, r0	; 63
 7d2:	cd bf       	out	0x3d, r28	; 61
{
  char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
  char *str = &buf[sizeof(buf) - 1];

  *str = '\0';
 7d4:	19 a2       	std	Y+33, r1	; 0x21

  // prevent crash if called with base == 1
  if (base < 2) base = 10;
 7d6:	42 30       	cpi	r20, 0x02	; 2
 7d8:	08 f4       	brcc	.+2      	; 0x7dc <Print::printNumber(unsigned long, unsigned char) [clone .constprop.7]+0x28>
 7da:	4a e0       	ldi	r20, 0x0A	; 10
 7dc:	8e 01       	movw	r16, r28
 7de:	0f 5d       	subi	r16, 0xDF	; 223
 7e0:	1f 4f       	sbci	r17, 0xFF	; 255

  do {
    char c = n % base;
 7e2:	84 2e       	mov	r8, r20
 7e4:	91 2c       	mov	r9, r1
 7e6:	a1 2c       	mov	r10, r1
 7e8:	b1 2c       	mov	r11, r1
 7ea:	a5 01       	movw	r20, r10
 7ec:	94 01       	movw	r18, r8
 7ee:	0e 94 67 07 	call	0xece	; 0xece <__udivmodsi4>
 7f2:	e6 2f       	mov	r30, r22
    n /= base;
 7f4:	b9 01       	movw	r22, r18
 7f6:	ca 01       	movw	r24, r20

    *--str = c < 10 ? c + '0' : c + 'A' - 10;
 7f8:	01 50       	subi	r16, 0x01	; 1
 7fa:	11 09       	sbc	r17, r1
 7fc:	ea 30       	cpi	r30, 0x0A	; 10
 7fe:	14 f4       	brge	.+4      	; 0x804 <Print::printNumber(unsigned long, unsigned char) [clone .constprop.7]+0x50>
 800:	e0 5d       	subi	r30, 0xD0	; 208
 802:	01 c0       	rjmp	.+2      	; 0x806 <Print::printNumber(unsigned long, unsigned char) [clone .constprop.7]+0x52>
 804:	e9 5c       	subi	r30, 0xC9	; 201
 806:	d8 01       	movw	r26, r16
 808:	ec 93       	st	X, r30
  *str = '\0';

  // prevent crash if called with base == 1
  if (base < 2) base = 10;

  do {
 80a:	23 2b       	or	r18, r19
 80c:	24 2b       	or	r18, r20
 80e:	25 2b       	or	r18, r21
 810:	61 f7       	brne	.-40     	; 0x7ea <Print::printNumber(unsigned long, unsigned char) [clone .constprop.7]+0x36>
    n /= base;

    *--str = c < 10 ? c + '0' : c + 'A' - 10;
  } while(n);

  return write(str);
 812:	c8 01       	movw	r24, r16
 814:	0e 94 c8 03 	call	0x790	; 0x790 <Print::write(char const*) [clone .constprop.10]>
}
 818:	a1 96       	adiw	r28, 0x21	; 33
 81a:	0f b6       	in	r0, 0x3f	; 63
 81c:	f8 94       	cli
 81e:	de bf       	out	0x3e, r29	; 62
 820:	0f be       	out	0x3f, r0	; 63
 822:	cd bf       	out	0x3d, r28	; 61
 824:	df 91       	pop	r29
 826:	cf 91       	pop	r28
 828:	1f 91       	pop	r17
 82a:	0f 91       	pop	r16
 82c:	bf 90       	pop	r11
 82e:	af 90       	pop	r10
 830:	9f 90       	pop	r9
 832:	8f 90       	pop	r8
 834:	08 95       	ret

00000836 <__cxa_pure_virtual>:
extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));

void __cxa_pure_virtual(void) {
  // We might want to write some diagnostics to uart in this case
  //std::terminate();
  abort();
 836:	0e 94 a3 07 	call	0xf46	; 0xf46 <abort>

0000083a <__vector_19>:
#elif defined(USART_UDRE_vect)
ISR(USART_UDRE_vect)
#else
  #error "Don't know what the Data Register Empty vector is called for Serial"
#endif
{
 83a:	1f 92       	push	r1
 83c:	0f 92       	push	r0
 83e:	0f b6       	in	r0, 0x3f	; 63
 840:	0f 92       	push	r0
 842:	11 24       	eor	r1, r1
 844:	2f 93       	push	r18
 846:	3f 93       	push	r19
 848:	4f 93       	push	r20
 84a:	5f 93       	push	r21
 84c:	6f 93       	push	r22
 84e:	7f 93       	push	r23
 850:	8f 93       	push	r24
 852:	9f 93       	push	r25
 854:	af 93       	push	r26
 856:	bf 93       	push	r27
 858:	ef 93       	push	r30
 85a:	ff 93       	push	r31
  Serial._tx_udr_empty_irq();
 85c:	87 e4       	ldi	r24, 0x47	; 71
 85e:	91 e0       	ldi	r25, 0x01	; 1
 860:	0e 94 42 01 	call	0x284	; 0x284 <HardwareSerial::_tx_udr_empty_irq()>
}
 864:	ff 91       	pop	r31
 866:	ef 91       	pop	r30
 868:	bf 91       	pop	r27
 86a:	af 91       	pop	r26
 86c:	9f 91       	pop	r25
 86e:	8f 91       	pop	r24
 870:	7f 91       	pop	r23
 872:	6f 91       	pop	r22
 874:	5f 91       	pop	r21
 876:	4f 91       	pop	r20
 878:	3f 91       	pop	r19
 87a:	2f 91       	pop	r18
 87c:	0f 90       	pop	r0
 87e:	0f be       	out	0x3f, r0	; 63
 880:	0f 90       	pop	r0
 882:	1f 90       	pop	r1
 884:	18 95       	reti

00000886 <__vector_18>:
#elif defined(USART_RXC_vect)
  ISR(USART_RXC_vect) // ATmega8
#else
  #error "Don't know what the Data Received vector is called for Serial"
#endif
  {
 886:	1f 92       	push	r1
 888:	0f 92       	push	r0
 88a:	0f b6       	in	r0, 0x3f	; 63
 88c:	0f 92       	push	r0
 88e:	11 24       	eor	r1, r1
 890:	2f 93       	push	r18
 892:	8f 93       	push	r24
 894:	9f 93       	push	r25
 896:	ef 93       	push	r30
 898:	ff 93       	push	r31

// Actual interrupt handlers //////////////////////////////////////////////////////////////

void HardwareSerial::_rx_complete_irq(void)
{
  if (bit_is_clear(*_ucsra, UPE0)) {
 89a:	e0 91 57 01 	lds	r30, 0x0157	; 0x800157 <Serial+0x10>
 89e:	f0 91 58 01 	lds	r31, 0x0158	; 0x800158 <Serial+0x11>
 8a2:	80 81       	ld	r24, Z
 8a4:	e0 91 5d 01 	lds	r30, 0x015D	; 0x80015d <Serial+0x16>
 8a8:	f0 91 5e 01 	lds	r31, 0x015E	; 0x80015e <Serial+0x17>
 8ac:	82 fd       	sbrc	r24, 2
 8ae:	12 c0       	rjmp	.+36     	; 0x8d4 <__vector_18+0x4e>
    // No Parity error, read byte and store it in the buffer if there is
    // room
    unsigned char c = *_udr;
 8b0:	90 81       	ld	r25, Z
    rx_buffer_index_t i = (unsigned int)(_rx_buffer_head + 1) % SERIAL_RX_BUFFER_SIZE;
 8b2:	80 91 60 01 	lds	r24, 0x0160	; 0x800160 <Serial+0x19>
 8b6:	8f 5f       	subi	r24, 0xFF	; 255
 8b8:	8f 73       	andi	r24, 0x3F	; 63

    // if we should be storing the received character into the location
    // just before the tail (meaning that the head would advance to the
    // current location of the tail), we're about to overflow the buffer
    // and so we don't write the character or advance the head.
    if (i != _rx_buffer_tail) {
 8ba:	20 91 61 01 	lds	r18, 0x0161	; 0x800161 <Serial+0x1a>
 8be:	82 17       	cp	r24, r18
 8c0:	51 f0       	breq	.+20     	; 0x8d6 <__vector_18+0x50>
      _rx_buffer[_rx_buffer_head] = c;
 8c2:	e0 91 60 01 	lds	r30, 0x0160	; 0x800160 <Serial+0x19>
 8c6:	f0 e0       	ldi	r31, 0x00	; 0
 8c8:	e9 5b       	subi	r30, 0xB9	; 185
 8ca:	fe 4f       	sbci	r31, 0xFE	; 254
 8cc:	95 8f       	std	Z+29, r25	; 0x1d
      _rx_buffer_head = i;
 8ce:	80 93 60 01 	sts	0x0160, r24	; 0x800160 <Serial+0x19>
 8d2:	01 c0       	rjmp	.+2      	; 0x8d6 <__vector_18+0x50>
    }
  } else {
    // Parity error, read byte but discard it
    *_udr;
 8d4:	80 81       	ld	r24, Z
    Serial._rx_complete_irq();
  }
 8d6:	ff 91       	pop	r31
 8d8:	ef 91       	pop	r30
 8da:	9f 91       	pop	r25
 8dc:	8f 91       	pop	r24
 8de:	2f 91       	pop	r18
 8e0:	0f 90       	pop	r0
 8e2:	0f be       	out	0x3f, r0	; 63
 8e4:	0f 90       	pop	r0
 8e6:	1f 90       	pop	r1
 8e8:	18 95       	reti

000008ea <__vector_16>:
#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
ISR(TIM0_OVF_vect)
#else
ISR(TIMER0_OVF_vect)
#endif
{
 8ea:	1f 92       	push	r1
 8ec:	0f 92       	push	r0
 8ee:	0f b6       	in	r0, 0x3f	; 63
 8f0:	0f 92       	push	r0
 8f2:	11 24       	eor	r1, r1
 8f4:	2f 93       	push	r18
 8f6:	3f 93       	push	r19
 8f8:	8f 93       	push	r24
 8fa:	9f 93       	push	r25
 8fc:	af 93       	push	r26
 8fe:	bf 93       	push	r27
	// copy these to local variables so they can be stored in registers
	// (volatile variables must be read from memory on every access)
	unsigned long m = timer0_millis;
 900:	80 91 19 01 	lds	r24, 0x0119	; 0x800119 <timer0_millis>
 904:	90 91 1a 01 	lds	r25, 0x011A	; 0x80011a <timer0_millis+0x1>
 908:	a0 91 1b 01 	lds	r26, 0x011B	; 0x80011b <timer0_millis+0x2>
 90c:	b0 91 1c 01 	lds	r27, 0x011C	; 0x80011c <timer0_millis+0x3>
	unsigned char f = timer0_fract;
 910:	30 91 18 01 	lds	r19, 0x0118	; 0x800118 <timer0_fract>

	m += MILLIS_INC;
	f += FRACT_INC;
 914:	23 e0       	ldi	r18, 0x03	; 3
 916:	23 0f       	add	r18, r19
	if (f >= FRACT_MAX) {
 918:	2d 37       	cpi	r18, 0x7D	; 125
 91a:	20 f4       	brcc	.+8      	; 0x924 <__stack+0x25>
	// copy these to local variables so they can be stored in registers
	// (volatile variables must be read from memory on every access)
	unsigned long m = timer0_millis;
	unsigned char f = timer0_fract;

	m += MILLIS_INC;
 91c:	01 96       	adiw	r24, 0x01	; 1
 91e:	a1 1d       	adc	r26, r1
 920:	b1 1d       	adc	r27, r1
 922:	05 c0       	rjmp	.+10     	; 0x92e <__stack+0x2f>
	f += FRACT_INC;
	if (f >= FRACT_MAX) {
		f -= FRACT_MAX;
 924:	26 e8       	ldi	r18, 0x86	; 134
 926:	23 0f       	add	r18, r19
		m += 1;
 928:	02 96       	adiw	r24, 0x02	; 2
 92a:	a1 1d       	adc	r26, r1
 92c:	b1 1d       	adc	r27, r1
	}

	timer0_fract = f;
 92e:	20 93 18 01 	sts	0x0118, r18	; 0x800118 <timer0_fract>
	timer0_millis = m;
 932:	80 93 19 01 	sts	0x0119, r24	; 0x800119 <timer0_millis>
 936:	90 93 1a 01 	sts	0x011A, r25	; 0x80011a <timer0_millis+0x1>
 93a:	a0 93 1b 01 	sts	0x011B, r26	; 0x80011b <timer0_millis+0x2>
 93e:	b0 93 1c 01 	sts	0x011C, r27	; 0x80011c <timer0_millis+0x3>
	timer0_overflow_count++;
 942:	80 91 1d 01 	lds	r24, 0x011D	; 0x80011d <timer0_overflow_count>
 946:	90 91 1e 01 	lds	r25, 0x011E	; 0x80011e <timer0_overflow_count+0x1>
 94a:	a0 91 1f 01 	lds	r26, 0x011F	; 0x80011f <timer0_overflow_count+0x2>
 94e:	b0 91 20 01 	lds	r27, 0x0120	; 0x800120 <timer0_overflow_count+0x3>
 952:	01 96       	adiw	r24, 0x01	; 1
 954:	a1 1d       	adc	r26, r1
 956:	b1 1d       	adc	r27, r1
 958:	80 93 1d 01 	sts	0x011D, r24	; 0x80011d <timer0_overflow_count>
 95c:	90 93 1e 01 	sts	0x011E, r25	; 0x80011e <timer0_overflow_count+0x1>
 960:	a0 93 1f 01 	sts	0x011F, r26	; 0x80011f <timer0_overflow_count+0x2>
 964:	b0 93 20 01 	sts	0x0120, r27	; 0x800120 <timer0_overflow_count+0x3>
}
 968:	bf 91       	pop	r27
 96a:	af 91       	pop	r26
 96c:	9f 91       	pop	r25
 96e:	8f 91       	pop	r24
 970:	3f 91       	pop	r19
 972:	2f 91       	pop	r18
 974:	0f 90       	pop	r0
 976:	0f be       	out	0x3f, r0	; 63
 978:	0f 90       	pop	r0
 97a:	1f 90       	pop	r1
 97c:	18 95       	reti

0000097e <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832>:
 97e:	cf 93       	push	r28
 980:	df 93       	push	r29
    size_t printNumber(unsigned long, uint8_t);
    size_t printFloat(double, uint8_t);
  protected:
    void setWriteError(int err = 1) { write_error = err; }
  public:
    Print() : write_error(0) {}
 982:	10 92 4a 01 	sts	0x014A, r1	; 0x80014a <Serial+0x3>
 986:	10 92 49 01 	sts	0x0149, r1	; 0x800149 <Serial+0x2>
  public:
    virtual int available() = 0;
    virtual int read() = 0;
    virtual int peek() = 0;

    Stream() {_timeout=1000;}
 98a:	88 ee       	ldi	r24, 0xE8	; 232
 98c:	93 e0       	ldi	r25, 0x03	; 3
 98e:	a0 e0       	ldi	r26, 0x00	; 0
 990:	b0 e0       	ldi	r27, 0x00	; 0
 992:	80 93 4b 01 	sts	0x014B, r24	; 0x80014b <Serial+0x4>
 996:	90 93 4c 01 	sts	0x014C, r25	; 0x80014c <Serial+0x5>
 99a:	a0 93 4d 01 	sts	0x014D, r26	; 0x80014d <Serial+0x6>
 99e:	b0 93 4e 01 	sts	0x014E, r27	; 0x80014e <Serial+0x7>
  volatile uint8_t *ucsrc, volatile uint8_t *udr) :
    _ubrrh(ubrrh), _ubrrl(ubrrl),
    _ucsra(ucsra), _ucsrb(ucsrb), _ucsrc(ucsrc),
    _udr(udr),
    _rx_buffer_head(0), _rx_buffer_tail(0),
    _tx_buffer_head(0), _tx_buffer_tail(0)
 9a2:	84 e0       	ldi	r24, 0x04	; 4
 9a4:	91 e0       	ldi	r25, 0x01	; 1
 9a6:	90 93 48 01 	sts	0x0148, r25	; 0x800148 <Serial+0x1>
 9aa:	80 93 47 01 	sts	0x0147, r24	; 0x800147 <Serial>
 9ae:	85 ec       	ldi	r24, 0xC5	; 197
 9b0:	90 e0       	ldi	r25, 0x00	; 0
 9b2:	90 93 54 01 	sts	0x0154, r25	; 0x800154 <Serial+0xd>
 9b6:	80 93 53 01 	sts	0x0153, r24	; 0x800153 <Serial+0xc>
 9ba:	84 ec       	ldi	r24, 0xC4	; 196
 9bc:	90 e0       	ldi	r25, 0x00	; 0
 9be:	90 93 56 01 	sts	0x0156, r25	; 0x800156 <Serial+0xf>
 9c2:	80 93 55 01 	sts	0x0155, r24	; 0x800155 <Serial+0xe>
 9c6:	80 ec       	ldi	r24, 0xC0	; 192
 9c8:	90 e0       	ldi	r25, 0x00	; 0
 9ca:	90 93 58 01 	sts	0x0158, r25	; 0x800158 <Serial+0x11>
 9ce:	80 93 57 01 	sts	0x0157, r24	; 0x800157 <Serial+0x10>
 9d2:	81 ec       	ldi	r24, 0xC1	; 193
 9d4:	90 e0       	ldi	r25, 0x00	; 0
 9d6:	90 93 5a 01 	sts	0x015A, r25	; 0x80015a <Serial+0x13>
 9da:	80 93 59 01 	sts	0x0159, r24	; 0x800159 <Serial+0x12>
 9de:	82 ec       	ldi	r24, 0xC2	; 194
 9e0:	90 e0       	ldi	r25, 0x00	; 0
 9e2:	90 93 5c 01 	sts	0x015C, r25	; 0x80015c <Serial+0x15>
 9e6:	80 93 5b 01 	sts	0x015B, r24	; 0x80015b <Serial+0x14>
 9ea:	86 ec       	ldi	r24, 0xC6	; 198
 9ec:	90 e0       	ldi	r25, 0x00	; 0
 9ee:	90 93 5e 01 	sts	0x015E, r25	; 0x80015e <Serial+0x17>
 9f2:	80 93 5d 01 	sts	0x015D, r24	; 0x80015d <Serial+0x16>
 9f6:	10 92 60 01 	sts	0x0160, r1	; 0x800160 <Serial+0x19>
 9fa:	10 92 61 01 	sts	0x0161, r1	; 0x800161 <Serial+0x1a>
 9fe:	10 92 62 01 	sts	0x0162, r1	; 0x800162 <Serial+0x1b>
 a02:	10 92 63 01 	sts	0x0163, r1	; 0x800163 <Serial+0x1c>
#define OP_SCANLIMIT   11
#define OP_SHUTDOWN    12
#define OP_DISPLAYTEST 15

LedControl::LedControl(int dataPin, int clkPin, int csPin, int numDevices) {
    SPI_MOSI=dataPin;
 a06:	cc e0       	ldi	r28, 0x0C	; 12
 a08:	d0 e0       	ldi	r29, 0x00	; 0
 a0a:	d0 93 35 02 	sts	0x0235, r29	; 0x800235 <lc+0x51>
 a0e:	c0 93 34 02 	sts	0x0234, r28	; 0x800234 <lc+0x50>
    SPI_CLK=clkPin;
 a12:	8b e0       	ldi	r24, 0x0B	; 11
 a14:	90 e0       	ldi	r25, 0x00	; 0
 a16:	90 93 37 02 	sts	0x0237, r25	; 0x800237 <lc+0x53>
 a1a:	80 93 36 02 	sts	0x0236, r24	; 0x800236 <lc+0x52>
    SPI_CS=csPin;
 a1e:	8a e0       	ldi	r24, 0x0A	; 10
 a20:	90 e0       	ldi	r25, 0x00	; 0
 a22:	90 93 39 02 	sts	0x0239, r25	; 0x800239 <lc+0x55>
 a26:	80 93 38 02 	sts	0x0238, r24	; 0x800238 <lc+0x54>
    if(numDevices<=0 || numDevices>8 )
        numDevices=8;
    maxDevices=numDevices;
 a2a:	81 e0       	ldi	r24, 0x01	; 1
 a2c:	90 e0       	ldi	r25, 0x00	; 0
 a2e:	90 93 3b 02 	sts	0x023B, r25	; 0x80023b <lc+0x57>
 a32:	80 93 3a 02 	sts	0x023A, r24	; 0x80023a <lc+0x56>
    pinMode(SPI_MOSI,OUTPUT);
 a36:	61 e0       	ldi	r22, 0x01	; 1
 a38:	8c e0       	ldi	r24, 0x0C	; 12
 a3a:	0e 94 58 02 	call	0x4b0	; 0x4b0 <pinMode>
    pinMode(SPI_CLK,OUTPUT);
 a3e:	61 e0       	ldi	r22, 0x01	; 1
 a40:	80 91 36 02 	lds	r24, 0x0236	; 0x800236 <lc+0x52>
 a44:	0e 94 58 02 	call	0x4b0	; 0x4b0 <pinMode>
    pinMode(SPI_CS,OUTPUT);
 a48:	61 e0       	ldi	r22, 0x01	; 1
 a4a:	80 91 38 02 	lds	r24, 0x0238	; 0x800238 <lc+0x54>
 a4e:	0e 94 58 02 	call	0x4b0	; 0x4b0 <pinMode>
    digitalWrite(SPI_CS,HIGH);
 a52:	61 e0       	ldi	r22, 0x01	; 1
 a54:	80 91 38 02 	lds	r24, 0x0238	; 0x800238 <lc+0x54>
 a58:	0e 94 28 02 	call	0x450	; 0x450 <digitalWrite>
    SPI_MOSI=dataPin;
 a5c:	d0 93 35 02 	sts	0x0235, r29	; 0x800235 <lc+0x51>
 a60:	c0 93 34 02 	sts	0x0234, r28	; 0x800234 <lc+0x50>
 a64:	e4 ef       	ldi	r30, 0xF4	; 244
 a66:	f1 e0       	ldi	r31, 0x01	; 1
    for(int i=0;i<64;i++) 
        status[i]=0x00;
 a68:	11 92       	st	Z+, r1
    pinMode(SPI_MOSI,OUTPUT);
    pinMode(SPI_CLK,OUTPUT);
    pinMode(SPI_CS,OUTPUT);
    digitalWrite(SPI_CS,HIGH);
    SPI_MOSI=dataPin;
    for(int i=0;i<64;i++) 
 a6a:	82 e0       	ldi	r24, 0x02	; 2
 a6c:	e4 33       	cpi	r30, 0x34	; 52
 a6e:	f8 07       	cpc	r31, r24
 a70:	d9 f7       	brne	.-10     	; 0xa68 <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832+0xea>
 a72:	c0 e0       	ldi	r28, 0x00	; 0
 a74:	d0 e0       	ldi	r29, 0x00	; 0
        status[i]=0x00;
    for(int i=0;i<maxDevices;i++) {
 a76:	80 91 3a 02 	lds	r24, 0x023A	; 0x80023a <lc+0x56>
 a7a:	90 91 3b 02 	lds	r25, 0x023B	; 0x80023b <lc+0x57>
 a7e:	c8 17       	cp	r28, r24
 a80:	d9 07       	cpc	r29, r25
 a82:	ac f5       	brge	.+106    	; 0xaee <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832+0x170>
        spiTransfer(i,OP_DISPLAYTEST,0);
 a84:	20 e0       	ldi	r18, 0x00	; 0
 a86:	4f e0       	ldi	r20, 0x0F	; 15
 a88:	be 01       	movw	r22, r28
 a8a:	84 ee       	ldi	r24, 0xE4	; 228
 a8c:	91 e0       	ldi	r25, 0x01	; 1
 a8e:	0e 94 ed 02 	call	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
    else
        spiTransfer(addr, OP_SHUTDOWN,1);
}

void LedControl::setScanLimit(int addr, int limit) {
    if(addr<0 || addr>=maxDevices)
 a92:	d7 fd       	sbrc	r29, 7
 a94:	0e c0       	rjmp	.+28     	; 0xab2 <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832+0x134>
 a96:	80 91 3a 02 	lds	r24, 0x023A	; 0x80023a <lc+0x56>
 a9a:	90 91 3b 02 	lds	r25, 0x023B	; 0x80023b <lc+0x57>
 a9e:	c8 17       	cp	r28, r24
 aa0:	d9 07       	cpc	r29, r25
 aa2:	3c f4       	brge	.+14     	; 0xab2 <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832+0x134>
        return;
    if(limit>=0 && limit<8)
        spiTransfer(addr, OP_SCANLIMIT,limit);
 aa4:	27 e0       	ldi	r18, 0x07	; 7
 aa6:	4b e0       	ldi	r20, 0x0B	; 11
 aa8:	be 01       	movw	r22, r28
 aaa:	84 ee       	ldi	r24, 0xE4	; 228
 aac:	91 e0       	ldi	r25, 0x01	; 1
 aae:	0e 94 ed 02 	call	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
    for(int i=0;i<maxDevices;i++) {
        spiTransfer(i,OP_DISPLAYTEST,0);
        //scanlimit is set to max on startup
        setScanLimit(i,7);
        //decode is done in source
        spiTransfer(i,OP_DECODEMODE,0);
 ab2:	20 e0       	ldi	r18, 0x00	; 0
 ab4:	49 e0       	ldi	r20, 0x09	; 9
 ab6:	be 01       	movw	r22, r28
 ab8:	84 ee       	ldi	r24, 0xE4	; 228
 aba:	91 e0       	ldi	r25, 0x01	; 1
 abc:	0e 94 ed 02 	call	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
        clearDisplay(i);
 ac0:	be 01       	movw	r22, r28
 ac2:	84 ee       	ldi	r24, 0xE4	; 228
 ac4:	91 e0       	ldi	r25, 0x01	; 1
 ac6:	0e 94 92 03 	call	0x724	; 0x724 <LedControl::clearDisplay(int)>
int LedControl::getDeviceCount() {
    return maxDevices;
}

void LedControl::shutdown(int addr, bool b) {
    if(addr<0 || addr>=maxDevices)
 aca:	d7 fd       	sbrc	r29, 7
 acc:	0e c0       	rjmp	.+28     	; 0xaea <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832+0x16c>
 ace:	80 91 3a 02 	lds	r24, 0x023A	; 0x80023a <lc+0x56>
 ad2:	90 91 3b 02 	lds	r25, 0x023B	; 0x80023b <lc+0x57>
 ad6:	c8 17       	cp	r28, r24
 ad8:	d9 07       	cpc	r29, r25
 ada:	3c f4       	brge	.+14     	; 0xaea <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832+0x16c>
        return;
    if(b)
        spiTransfer(addr, OP_SHUTDOWN,0);
 adc:	20 e0       	ldi	r18, 0x00	; 0
 ade:	4c e0       	ldi	r20, 0x0C	; 12
 ae0:	be 01       	movw	r22, r28
 ae2:	84 ee       	ldi	r24, 0xE4	; 228
 ae4:	91 e0       	ldi	r25, 0x01	; 1
 ae6:	0e 94 ed 02 	call	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
    pinMode(SPI_CS,OUTPUT);
    digitalWrite(SPI_CS,HIGH);
    SPI_MOSI=dataPin;
    for(int i=0;i<64;i++) 
        status[i]=0x00;
    for(int i=0;i<maxDevices;i++) {
 aea:	21 96       	adiw	r28, 0x01	; 1
 aec:	c4 cf       	rjmp	.-120    	; 0xa76 <global constructors keyed to 65535_0_shiftin_try6_wLED.ino.cpp.o.1832+0xf8>
 aee:	df 91       	pop	r29
 af0:	cf 91       	pop	r28
 af2:	08 95       	ret

00000af4 <main>:

void init()
{
	// this needs to be called before setup() or some functions won't
	// work there
	sei();
 af4:	78 94       	sei
	
	// on the ATmega168, timer 0 is also used for fast hardware pwm
	// (using phase-correct PWM would mean that timer 0 overflowed half as often
	// resulting in different millis() behavior on the ATmega8 and ATmega168)
#if defined(TCCR0A) && defined(WGM01)
	sbi(TCCR0A, WGM01);
 af6:	84 b5       	in	r24, 0x24	; 36
 af8:	82 60       	ori	r24, 0x02	; 2
 afa:	84 bd       	out	0x24, r24	; 36
	sbi(TCCR0A, WGM00);
 afc:	84 b5       	in	r24, 0x24	; 36
 afe:	81 60       	ori	r24, 0x01	; 1
 b00:	84 bd       	out	0x24, r24	; 36
	// this combination is for the standard atmega8
	sbi(TCCR0, CS01);
	sbi(TCCR0, CS00);
#elif defined(TCCR0B) && defined(CS01) && defined(CS00)
	// this combination is for the standard 168/328/1280/2560
	sbi(TCCR0B, CS01);
 b02:	85 b5       	in	r24, 0x25	; 37
 b04:	82 60       	ori	r24, 0x02	; 2
 b06:	85 bd       	out	0x25, r24	; 37
	sbi(TCCR0B, CS00);
 b08:	85 b5       	in	r24, 0x25	; 37
 b0a:	81 60       	ori	r24, 0x01	; 1
 b0c:	85 bd       	out	0x25, r24	; 37

	// enable timer 0 overflow interrupt
#if defined(TIMSK) && defined(TOIE0)
	sbi(TIMSK, TOIE0);
#elif defined(TIMSK0) && defined(TOIE0)
	sbi(TIMSK0, TOIE0);
 b0e:	80 91 6e 00 	lds	r24, 0x006E	; 0x80006e <__TEXT_REGION_LENGTH__+0x7e006e>
 b12:	81 60       	ori	r24, 0x01	; 1
 b14:	80 93 6e 00 	sts	0x006E, r24	; 0x80006e <__TEXT_REGION_LENGTH__+0x7e006e>
	// this is better for motors as it ensures an even waveform
	// note, however, that fast pwm mode can achieve a frequency of up
	// 8 MHz (with a 16 MHz clock) at 50% duty cycle

#if defined(TCCR1B) && defined(CS11) && defined(CS10)
	TCCR1B = 0;
 b18:	10 92 81 00 	sts	0x0081, r1	; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>

	// set timer 1 prescale factor to 64
	sbi(TCCR1B, CS11);
 b1c:	80 91 81 00 	lds	r24, 0x0081	; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
 b20:	82 60       	ori	r24, 0x02	; 2
 b22:	80 93 81 00 	sts	0x0081, r24	; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
#if F_CPU >= 8000000L
	sbi(TCCR1B, CS10);
 b26:	80 91 81 00 	lds	r24, 0x0081	; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
 b2a:	81 60       	ori	r24, 0x01	; 1
 b2c:	80 93 81 00 	sts	0x0081, r24	; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
	sbi(TCCR1, CS10);
#endif
#endif
	// put timer 1 in 8-bit phase correct pwm mode
#if defined(TCCR1A) && defined(WGM10)
	sbi(TCCR1A, WGM10);
 b30:	80 91 80 00 	lds	r24, 0x0080	; 0x800080 <__TEXT_REGION_LENGTH__+0x7e0080>
 b34:	81 60       	ori	r24, 0x01	; 1
 b36:	80 93 80 00 	sts	0x0080, r24	; 0x800080 <__TEXT_REGION_LENGTH__+0x7e0080>

	// set timer 2 prescale factor to 64
#if defined(TCCR2) && defined(CS22)
	sbi(TCCR2, CS22);
#elif defined(TCCR2B) && defined(CS22)
	sbi(TCCR2B, CS22);
 b3a:	80 91 b1 00 	lds	r24, 0x00B1	; 0x8000b1 <__TEXT_REGION_LENGTH__+0x7e00b1>
 b3e:	84 60       	ori	r24, 0x04	; 4
 b40:	80 93 b1 00 	sts	0x00B1, r24	; 0x8000b1 <__TEXT_REGION_LENGTH__+0x7e00b1>

	// configure timer 2 for phase correct pwm (8-bit)
#if defined(TCCR2) && defined(WGM20)
	sbi(TCCR2, WGM20);
#elif defined(TCCR2A) && defined(WGM20)
	sbi(TCCR2A, WGM20);
 b44:	80 91 b0 00 	lds	r24, 0x00B0	; 0x8000b0 <__TEXT_REGION_LENGTH__+0x7e00b0>
 b48:	81 60       	ori	r24, 0x01	; 1
 b4a:	80 93 b0 00 	sts	0x00B0, r24	; 0x8000b0 <__TEXT_REGION_LENGTH__+0x7e00b0>
#endif

#if defined(ADCSRA)
	// set a2d prescaler so we are inside the desired 50-200 KHz range.
	#if F_CPU >= 16000000 // 16 MHz / 128 = 125 KHz
		sbi(ADCSRA, ADPS2);
 b4e:	80 91 7a 00 	lds	r24, 0x007A	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
 b52:	84 60       	ori	r24, 0x04	; 4
 b54:	80 93 7a 00 	sts	0x007A, r24	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
		sbi(ADCSRA, ADPS1);
 b58:	80 91 7a 00 	lds	r24, 0x007A	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
 b5c:	82 60       	ori	r24, 0x02	; 2
 b5e:	80 93 7a 00 	sts	0x007A, r24	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
		sbi(ADCSRA, ADPS0);
 b62:	80 91 7a 00 	lds	r24, 0x007A	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
 b66:	81 60       	ori	r24, 0x01	; 1
 b68:	80 93 7a 00 	sts	0x007A, r24	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
		cbi(ADCSRA, ADPS2);
		cbi(ADCSRA, ADPS1);
		sbi(ADCSRA, ADPS0);
	#endif
	// enable a2d conversions
	sbi(ADCSRA, ADEN);
 b6c:	80 91 7a 00 	lds	r24, 0x007A	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
 b70:	80 68       	ori	r24, 0x80	; 128
 b72:	80 93 7a 00 	sts	0x007A, r24	; 0x80007a <__TEXT_REGION_LENGTH__+0x7e007a>
	// here so they can be used as normal digital i/o; they will be
	// reconnected in Serial.begin()
#if defined(UCSRB)
	UCSRB = 0;
#elif defined(UCSR0B)
	UCSR0B = 0;
 b76:	10 92 c1 00 	sts	0x00C1, r1	; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>

void setup() {
  // put your setup code here, to run once:


pinMode(hzclk, INPUT);
 b7a:	60 e0       	ldi	r22, 0x00	; 0
 b7c:	87 e0       	ldi	r24, 0x07	; 7
 b7e:	0e 94 58 02 	call	0x4b0	; 0x4b0 <pinMode>
pinMode(hzbinary, INPUT);
 b82:	60 e0       	ldi	r22, 0x00	; 0
 b84:	86 e0       	ldi	r24, 0x06	; 6
 b86:	0e 94 58 02 	call	0x4b0	; 0x4b0 <pinMode>
pinMode(sigLED, OUTPUT);
 b8a:	61 e0       	ldi	r22, 0x01	; 1
 b8c:	8b e0       	ldi	r24, 0x0B	; 11
 b8e:	0e 94 58 02 	call	0x4b0	; 0x4b0 <pinMode>

void HardwareSerial::begin(unsigned long baud, byte config)
{
  // Try u2x mode first
  uint16_t baud_setting = (F_CPU / 4 / baud - 1) / 2;
  *_ucsra = 1 << U2X0;
 b92:	e0 91 57 01 	lds	r30, 0x0157	; 0x800157 <Serial+0x10>
 b96:	f0 91 58 01 	lds	r31, 0x0158	; 0x800158 <Serial+0x11>
 b9a:	82 e0       	ldi	r24, 0x02	; 2
 b9c:	80 83       	st	Z, r24
    *_ucsra = 0;
    baud_setting = (F_CPU / 8 / baud - 1) / 2;
  }

  // assign the baud_setting, a.k.a. ubrr (USART Baud Rate Register)
  *_ubrrh = baud_setting >> 8;
 b9e:	e0 91 53 01 	lds	r30, 0x0153	; 0x800153 <Serial+0xc>
 ba2:	f0 91 54 01 	lds	r31, 0x0154	; 0x800154 <Serial+0xd>
 ba6:	10 82       	st	Z, r1
  *_ubrrl = baud_setting;
 ba8:	e0 91 55 01 	lds	r30, 0x0155	; 0x800155 <Serial+0xe>
 bac:	f0 91 56 01 	lds	r31, 0x0156	; 0x800156 <Serial+0xf>
 bb0:	80 e1       	ldi	r24, 0x10	; 16
 bb2:	80 83       	st	Z, r24

  _written = false;
 bb4:	10 92 5f 01 	sts	0x015F, r1	; 0x80015f <Serial+0x18>

  //set the data bits, parity, and stop bits
#if defined(__AVR_ATmega8__)
  config |= 0x80; // select UCSRC register (shared with UBRRH)
#endif
  *_ucsrc = config;
 bb8:	e0 91 5b 01 	lds	r30, 0x015B	; 0x80015b <Serial+0x14>
 bbc:	f0 91 5c 01 	lds	r31, 0x015C	; 0x80015c <Serial+0x15>
 bc0:	86 e0       	ldi	r24, 0x06	; 6
 bc2:	80 83       	st	Z, r24
  
  sbi(*_ucsrb, RXEN0);
 bc4:	e0 91 59 01 	lds	r30, 0x0159	; 0x800159 <Serial+0x12>
 bc8:	f0 91 5a 01 	lds	r31, 0x015A	; 0x80015a <Serial+0x13>
 bcc:	80 81       	ld	r24, Z
 bce:	80 61       	ori	r24, 0x10	; 16
 bd0:	80 83       	st	Z, r24
  sbi(*_ucsrb, TXEN0);
 bd2:	e0 91 59 01 	lds	r30, 0x0159	; 0x800159 <Serial+0x12>
 bd6:	f0 91 5a 01 	lds	r31, 0x015A	; 0x80015a <Serial+0x13>
 bda:	80 81       	ld	r24, Z
 bdc:	88 60       	ori	r24, 0x08	; 8
 bde:	80 83       	st	Z, r24
  sbi(*_ucsrb, RXCIE0);
 be0:	e0 91 59 01 	lds	r30, 0x0159	; 0x800159 <Serial+0x12>
 be4:	f0 91 5a 01 	lds	r31, 0x015A	; 0x80015a <Serial+0x13>
 be8:	80 81       	ld	r24, Z
 bea:	80 68       	ori	r24, 0x80	; 128
 bec:	80 83       	st	Z, r24
  cbi(*_ucsrb, UDRIE0);
 bee:	e0 91 59 01 	lds	r30, 0x0159	; 0x800159 <Serial+0x12>
 bf2:	f0 91 5a 01 	lds	r31, 0x015A	; 0x80015a <Serial+0x13>
 bf6:	80 81       	ld	r24, Z
 bf8:	8f 7d       	andi	r24, 0xDF	; 223
 bfa:	80 83       	st	Z, r24
int LedControl::getDeviceCount() {
    return maxDevices;
}

void LedControl::shutdown(int addr, bool b) {
    if(addr<0 || addr>=maxDevices)
 bfc:	80 91 3a 02 	lds	r24, 0x023A	; 0x80023a <lc+0x56>
 c00:	90 91 3b 02 	lds	r25, 0x023B	; 0x80023b <lc+0x57>
 c04:	18 16       	cp	r1, r24
 c06:	19 06       	cpc	r1, r25
 c08:	44 f4       	brge	.+16     	; 0xc1a <main+0x126>
        return;
    if(b)
        spiTransfer(addr, OP_SHUTDOWN,0);
    else
        spiTransfer(addr, OP_SHUTDOWN,1);
 c0a:	21 e0       	ldi	r18, 0x01	; 1
 c0c:	4c e0       	ldi	r20, 0x0C	; 12
 c0e:	60 e0       	ldi	r22, 0x00	; 0
 c10:	70 e0       	ldi	r23, 0x00	; 0
 c12:	84 ee       	ldi	r24, 0xE4	; 228
 c14:	91 e0       	ldi	r25, 0x01	; 1
 c16:	0e 94 ed 02 	call	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
    if(limit>=0 && limit<8)
        spiTransfer(addr, OP_SCANLIMIT,limit);
}

void LedControl::setIntensity(int addr, int intensity) {
    if(addr<0 || addr>=maxDevices)
 c1a:	80 91 3a 02 	lds	r24, 0x023A	; 0x80023a <lc+0x56>
 c1e:	90 91 3b 02 	lds	r25, 0x023B	; 0x80023b <lc+0x57>
 c22:	18 16       	cp	r1, r24
 c24:	19 06       	cpc	r1, r25
 c26:	44 f4       	brge	.+16     	; 0xc38 <main+0x144>
        return;
    if(intensity>=0 && intensity<16)	
        spiTransfer(addr, OP_INTENSITY,intensity);
 c28:	28 e0       	ldi	r18, 0x08	; 8
 c2a:	4a e0       	ldi	r20, 0x0A	; 10
 c2c:	60 e0       	ldi	r22, 0x00	; 0
 c2e:	70 e0       	ldi	r23, 0x00	; 0
 c30:	84 ee       	ldi	r24, 0xE4	; 228
 c32:	91 e0       	ldi	r25, 0x01	; 1
 c34:	0e 94 ed 02 	call	0x5da	; 0x5da <LedControl::spiTransfer(int, unsigned char, unsigned char)>
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
 c38:	60 e0       	ldi	r22, 0x00	; 0
 c3a:	70 e0       	ldi	r23, 0x00	; 0
 c3c:	84 ee       	ldi	r24, 0xE4	; 228
 c3e:	91 e0       	ldi	r25, 0x01	; 1
 c40:	0e 94 92 03 	call	0x724	; 0x724 <LedControl::clearDisplay(int)>
}

void ConvertArraytoBin (void){
   for(x=4;x<21;x++){
    if(hzbinval[x] == 1){
      bitfieldA.mainstwo = bitfieldA.mainstwo | (0b0000000000000000000001 << (x - 3));
 c44:	ee 24       	eor	r14, r14
 c46:	e3 94       	inc	r14
 c48:	f1 2c       	mov	r15, r1
    if(v<0) {
        negative=true;
        v=v*-1;
    }
    ones=v%10;
    v=v/10;
 c4a:	ca e0       	ldi	r28, 0x0A	; 10
 c4c:	d0 e0       	ldi	r29, 0x00	; 0
   //direct port reads
   if(temp == 5047){
    temp = 5998; //something, something, premature optimization...
   }
   if(temp == 5048){
    temp = 6000; //LUTs
 c4e:	30 e7       	ldi	r19, 0x70	; 112
 c50:	c3 2e       	mov	r12, r19
 c52:	37 e1       	ldi	r19, 0x17	; 23
 c54:	d3 2e       	mov	r13, r19
   //results in a clock that is right most of the time.
   //but wrong every 20 or so counts
   //todo: fix timing of duino by removing digital read for 
   //direct port reads
   if(temp == 5047){
    temp = 5998; //something, something, premature optimization...
 c56:	4e e6       	ldi	r20, 0x6E	; 110
 c58:	24 2e       	mov	r2, r20
 c5a:	47 e1       	ldi	r20, 0x17	; 23
 c5c:	34 2e       	mov	r3, r20
	

#endif

	// busy wait
	__asm__ __volatile__ (
 c5e:	0b e8       	ldi	r16, 0x8B	; 139
 c60:	11 e0       	ldi	r17, 0x01	; 1
}

void loop() {


 if(digitalRead(hzbinary) == LOW){
 c62:	86 e0       	ldi	r24, 0x06	; 6
 c64:	0e 94 ff 01 	call	0x3fe	; 0x3fe <digitalRead>
 c68:	89 2b       	or	r24, r25
 c6a:	09 f0       	breq	.+2      	; 0xc6e <main+0x17a>
 c6c:	16 c1       	rjmp	.+556    	; 0xe9a <main+0x3a6>
  //this handles one clk cycle each
  //need to read 20 cycles
  clkval = 0;
 c6e:	10 92 46 01 	sts	0x0146, r1	; 0x800146 <clkval>
  checkCLKandBIN();checkCLKandBIN();checkCLKandBIN();
 c72:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c76:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c7a:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();checkCLKandBIN();checkCLKandBIN();
 c7e:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c82:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c86:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();checkCLKandBIN();checkCLKandBIN();
 c8a:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c8e:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c92:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();checkCLKandBIN();checkCLKandBIN();
 c96:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c9a:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 c9e:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();checkCLKandBIN();checkCLKandBIN();
 ca2:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 ca6:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 caa:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();
 cae:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();
 cb2:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();
 cb6:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();
 cba:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();
 cbe:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();
 cc2:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
  checkCLKandBIN();
 cc6:	0e 94 b9 02 	call	0x572	; 0x572 <checkCLKandBIN()>
 cca:	80 91 42 01 	lds	r24, 0x0142	; 0x800142 <bitfieldA>
 cce:	20 91 43 01 	lds	r18, 0x0143	; 0x800143 <bitfieldA+0x1>
 cd2:	92 2f       	mov	r25, r18
 cd4:	9f 73       	andi	r25, 0x3F	; 63
 cd6:	24 e0       	ldi	r18, 0x04	; 4
    lc.setDigit(0,1,(byte)tens,false);
    lc.setDigit(0,0,(byte)ones,false);
}

void ConvertArraytoBin (void){
   for(x=4;x<21;x++){
 cd8:	25 31       	cpi	r18, 0x15	; 21
 cda:	a9 f0       	breq	.+42     	; 0xd06 <main+0x212>
    if(hzbinval[x] == 1){
 cdc:	42 2f       	mov	r20, r18
 cde:	50 e0       	ldi	r21, 0x00	; 0
 ce0:	fa 01       	movw	r30, r20
 ce2:	ed 5d       	subi	r30, 0xDD	; 221
 ce4:	fe 4f       	sbci	r31, 0xFE	; 254
 ce6:	30 81       	ld	r19, Z
 ce8:	31 30       	cpi	r19, 0x01	; 1
 cea:	59 f4       	brne	.+22     	; 0xd02 <main+0x20e>
      bitfieldA.mainstwo = bitfieldA.mainstwo | (0b0000000000000000000001 << (x - 3));
 cec:	43 50       	subi	r20, 0x03	; 3
 cee:	51 09       	sbc	r21, r1
 cf0:	b7 01       	movw	r22, r14
 cf2:	02 c0       	rjmp	.+4      	; 0xcf8 <main+0x204>
 cf4:	66 0f       	add	r22, r22
 cf6:	77 1f       	adc	r23, r23
 cf8:	4a 95       	dec	r20
 cfa:	e2 f7       	brpl	.-8      	; 0xcf4 <main+0x200>
 cfc:	86 2b       	or	r24, r22
 cfe:	97 2b       	or	r25, r23
 d00:	9f 73       	andi	r25, 0x3F	; 63
 d02:	2f 5f       	subi	r18, 0xFF	; 255
 d04:	e9 cf       	rjmp	.-46     	; 0xcd8 <main+0x1e4>
 d06:	80 93 42 01 	sts	0x0142, r24	; 0x800142 <bitfieldA>
 d0a:	39 2f       	mov	r19, r25
 d0c:	3f 73       	andi	r19, 0x3F	; 63
 d0e:	90 91 43 01 	lds	r25, 0x0143	; 0x800143 <bitfieldA+0x1>
 d12:	90 7c       	andi	r25, 0xC0	; 192
 d14:	93 2b       	or	r25, r19
 d16:	90 93 43 01 	sts	0x0143, r25	; 0x800143 <bitfieldA+0x1>
 d1a:	20 93 41 01 	sts	0x0141, r18	; 0x800141 <x>
    }
   }
   //Serial.println(bitfieldA.mainstwo,BIN);

   
   temp = bitfieldA.mainstwo >> 1;
 d1e:	9c 01       	movw	r18, r24
 d20:	3f 73       	andi	r19, 0x3F	; 63
 d22:	35 95       	asr	r19
 d24:	27 95       	ror	r18

   //almost, but no cigar. has timing issues.
   //ugly hack time
   temp = temp & 0b1011111111111;
 d26:	37 71       	andi	r19, 0x17	; 23
   //results in a clock that is right most of the time.
   //but wrong every 20 or so counts
   //todo: fix timing of duino by removing digital read for 
   //direct port reads
   if(temp == 5047){
 d28:	27 3b       	cpi	r18, 0xB7	; 183
 d2a:	73 e1       	ldi	r23, 0x13	; 19
 d2c:	37 07       	cpc	r19, r23
 d2e:	29 f0       	breq	.+10     	; 0xd3a <main+0x246>
   
   temp = bitfieldA.mainstwo >> 1;

   //almost, but no cigar. has timing issues.
   //ugly hack time
   temp = temp & 0b1011111111111;
 d30:	30 93 22 01 	sts	0x0122, r19	; 0x800122 <temp+0x1>
 d34:	20 93 21 01 	sts	0x0121, r18	; 0x800121 <temp>
 d38:	04 c0       	rjmp	.+8      	; 0xd42 <main+0x24e>
   //results in a clock that is right most of the time.
   //but wrong every 20 or so counts
   //todo: fix timing of duino by removing digital read for 
   //direct port reads
   if(temp == 5047){
    temp = 5998; //something, something, premature optimization...
 d3a:	30 92 22 01 	sts	0x0122, r3	; 0x800122 <temp+0x1>
 d3e:	20 92 21 01 	sts	0x0121, r2	; 0x800121 <temp>
   }
   if(temp == 5048){
 d42:	80 91 21 01 	lds	r24, 0x0121	; 0x800121 <temp>
 d46:	90 91 22 01 	lds	r25, 0x0122	; 0x800122 <temp+0x1>
 d4a:	88 3b       	cpi	r24, 0xB8	; 184
 d4c:	93 41       	sbci	r25, 0x13	; 19
 d4e:	21 f4       	brne	.+8      	; 0xd58 <main+0x264>
    temp = 6000; //LUTs
 d50:	d0 92 22 01 	sts	0x0122, r13	; 0x800122 <temp+0x1>
 d54:	c0 92 21 01 	sts	0x0121, r12	; 0x800121 <temp>
      n = -n;
      return printNumber(n, 10) + t;
    }
    return printNumber(n, 10);
  } else {
    return printNumber(n, base);
 d58:	60 91 21 01 	lds	r22, 0x0121	; 0x800121 <temp>
 d5c:	70 91 22 01 	lds	r23, 0x0122	; 0x800122 <temp+0x1>
 d60:	07 2e       	mov	r0, r23
 d62:	00 0c       	add	r0, r0
 d64:	88 0b       	sbc	r24, r24
 d66:	99 0b       	sbc	r25, r25
 d68:	42 e0       	ldi	r20, 0x02	; 2
 d6a:	0e 94 da 03 	call	0x7b4	; 0x7b4 <Print::printNumber(unsigned long, unsigned char) [clone .constprop.7]>
  return x.printTo(*this);
}

size_t Print::println(void)
{
  return write("\r\n");
 d6e:	82 e1       	ldi	r24, 0x12	; 18
 d70:	91 e0       	ldi	r25, 0x01	; 1
 d72:	0e 94 c8 03 	call	0x790	; 0x790 <Print::write(char const*) [clone .constprop.10]>
   }
   
   Serial.println(temp,BIN);
   Serial.println(temp,DEC);
 d76:	40 90 21 01 	lds	r4, 0x0121	; 0x800121 <temp>
 d7a:	50 90 22 01 	lds	r5, 0x0122	; 0x800122 <temp+0x1>
  return print((unsigned long) b, base);
}

size_t Print::print(int n, int base)
{
  return print((long) n, base);
 d7e:	05 2c       	mov	r0, r5
 d80:	00 0c       	add	r0, r0
 d82:	66 08       	sbc	r6, r6
 d84:	77 08       	sbc	r7, r7
size_t Print::print(long n, int base)
{
  if (base == 0) {
    return write(n);
  } else if (base == 10) {
    if (n < 0) {
 d86:	77 fe       	sbrs	r7, 7
 d88:	14 c0       	rjmp	.+40     	; 0xdb2 <main+0x2be>
  return write(str);
}

size_t Print::print(char c)
{
  return write(c);
 d8a:	e0 91 47 01 	lds	r30, 0x0147	; 0x800147 <Serial>
 d8e:	f0 91 48 01 	lds	r31, 0x0148	; 0x800148 <Serial+0x1>
 d92:	01 90       	ld	r0, Z+
 d94:	f0 81       	ld	r31, Z
 d96:	e0 2d       	mov	r30, r0
 d98:	6d e2       	ldi	r22, 0x2D	; 45
 d9a:	87 e4       	ldi	r24, 0x47	; 71
 d9c:	91 e0       	ldi	r25, 0x01	; 1
 d9e:	09 95       	icall
  if (base == 0) {
    return write(n);
  } else if (base == 10) {
    if (n < 0) {
      int t = print('-');
      n = -n;
 da0:	66 27       	eor	r22, r22
 da2:	77 27       	eor	r23, r23
 da4:	cb 01       	movw	r24, r22
 da6:	64 19       	sub	r22, r4
 da8:	75 09       	sbc	r23, r5
 daa:	86 09       	sbc	r24, r6
 dac:	97 09       	sbc	r25, r7
      return printNumber(n, 10) + t;
 dae:	4a e0       	ldi	r20, 0x0A	; 10
 db0:	03 c0       	rjmp	.+6      	; 0xdb8 <main+0x2c4>
    }
    return printNumber(n, 10);
 db2:	4a e0       	ldi	r20, 0x0A	; 10
 db4:	c3 01       	movw	r24, r6
 db6:	b2 01       	movw	r22, r4
 db8:	0e 94 da 03 	call	0x7b4	; 0x7b4 <Print::printNumber(unsigned long, unsigned char) [clone .constprop.7]>
  return x.printTo(*this);
}

size_t Print::println(void)
{
  return write("\r\n");
 dbc:	82 e1       	ldi	r24, 0x12	; 18
 dbe:	91 e0       	ldi	r25, 0x01	; 1
 dc0:	0e 94 c8 03 	call	0x790	; 0x790 <Print::write(char const*) [clone .constprop.10]>
  return write(s.c_str(), s.length());
}

size_t Print::print(const char str[])
{
  return write(str);
 dc4:	83 e1       	ldi	r24, 0x13	; 19
 dc6:	91 e0       	ldi	r25, 0x01	; 1
 dc8:	0e 94 c8 03 	call	0x790	; 0x790 <Print::write(char const*) [clone .constprop.10]>
   Serial.print("\n");

  lc.clearDisplay(0);
 dcc:	60 e0       	ldi	r22, 0x00	; 0
 dce:	70 e0       	ldi	r23, 0x00	; 0
 dd0:	84 ee       	ldi	r24, 0xE4	; 228
 dd2:	91 e0       	ldi	r25, 0x01	; 1
 dd4:	0e 94 92 03 	call	0x724	; 0x724 <LedControl::clearDisplay(int)>
  printNumber(temp);
 dd8:	80 91 21 01 	lds	r24, 0x0121	; 0x800121 <temp>
 ddc:	90 91 22 01 	lds	r25, 0x0122	; 0x800122 <temp+0x1>
    int tens;
    int hundreds;
    int thousands;
    boolean negative;  

    if(v < -9999 || v > 9999) 
 de0:	9c 01       	movw	r18, r24
 de2:	21 5f       	subi	r18, 0xF1	; 241
 de4:	38 4d       	sbci	r19, 0xD8	; 216
 de6:	2f 31       	cpi	r18, 0x1F	; 31
 de8:	3e 44       	sbci	r19, 0x4E	; 78
 dea:	30 f5       	brcc	.+76     	; 0xe38 <main+0x344>
 dec:	97 ff       	sbrs	r25, 7
 dee:	03 c0       	rjmp	.+6      	; 0xdf6 <main+0x302>
 df0:	91 95       	neg	r25
 df2:	81 95       	neg	r24
 df4:	91 09       	sbc	r25, r1
    if(v<0) {
        negative=true;
        v=v*-1;
    }
    ones=v%10;
    v=v/10;
 df6:	be 01       	movw	r22, r28
 df8:	0e 94 53 07 	call	0xea6	; 0xea6 <__divmodhi4>
 dfc:	78 2e       	mov	r7, r24
    tens=v%10;
    v=v/10;
 dfe:	cb 01       	movw	r24, r22
 e00:	be 01       	movw	r22, r28
 e02:	0e 94 53 07 	call	0xea6	; 0xea6 <__divmodhi4>
 e06:	68 2e       	mov	r6, r24
    hundreds=v%10;
    v=v/10;
 e08:	cb 01       	movw	r24, r22
 e0a:	be 01       	movw	r22, r28
 e0c:	0e 94 53 07 	call	0xea6	; 0xea6 <__divmodhi4>
 e10:	58 2e       	mov	r5, r24
    else {
       //print a blank in the sign column
       lc.setChar(0,4,' ',false);
    }*/
    //Now print the number digit by digit
    lc.setDigit(0,3,(byte)thousands,false);
 e12:	83 e0       	ldi	r24, 0x03	; 3
 e14:	90 e0       	ldi	r25, 0x00	; 0
 e16:	0e 94 74 03 	call	0x6e8	; 0x6e8 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]>
    lc.setDigit(0,2,(byte)hundreds,false);
 e1a:	65 2d       	mov	r22, r5
 e1c:	82 e0       	ldi	r24, 0x02	; 2
 e1e:	90 e0       	ldi	r25, 0x00	; 0
 e20:	0e 94 74 03 	call	0x6e8	; 0x6e8 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]>
    lc.setDigit(0,1,(byte)tens,false);
 e24:	66 2d       	mov	r22, r6
 e26:	81 e0       	ldi	r24, 0x01	; 1
 e28:	90 e0       	ldi	r25, 0x00	; 0
 e2a:	0e 94 74 03 	call	0x6e8	; 0x6e8 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]>
    lc.setDigit(0,0,(byte)ones,false);
 e2e:	67 2d       	mov	r22, r7
 e30:	80 e0       	ldi	r24, 0x00	; 0
 e32:	90 e0       	ldi	r25, 0x00	; 0
 e34:	0e 94 74 03 	call	0x6e8	; 0x6e8 <LedControl::setDigit(int, int, unsigned char, bool) [clone .constprop.15]>
	return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond());
}

void delay(unsigned long ms)
{
	uint32_t start = micros();
 e38:	0e 94 94 02 	call	0x528	; 0x528 <micros>
 e3c:	4b 01       	movw	r8, r22
 e3e:	5c 01       	movw	r10, r24
 e40:	8a ef       	ldi	r24, 0xFA	; 250
 e42:	48 2e       	mov	r4, r24
 e44:	51 2c       	mov	r5, r1
 e46:	61 2c       	mov	r6, r1
 e48:	71 2c       	mov	r7, r1

	while (ms > 0) {
		yield();
		while ( ms > 0 && (micros() - start) >= 1000) {
 e4a:	0e 94 94 02 	call	0x528	; 0x528 <micros>
 e4e:	dc 01       	movw	r26, r24
 e50:	cb 01       	movw	r24, r22
 e52:	88 19       	sub	r24, r8
 e54:	99 09       	sbc	r25, r9
 e56:	aa 09       	sbc	r26, r10
 e58:	bb 09       	sbc	r27, r11
 e5a:	88 3e       	cpi	r24, 0xE8	; 232
 e5c:	93 40       	sbci	r25, 0x03	; 3
 e5e:	a1 05       	cpc	r26, r1
 e60:	b1 05       	cpc	r27, r1
 e62:	58 f0       	brcs	.+22     	; 0xe7a <main+0x386>
			ms--;
 e64:	61 e0       	ldi	r22, 0x01	; 1
 e66:	46 1a       	sub	r4, r22
 e68:	51 08       	sbc	r5, r1
 e6a:	61 08       	sbc	r6, r1
 e6c:	71 08       	sbc	r7, r1
			start += 1000;
 e6e:	78 ee       	ldi	r23, 0xE8	; 232
 e70:	87 0e       	add	r8, r23
 e72:	73 e0       	ldi	r23, 0x03	; 3
 e74:	97 1e       	adc	r9, r23
 e76:	a1 1c       	adc	r10, r1
 e78:	b1 1c       	adc	r11, r1
{
	uint32_t start = micros();

	while (ms > 0) {
		yield();
		while ( ms > 0 && (micros() - start) >= 1000) {
 e7a:	41 14       	cp	r4, r1
 e7c:	51 04       	cpc	r5, r1
 e7e:	61 04       	cpc	r6, r1
 e80:	71 04       	cpc	r7, r1
 e82:	19 f7       	brne	.-58     	; 0xe4a <main+0x356>
  checkCLKandBIN();
  checkCLKandBIN();
  checkCLKandBIN();
  //Serial.println(clkval); //outputs 19 or 20
  ConvertArraytoBin();
   mainsfreq = 0;
 e84:	10 92 45 01 	sts	0x0145, r1	; 0x800145 <mainsfreq+0x1>
 e88:	10 92 44 01 	sts	0x0144, r1	; 0x800144 <mainsfreq>
   bitfieldA.mainstwo = 0;
 e8c:	10 92 42 01 	sts	0x0142, r1	; 0x800142 <bitfieldA>
 e90:	80 91 43 01 	lds	r24, 0x0143	; 0x800143 <bitfieldA+0x1>
 e94:	80 7c       	andi	r24, 0xC0	; 192
 e96:	80 93 43 01 	sts	0x0143, r24	; 0x800143 <bitfieldA+0x1>
	

#endif

	// busy wait
	__asm__ __volatile__ (
 e9a:	c8 01       	movw	r24, r16
 e9c:	01 97       	sbiw	r24, 0x01	; 1
 e9e:	f1 f7       	brne	.-4      	; 0xe9c <main+0x3a8>
	
	setup();
    
	for (;;) {
		loop();
		if (serialEventRun) serialEventRun();
 ea0:	0e 94 cc 01 	call	0x398	; 0x398 <serialEventRun()>
 ea4:	de ce       	rjmp	.-580    	; 0xc62 <main+0x16e>

00000ea6 <__divmodhi4>:
 ea6:	97 fb       	bst	r25, 7
 ea8:	07 2e       	mov	r0, r23
 eaa:	16 f4       	brtc	.+4      	; 0xeb0 <__divmodhi4+0xa>
 eac:	00 94       	com	r0
 eae:	07 d0       	rcall	.+14     	; 0xebe <__divmodhi4_neg1>
 eb0:	77 fd       	sbrc	r23, 7
 eb2:	09 d0       	rcall	.+18     	; 0xec6 <__divmodhi4_neg2>
 eb4:	0e 94 89 07 	call	0xf12	; 0xf12 <__udivmodhi4>
 eb8:	07 fc       	sbrc	r0, 7
 eba:	05 d0       	rcall	.+10     	; 0xec6 <__divmodhi4_neg2>
 ebc:	3e f4       	brtc	.+14     	; 0xecc <__divmodhi4_exit>

00000ebe <__divmodhi4_neg1>:
 ebe:	90 95       	com	r25
 ec0:	81 95       	neg	r24
 ec2:	9f 4f       	sbci	r25, 0xFF	; 255
 ec4:	08 95       	ret

00000ec6 <__divmodhi4_neg2>:
 ec6:	70 95       	com	r23
 ec8:	61 95       	neg	r22
 eca:	7f 4f       	sbci	r23, 0xFF	; 255

00000ecc <__divmodhi4_exit>:
 ecc:	08 95       	ret

00000ece <__udivmodsi4>:
 ece:	a1 e2       	ldi	r26, 0x21	; 33
 ed0:	1a 2e       	mov	r1, r26
 ed2:	aa 1b       	sub	r26, r26
 ed4:	bb 1b       	sub	r27, r27
 ed6:	fd 01       	movw	r30, r26
 ed8:	0d c0       	rjmp	.+26     	; 0xef4 <__udivmodsi4_ep>

00000eda <__udivmodsi4_loop>:
 eda:	aa 1f       	adc	r26, r26
 edc:	bb 1f       	adc	r27, r27
 ede:	ee 1f       	adc	r30, r30
 ee0:	ff 1f       	adc	r31, r31
 ee2:	a2 17       	cp	r26, r18
 ee4:	b3 07       	cpc	r27, r19
 ee6:	e4 07       	cpc	r30, r20
 ee8:	f5 07       	cpc	r31, r21
 eea:	20 f0       	brcs	.+8      	; 0xef4 <__udivmodsi4_ep>
 eec:	a2 1b       	sub	r26, r18
 eee:	b3 0b       	sbc	r27, r19
 ef0:	e4 0b       	sbc	r30, r20
 ef2:	f5 0b       	sbc	r31, r21

00000ef4 <__udivmodsi4_ep>:
 ef4:	66 1f       	adc	r22, r22
 ef6:	77 1f       	adc	r23, r23
 ef8:	88 1f       	adc	r24, r24
 efa:	99 1f       	adc	r25, r25
 efc:	1a 94       	dec	r1
 efe:	69 f7       	brne	.-38     	; 0xeda <__udivmodsi4_loop>
 f00:	60 95       	com	r22
 f02:	70 95       	com	r23
 f04:	80 95       	com	r24
 f06:	90 95       	com	r25
 f08:	9b 01       	movw	r18, r22
 f0a:	ac 01       	movw	r20, r24
 f0c:	bd 01       	movw	r22, r26
 f0e:	cf 01       	movw	r24, r30
 f10:	08 95       	ret

00000f12 <__udivmodhi4>:
 f12:	aa 1b       	sub	r26, r26
 f14:	bb 1b       	sub	r27, r27
 f16:	51 e1       	ldi	r21, 0x11	; 17
 f18:	07 c0       	rjmp	.+14     	; 0xf28 <__udivmodhi4_ep>

00000f1a <__udivmodhi4_loop>:
 f1a:	aa 1f       	adc	r26, r26
 f1c:	bb 1f       	adc	r27, r27
 f1e:	a6 17       	cp	r26, r22
 f20:	b7 07       	cpc	r27, r23
 f22:	10 f0       	brcs	.+4      	; 0xf28 <__udivmodhi4_ep>
 f24:	a6 1b       	sub	r26, r22
 f26:	b7 0b       	sbc	r27, r23

00000f28 <__udivmodhi4_ep>:
 f28:	88 1f       	adc	r24, r24
 f2a:	99 1f       	adc	r25, r25
 f2c:	5a 95       	dec	r21
 f2e:	a9 f7       	brne	.-22     	; 0xf1a <__udivmodhi4_loop>
 f30:	80 95       	com	r24
 f32:	90 95       	com	r25
 f34:	bc 01       	movw	r22, r24
 f36:	cd 01       	movw	r24, r26
 f38:	08 95       	ret

00000f3a <__tablejump2__>:
 f3a:	ee 0f       	add	r30, r30
 f3c:	ff 1f       	adc	r31, r31
 f3e:	05 90       	lpm	r0, Z+
 f40:	f4 91       	lpm	r31, Z
 f42:	e0 2d       	mov	r30, r0
 f44:	09 94       	ijmp

00000f46 <abort>:
 f46:	81 e0       	ldi	r24, 0x01	; 1
 f48:	90 e0       	ldi	r25, 0x00	; 0
 f4a:	f8 94       	cli
 f4c:	0c 94 a8 07 	jmp	0xf50	; 0xf50 <_exit>

00000f50 <_exit>:
 f50:	f8 94       	cli

00000f52 <__stop_program>:
 f52:	ff cf       	rjmp	.-2      	; 0xf52 <__stop_program>
