Shop OBEX P1 Docs P2 Docs Learn Events
Generating a clock signal (SPI) — Parallax Forums

Generating a clock signal (SPI)

VeekayVeekay Posts: 2
edited 2014-05-24 14:59 in Learn with BlocklyProp
I have a Quick Start and I'm using it to power one of these:
http://www.adafruit.com/products/358

I started with arduino but it wasn't fast enough to draw to the screen so I'm trying this.

Using shift_out or a c version(below) I get very slow drawing. 2-3 seconds to write a frame out.
I found this old post that seems to be about correct
http://forums.parallax.com/showthread.php/79001-shiftout-speed
void write2(uint16_t b)
{
  for (uint8_t i=0; i < 16; ++i) 
  {
    if(b & 0x0001)
      high(SDA);
    else
      low(SDA);
    high(SCLK);
    low(SCLK);


    b >>= 1;
  }

}
When I tried just using square_wave on the clock pin I found out the screen can support a very high data rate.
I setup the pins to send frame data and then this:
square_wave(SCLK,0,100000000);
while(1)
{
  low(SDA);
  pause(250);
  high(SDA);
  pause(250);
}
This has the screen change from all black to all white by reading the data pin, and writing across the entire memory. It does this blindly fast.
Another option is to set another square_wave on the data pin with a different freq to get some interesting snow effects. So I know the screen can do it.

So what I'm wondering is how (or where I can find out) to generate a faster usable clock signal. If I need to learn SPIN that's okay, I just need to know that I need to learn it. I can read sample SPIN code though.

Any help would be great, thanks!

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-05-24 10:06
    Spin will likely be slower than C. I sounds like you really need a PASM driver for this display.

    I'm using this code for an OLED display. Maybe you could modify the SPI PASM driver to work with your screen?
  • VeekayVeekay Posts: 2
    edited 2014-05-24 14:59
    Very interesting. I might. I'm looking into it now. Thank you
Sign In or Register to comment.