spi top speed

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

mstone, you're hardware talents are obviously far more advanced than mine. i will think long and hard about your suggestions, but i cannot promise to fully comprehend all the implementation details. there is a reason i had to wait for microcontrollers to get cheap and easy to program before i got into electronics. one possible hindrance may be the top speed of the lpd8806 chips in my led strip. the datasheet is in chinese but there are tables in it containing the imminently english readable glyphs "20MHz."

for now i'm going to try is to see if i can load avr-gcc-4.6 and if maybe that will compile my code correctly. may also start a separate thread seeking help fooling the compiler into generating code that works.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

here's a kludge. got rid of the while loop. added a relative jump at the end of the assembly code to the top of the existing loop minus 8 bytes which is where the ldi instructions that initialize registers for my code live. this makes my test code work and demonstrates that i can write really fast to the led strip with only one latch byte, (the zero byte that terminates the test_data string). yay, me.

now to see if i can display something two dimensional on this thing.

Code: Select all

#include <avr/pgmspace.h>       // definitions or keeping constants in program memory

const unsigned char test_data [] PROGMEM = {
    "\200\377\377\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  // 24
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  // 48
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  // 72
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  // 96
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  //120
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  //144
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  //168
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  //192
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"  //216
    "\200\377\200\377\200\200\200\200\377\200\200\200"
    "\200\377\200\377\200\200\200\200\377\200\200\200"
};

void setup () {
  DDRB = 0x2c;                                  // SCK, MOSI & SS output for spi
  DDRD  = 0x01;
  SPCR = (1 << MSTR) | (1 << SPE);		// enable, master, msb first
						// polarity and phase = 0
						// clock = fosc / 4
  SPSR = (1 << SPI2X);				// oops, clock = fosc / 4 / 2
  
  TCCR0B = 0;					// stop timer0
  asm volatile ("\n"
"L_%=: lpm __tmp_reg__,Z"	"\n\t"
	"adiw %0,1"	"\n\t"
	"out %2,__tmp_reg__"	"\n\t"
	"nop"		"\n\t"
	"nop"		"\n\t"
	"nop"		"\n\t"
	"nop"		"\n\t"
	"nop"		"\n\t"
	"nop"		"\n\t"
	"nop"		"\n\t"
	"nop"		"\n\t"
	"sbiw %1,1"	"\n\t"
	"brne L_%="	"\n\t"
        "rjmp L_%=-8" "\n\t"
	:
	: "z" (&test_data), "r" (sizeof(test_data)), "I" (_SFR_IO_ADDR(SPDR))
	); 
}

void loop (void) {
  while (1);
}

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: spi top speed

Post by adafruit_support_mike »

mtbf0 wrote:mstone, you're hardware talents are obviously far more advanced than mine.
I think I just hurt myself laughing. ;-)

An old saying I learned as a programmer applies to hardware as well: "a guru is someone two pages ahead of you in the manual."

Stepping back from the details a little, the situation you're describing suggests you'll find better results in a hardware solution than in code. You're working in a range where you have very little elbow room.. you can't test your code by slowing it down because the problems you're trying to solve don't exist at lower speeds. On the flip side, the solutions you can test at lower speeds don't work at the speed you need.

IMO, you'll be better off with a solution where you can test things at low speed, then crank up the 'go faster' knob until it gives you the performance you want. Ideally, you'll want to hit your performance target when the 'go faster' knob is at about 50%. It's much easier to make systems work when they work the same way (and correctly) well below and well above the range you want.

In this case, there's a hard limit to how fast the Arduino can flip a single pin HIGH and LOW. Rather than fighting to squeeze the last few percent out of that single pin, my suggestion is to use eight pins at once.. eight times as many pins flipping at a quarter the rate still gives you twice the bandwidth.

If your LED strips have a limit of 20MHz, you only have to run your 8-pin parallel output at 2.5MHz to stay afloat. If you can move faster than that (the Arduino probably can), you have headroom to do extra stuff between pin flips.

The part that connects 8 Arduino pins moving at 2.5MHz and an LED strip SPI bus running at 20MHz is a parallel-to-serial chip.. and I completely spaced out when suggesting the '165, because the 74*597 is far more popular in the geek world. The '597 is the sister-chip to the much loved 74*595 serial-to-parallel chip.

Once you have the basic pieces and values.. Arduino @ 2.5MHz, '165 (or '597), SPI bus @ 20MHz, "collect 8 bits in parallel, shift them out serially, then stop", the rest of the design process is just a matter of asking, "okay, what do I need to make this part right here work?" until you run out of questions. If you're a programmer (clearly yes), you shouldn't have too many problems because it's all just boolean logic and a bit of timing. Figure out how to describe the chips in code, make the system work there, then translate the ideas back into wires and chips.

One trick I didn't mention last time, but which ties back to the whole 'headroom' theme: if you need to run the SPI bus at 20MHz, use a clock running at 40MHz (at least), then divide that down to 20MHz. It sounds silly at first, but you can use the extra pulses to do things that should happen between ticks of the 20MHz clock.. load data into the shift buffer, reset the bit counter, etc. If you need more steps between 20MHz ticks, just make the master clock faster. Binary counters (each bit flips half as fast as the one before it) are cheap and easy to use.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

[email protected] wrote:I think I just hurt myself laughing. ;-)
sorry about that. i'm going to stick with the software approach for now, because i'm pretty sure it will work and it's friday and i don't have any high speed parallel to serial shift registers lying around or any idea as to how to go about clocking them if i did.

and i do have some headroom for the software approach, since my arduino has two spi interfaces. using both would involve either interlacing my data for two halves of an image, (a horrific pain in the ass), or just chopping the image in half and slowing things down a tick or two to swap values in the z register which is the only thing on the chip that can address program memory. actually there are a couple of wasted cycles in the loop now. i didn't use the available post increment on the z register in the lpm instruction so i could use the adiw because i was feeling self conscious about all the nops and thought it would be nice to replace a couple of them with a 2 cycle instruction. how's that for stupid?

so i think i could manage things with dual spi interfaces and still have a cycle to waste.

Code: Select all

label:  lpm     r0,z+
        out     SPDR,r0
        movw    r17,r30
        movw    r30,r19
        lpm     r0,z+
        out     UDR0,r0
        movw    r19,r30
        movw    r30,r17
        nop
        sbiw    r24,1
        brne    label
ok. just thinking out loud. back to playing around. vacation's over on tuesday.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: spi top speed

Post by pburgess »

Keep in mind what I said about driving multiple sub-strips in parallel. Bandwidth would be roughly the same as the parallel-to-serial shift register, 'cept without the extra hardware. Just a bit annoying to set up, is all...the bytes would need to be packed in a "sideways" format (I'd preprocess this with a script rather than having the Arduino do it live).

Give it a go with your unrolled SPI stuff first though. Because it may be perfectly good, and you know what they say about premature optimization. :)

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

gdmfsob. that's my mantra by the way...

i have every confidence that the hardware is capable of pushing the data out to the strip, but it's proving to be impossible to get gcc to generate the code i need. i pretty much have to inline a few lines of assembler in order to get the timing right, but if i put that code inside a loop, the compiler messes up the loop code and jumps to an address within the code i've placed within the loop. this may be one of the shortest sketches i've ever written, but between wierd code generation and obscure diagnostic messages it's proving impossible to do.

gdmfsob. must stay centered...

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

ok. this is almost fast enough. this uses 78 leds. violent head shakes allow me to just make out the image. it's just the word "Hey!" rendered three times in red, green and blue. part of the problem may be that i live in an incredibly small space. it's possible that if i hang the lights out the window and view them from across the street the image would be easier to make out.

i wrote the code in c and just let the compiler do its thing, then started adding nops until the image appeared. the compiler generated code is not what i would have written, but it does come in under the minimum time to get the display working so i guess it's all good.

Code: Select all

#include <avr/pgmspace.h>       // definitions or keeping constants in program memory
//
//	hey, hey, hey
//

#define IMAGE_HEIGHT 235
#define IMAGE_WIDTH 48

const unsigned char image_data[] PROGMEM = {

  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\377\200\200\377\200\200\200\200\200\377\200\200\377\200"
  "\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\200\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\377\200\200\377\200\200\200\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200"
  "\200\200\200\377\200\200\377\200\200\200\200\200\377\200\200\377\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200\200\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\200\200\200\377\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200"
  "\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\377\200\200\377\200\200\200\200\200\377\200\200\377"
  "\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377\200"
  "\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200"
  "\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\200\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\377\200\200\377\200\200\200\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200"
  "\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200\200"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200"
  "\200\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200"
  "\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\377\200\200\377\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\377\200\200\377\200\200\200\200\200\200\200\200\377\200\200\377"
  "\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377\200\200\377"
  "\200\200\377\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"
  "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\000"
  };

void setup () {
  DDRB = 0x2c;					// SCK, MOSI & SS output for spi
  DDRD  = 0x01;
  SPCR = (1 << MSTR) | (1 << SPE);		// enable, master, msb first
						// polarity and phase = 0
						// clock = fosc / 4
  SPSR = (1 << SPI2X);				// oops, clock = fosc / 4 / 2
  TCCR0B = 0;					// stop timer0
}


void loop (void) {
  const unsigned char* foo;
  unsigned int width;
  unsigned int height;
  foo = image_data;
  width = IMAGE_WIDTH;
  do {
    height = IMAGE_HEIGHT;
    do {
      SPDR = pgm_read_byte(foo++);
      asm ("\n\t"
      "nop" "\n\t"
      "nop" "\n\t"
      "nop" "\n\t"
      "nop" "\n\t"
      "nop" "\n\t"
      ::);
    } while (height--);
  } while (width--);
}
well, i had to cut down the width of the image in order to get the post under 60000 characters. tomorrow i'll reduce the height to about 60 pixels as per phil's calculation of the maximum to make it viewable.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: spi top speed

Post by pburgess »

BANNED!

Yeah, generally the bigger the saccadic display, the more distance you need...it's an angular resolution thing. You can stick it in another room or down a hallway, as long as you have a clear shot of the thing. And try darting your eyes instead of a whole head. Less momentum.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

pburgess wrote:Keep in mind what I said about driving multiple sub-strips in parallel. Bandwidth would be roughly the same as the parallel-to-serial shift register, 'cept without the extra hardware.
hey, phil, is this what you did with the parallel displays you were showing at maker faire?
pburgess wrote:Just a bit annoying to set up, is all...the bytes would need to be packed in a "sideways" format (I'd preprocess this with a script rather than having the Arduino do it live).
up to now i've been preprocessing my data by hand, which is really annoying to set up. make an image in the gimp, diddle the colors so that each byte has its high bit set, make sure the image is a multiple of 6 pixels tall so that when i save it as a c language source file, (damn, that's a handy feature!), the columns will break at line endings, rotate the image so the bottom is at the left and save as c source. then edit the file to add a zero byte to the top of each column and clean it up a little.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: spi top speed

Post by pburgess »

mtbf0 wrote:hey, phil, is this what you did with the parallel displays you were showing at maker faire?
Essentially, yes. Though this was motivated by physical wiring rather than any I/O bottleneck. Each pin of PORTD is connected to one of 8 sets of shift registers. The sketch is spending most of it's time in delay() between frames.
up to now i've been preprocessing my data by hand, which is really annoying to set up.
My Processing code for converting bitmaps for the parallel display is posted in this thread: http://forums.adafruit.com/viewtopic.php?f=47&t=27657
You could probably massage that to work with color images.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

-ok. got a week off coming up. ought to be able to stay awake long enough to get something done.

so i got one of these. it's an avr, so it uses the same instruction set as an arduino. it runs at 32MHz, twice as fast as an arduino which means that spi can run at 16MHz. the chip as an external memory bus and the board has 8Mb, (no that's not a typo), of sdram installed. the chip has 8 usarts, 4 i2c and 4 spi ports, 16 16 bit adc pins connected to 2 multiplexors, 2 2 channel dacs, 8 16 bit timers, plus an rtc, and 24 hardware pwm channels. unfortunately, not everything is brought out. oh yeah, there are 128Kb of program memory and 8Kb of sram on the chip.

ports c and f are brought out to 10 pin headers. these expose 4 usarts, 2 i2c and 2 spi ports and 12 pwm channels. porta is brought out to its own 10 pin header exposing 8 16 multiplexed adc inputs. another 10 pin header brings out 8 more pins from a couple of different ports. there are a thermister and light sensor on the board attached to pins 0 and 1 of portb, and an op amp and speaker connected to another pin on portb exposing one of the dacs. there are 8 buttons, (some of which share pins with one of the headers) and 8 bicolor leds connected to porte. there are also a couple of unpopulated pads for dataflash devices which probably expose another spi port. there is also one of atmels 32 bit chips onboard to provide a usb interface through one of the usarts. apparently it's also physically connected to i2c and spi ports, though these are not supported in firmware. it also provides the programming interface using atmels flip protocol, about which i know approximately nothing.

the xmega provides a a more rationalized register layout so that register sets for peripherals can be accessed as c language structs. there are many more registers for digital io. in addition to data direction and port registers the are set, clear and toggle registers. pins have internal pullups and pull downs and a bunch of features that i don't understand at all. inverted i/o, i get, but if anyone can explain what totem pole, wired and, wired or and bus keeper do, i'd love to be enlightened.

oh, yeah. $30 buys it.

speed. price. memory. i'll only use a fraction of its capabilities, but it looks to be just what i need.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: spi top speed

Post by mtbf0 »

forgot to mention dma. the atxmega128a1 has a four channel dma controller. although it cannot be used with the spi peripherals, it can be used with the usarts in spi mode. usarts in spi mode are master mode only, but master mode is what i need. maybe i can run four saccadic displays simultaneously. might suffer some contention on the memory bus, but since on the mega168 the spi transfer seems to take 18 cycles there might still be time for everyone to get their data.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”