pilot0315pilot0315 Posts: 340
edited 2015-05-27 - 13:30:22 in Accessories
Any one have a simple spin only code to run this as an example???


  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2015-03-02 - 16:15:16
    I would recommend linking to the product page to improve your odds. =)
    Chris Savage | Engineering Tech | Main Office: (916) 624-8333 | Direct to Tech Support: (888) 997-8267 | Website | Twitter | Google+
  • pilot0315pilot0315 Posts: 340
    edited 2015-03-02 - 19:51:09
  • average joeaverage joe Posts: 795
    edited 2015-03-07 - 21:41:36
    I believe I may be able to help you. First, I would need to know more about the actual implementation. Parallel data interface? 8/16 bit? External memory. Propeller board? I have a few boards from the GUI thread still available if you don't already have a hardware implementation.

    Also, could you tell more about what you intend to display?


    Could you more to P1 forum please?
    I spent a minute looking at my own code by accident. I was thinking “What the hell is this guy doing?”
  • pilot0315pilot0315 Posts: 340
    edited 2015-03-09 - 06:56:12
    I am using the propeller chip on my own board and the quickstart. The problem that I am having is to port over the c code from newhaven. I am looking for simple examples sans assembly code so I can just get started and simply change the color on the display. Once I get that done I am sure I can work my way from there.
  • average joeaverage joe Posts: 795
    edited 2015-03-09 - 12:31:25
    This is the actual initialization code for the 7" SSD1963.
       VDP        long  479
       HDP        long  799
       HT         long  928
       HPS        long  46
       LPS        long  15
       VT         long  525
       VPS        long  16
       FPS        long  8
       HPW        long  48
       VPW        long  16
    PRI Start_SSD1963
        DisplayEnable                                       ' enable one or both displays
        Lcd_Write_Com ($00E2)                             ' //PLL multiplier, set PLL clock to 120M
        Lcd_Write_Data($0023)                             ' //N=0x36 for 6.5M, 0x23 for 10M crystal ' $21??
        Lcd_Write_Data($0002)                             '
        Lcd_Write_Data($0054)                             ' dummy byte?
        Lcd_Write_Com ($00E0)                             ' // PLL enable
        Lcd_Write_Data($0001)                             ' set pll             '
        pause1ms(1)                                      '
        Lcd_Write_Com ($00E0)                             ' pll                         '
        Lcd_Write_Data($0003)                             ' lock
        Lcd_Write_Com ($0001)                             ' // software reset
        Lcd_Write_Com ($00E6)                             ' //PLL setting for PCLK, depends on resolution
        Lcd_Write_Data($0003)                             '
        Lcd_Write_Data($00ff)                             '
        Lcd_Write_Data($00ff)                             '
        Lcd_Write_Com ($00B0)                              ' //LCD SPECIFICATION
        Lcd_Write_Data($0000)                             '
        Lcd_Write_Data($0000)                             '
        Lcd_Write_Data((HDP>>8)&$00FF)                    ' //Set HDP 'hps??
        Lcd_Write_Data((VDP>>8)&$00FF)                    ' //Set VDP 'vps??
        Lcd_Write_Com ($00B4)                             ' //HSYNC
        Lcd_Write_Data((HT>>8)&$00FF)                     ' //Set HT
        Lcd_Write_Data((HPS>>8)&$00FF)                    ' //Set HPS
        Lcd_Write_Data(HPW)                               ' //Set HPW
        Lcd_Write_Data((LPS>>8)&$00FF)                    ' //Set HPS
        Lcd_Write_Data(LPS&$00FF)                         '
        Lcd_Write_Data($0000)                             '
        Lcd_Write_Com ($00B6)                             ' //VSYNC
        Lcd_Write_Data((VT>>8)&$00FF)                     ' //Set VT
        Lcd_Write_Data((VPS>>8)&$00FF)                    ' //Set VPS
        Lcd_Write_Data(VPW)                               ' //Set VPW
        Lcd_Write_Data((FPS>>8)&$00FF)                    ' //Set FPS
        Lcd_Write_Data(FPS&$00FF)                         '
        Lcd_Write_Com ($00BA)                             '
        Lcd_Write_Data($0005)                             ' //GPIO[3:0] out 1
        Lcd_Write_Com ($00B8)                             '
        Lcd_Write_Data($0007)                             ' //GPIO3=input, GPIO[2:0]=output
        Lcd_Write_Data($0001)                             ' //GPIO0 normal
        Lcd_Write_Com ($0036)                              ' //rotation
        Lcd_Write_Data($0021)                              ' 3 is 180
        Lcd_Write_Com ($00F0)                             ' //pixel data interface
        Lcd_Write_Data($0003)                             ' 16 bit / 565
        Lcd_Write_Com ($0029)                              ' //display on
        Lcd_Write_Com ($00d0)                              ' //dynamic backlight
    PRI Displaycmd(c,d) ' instruction in one method
        Lcd_Write_Com(c) ' send out a word
    PRI Lcd_Write_Com(LCDlong)
        LCD_RS_low                               ' can do rs first then cs - better for latch board
    PRI Lcd_Write_Data(LCDlong)
        LCD_RS_High                              ' can do rs first then cs
    PRI LCD_Writ_Bus(LCDLong)
        'LCDLong &= %00000000_00000000_11111111_11111111    ' mask to a word. Not needed if care taken always to send a word value
        OUTA &= %11111111_11111111_00000000_00000000        ' set P0-P15 to zero ready to OR
        OUTA |= LCDLong                                     ' merge with the word to output
        LCD_WR_CS_Low                                          ' send out the data

    This will all need to change depending on the pin configuration
       OUTA &= %11111111_11110011_11111111_11111111         ' p18 low
    PRI LCD_WR_CS_High
       OUTA |= %00000000_00001100_00000000_00000000         ' p18 high
    PRI LCD_CS_Low
       OUTA &= %11111111_11110111_11111111_11111111         ' p19 low    
    PRI LCD_WR_Low
       OUTA &= %11111111_11111011_11111111_11111111         ' p18 low
    PRI LCD_WR_High
       OUTA |= %00000000_00000100_00000000_00000000         ' p18 high
    PRI LCD_CS_High                                         
       OUTA |= %00000000_00001000_00000000_00000000         ' p19 high  
    PRI LCD_RESET_Low                                       ' reset low
    PRI LCD_RS_Low                                          ' for historical reasons this subroutine calls another
    PRI LCD_RS_High
    Simplified draw, sets up area of display to draw to
    PUB Draw(x1, y1, x2, y2)                                ' sets the pixel to x1,y1 and then fills the next (x2-x1)*(y2-y1) pixels
          ifnot orientation                                ' landscape mode so swap x and y
            result :=x1                                       ' swap x1 and y1
            x1 := y1
            y1 := result
            result := x2                                      ' swap x2 and y2
            x2 :=y2
            y2 := result
    This will output a pixel to the display
    PUB Pixel(pixelcolor)               ' send out a pixel
         '' it is more efficent to send one Draw command then lots of pixels than sending individual pixels
         '' but of course, you can send draw x,y,x,y where x and y are the same and then send one pixel
       Lcd_Write_Fast_Data(pixelcolor) ' need to set RS high at beginning of this group (ie call Draw first)
    PRI Lcd_Write_Fast_Data(LCDlong)            ' write RS elsewhere then skip the RS above as this is a latch output and takes longer

    This will print the PropFont to the display
    PUB Propfont_out(ascii) | address,pixels
        Draw(curx,cury,curx+15,cury+31)                     ' location to start drawing 
        address := $8000 + (ascii >> 1) << 7                ' get rom address
        repeat 32                                           ' 32 rows per character, split in two parts
          pixels := long[address]                           ' get rom font data
          pixels := pixels >> (ascii & 1)                   ' shift for odd characters
          repeat 16 ' 16 columns
            if pixels & 1
              Pixel(%00000111_11100000)                     ' foreground color RRRRRGGG_GGGBBBBB
              Pixel(%00000000_00000000)                     ' background color 
            pixels := pixels >> 2                           ' alternate pixels interleaved so shift 2
          address += 4 
        curx +=16
        if curx > screenWidth                               ' new line   should be curx + 16 to align for next char.

    There's a bunch of stuff missing. Hopefully this will get you started! This is for 16-bit mode. If you are using 8-bit mode the initialization changes and I don't have a working 8-bit implementation at the moment.
    I spent a minute looking at my own code by accident. I was thinking “What the hell is this guy doing?”
  • pilot0315pilot0315 Posts: 340
    edited 2015-03-10 - 21:29:37
    thanks I will try this tomorrow.
  • Dr_AculaDr_Acula Posts: 5,482
    edited 2015-03-10 - 23:37:53
    I need to have a look at this project again. (I think some of that code might be stuff I wrote and it is hardware dependent). Fundamentally there are not enough pins on a propeller to drive these displays properly, and if you want the speed it is worth adding external ram chips (30ms to update a screen, vs about 30 seconds). I have an idea for a two propeller / two ram chip solution where the second propeller mainly does the address counting on the ram chips. I'll fire up Eagle in the next few days and see if I can get a schematic drawn.
    Answers: 1) A quadcopter. 2) Very high. 3) The internet. 4) A lot. 5) No.
  • average joeaverage joe Posts: 795
    edited 2015-03-11 - 11:44:22
    This is Dr A's code. The hardware dependence should all lie in the second code block. Except for PRI LCD_Writ_Bus(LCDLong). That second code block should be all that needs to be changed
    I spent a minute looking at my own code by accident. I was thinking “What the hell is this guy doing?”
  • Dr_AculaDr_Acula Posts: 5,482
    edited 2015-03-11 - 20:31:59
    This is a long thread On the last page is a new schematic idea that I think might be simpler than using all the 74xx counters.
    Answers: 1) A quadcopter. 2) Very high. 3) The internet. 4) A lot. 5) No.
  • pilot0315pilot0315 Posts: 340
    edited 2015-03-13 - 06:55:01
    I have used some of the code from
    Averag Joe I found it from an older post. All I get are funky lines. I have commented out the circles and squares so as to start with just
    one thing. Just get funky lines. I will post the arduino code that Newhaven sent me. It makes sense but somehow still not working.
    Thanks for the help will let y'all know.
  • average joeaverage joe Posts: 795
    edited 2015-03-13 - 12:25:19
    Funky lines... Sounds like my "screen freak"

    It's been a long time but, I remember I would have issues with this if /CS and /WR weren't toggled at the same time. Sounds like a timing issue...

    Do you have access to a Logic Analyzer?
    I spent a minute looking at my own code by accident. I was thinking “What the hell is this guy doing?”
  • average joeaverage joe Posts: 795
    edited 2015-03-17 - 02:08:38
    Without seeing the code you are using, I can't begin to guess what the problem is. BUT YOU HAVE LINES ON SCREEN!!! That means the display is at least initialized. Please post the code you are using! So step 1 is complete (initializing the display). Step 2 is getting pixels. To draw a full screen of solid color.
    draw(x,y) ' full screen

    Depending on several factors * 8 bit mode / 16 bit mode) you may need to change initialization settings. Without schematic, code, I would just be taking shots in the dark. It could be as simple as a bad PASM driver and we would end up chasing our tails for days...
    I spent a minute looking at my own code by accident. I was thinking “What the hell is this guy doing?”
  • pilot0315pilot0315 Posts: 340
    edited 2015-03-17 - 19:32:36
    Yes the screen is working. Yes to logic analyzer but have not had time to set it up.
    Work seven days a week.
    Will get back thanks for the help.
  • pilot0315pilot0315 Posts: 340
    edited 2015-03-17 - 19:34:15
    trying to port the newhaven code one to one to get it started on my own. I will post both codes soon.
  • pilot0315pilot0315 Posts: 340
    edited 2015-03-22 - 14:13:58
    I got this code from Ray's logic. I cut out some so I can figure it out. I would rather start with spin only the write PASM later.
  • pilot0315pilot0315 Posts: 340
    edited 2015-05-27 - 13:30:22
    I am having problems initiating this code. I get pixels to the left and black to the right. Have tried many combinations but not working well. I can change color and width but not get full screen. Solomon application note contradicts their manual. Nothing new.
  • made some progress. getting full screen but still not painting consistently. Used some akula code, thanks to him , and reviewed ray's logic but not painting well
  • What ended up happening with this project? Is there a 8-bit parallel (8080) of this SSD1963 driver?
  • I put it down for a while. Had to learn propeller C language. I am using the following devices: see attached
  • Are you using it as a C library? Or did you convert it? Can I take a look at it? I'm trying to get a SSD1963 driver together in SPIN and could see how it works.
  • What size display is this?
    I have some nice code for 4.3" now...
    Prop Info and Apps:
  • Rayman wrote: »
    What size display is this?
    I have some nice code for 4.3" now...

    Rayman thats exactly the size I am hoping to try out as well. 4.3" SSD1963, 8080 parallel.
  • I think pilot already referred to my code, but here it is:

    Toward the bottom of this pager are a bunch of examples.
    One is for 4.3" screen and one is for 5" screen with same resolution that pilot wants to do...

    These are both with 8080 8-bit connection to Prop.
    Also, they use 24-bit connection between SSD and LCD.

    You may have to tweak some of the timings, depending on your LCD.
    Also, you need to change Prop pin setting to match your setup.
    Prop Info and Apps:
  • I've been away for a while but I was able to fire up my board a couple days ago and get things sort-of running. As soon as I sort out some issues, hopefully I can help you track down some of yours. I have issues with initialization myself, as well as some improvements that need to be made. Since it seems like there are a few people using these displays with various hardware, I suggest we come up with some sort of low-level interface standards where a simple driver change can allow different hardware / display combos. Then, all higher level code can interface with a standard API that likely includes an SD object..

    I'm not really a C guy, although I've been forced to brush up on my essential skills. I'd like to explore running touch.spin through the interactive C tool. Going to download in a few.

    Still got 15 bare touchburger boards if anyone wants one. It's all through hole and fairly easy to source. I'll make it yours for the cost of shipping! Not trying to hijack your thread but I've been away for awhile. Kudos for sticking with it! Hopefully I can help out, I'm digesting the info you posted. Have my board live with a couple different displays (and even a PI+ official 7" touchscreen) and even have a few arduinos laying around to play with and blog up at some point. I'm focusing my development on 7" displays but it uses the same controller. So probably a couple register changes between the display... Now, if only the manual was correct. If you get stuck, look at the c code for the arduino. I found a misdocumented register but can remember exactly what.

    (I'm sure I'll be editing this later)

    I spent a minute looking at my own code by accident. I was thinking “What the hell is this guy doing?”
  • Thanks. I am getting better in c and will be back to it soon
Sign In or Register to comment.