Shop OBEX P1 Docs P2 Docs Learn Events
LED Display with PT6961 chip — Parallax Forums

LED Display with PT6961 chip

I found a display module from a DVD player. It is a LiteOn module model LTM-0305BM. I've tried
to write my own spin code for it from the spi.spin from obex, but not successfully. I also found the code for this chip
only its for a BS2. Can someone steer me in the right direction?
The PT6961 chip has a STROBE pin instead of CS and it's got me stumped.
I am fairly new to spin so go easy on me. Thanks

Comments

  • JonnyMacJonnyMac Posts: 9,104
    edited 2018-04-11 00:18
    Looking at the data sheet

    -- http://pdf1.alldatasheet.com/datasheet-pdf/view/391689/PTC/PT6961.html

    ...the STB line seems to behave like a CS line: it goes low before the transaction and is raised after.
  • Jammer7071Jammer7071 Posts: 17
    edited 2018-04-11 01:12
    Yes I seen that...
    From what I can tell Strobe goes High to send a command byte then low for a data byte.
    I just can't seem to get the timing right.
    The SPI object sets CS low for the duration. I tried to go thru the code from the BS2 and
    convert it to spin, but I'm not understanding the process as spin is new to me.
    Thanks for you help

    This is the code I'm trying to convert
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    EN PIN 0 ' enable
    CLK PIN 1 ' clock
    DOUT PIN 2 ' data out
    digit VAR Byte
    b VAR Byte
    phrase VAR Byte
    idx VAR Word
    char VAR Byte
    x VAR Nib
    disp0 DATA $3f
    DISP1 DATA $06
    DISP2 DATA $5b
    DISP3 DATA $4f
    DISP4 DATA $66
    DISP5 DATA $6d
    DISP6 DATA $7d
    DISP7 DATA $07
    DISP8 DATA $7f
    DISP9 DATA $6f
    DISP10 DATA $77
    DISP11 DATA $7c
    DISP12 DATA $58
    DISP13 DATA $5e
    DISP14 DATA $79
    DISP15 DATA $71
    DIRA = 15
    START:
    idx = 0
    LOOKUP (phrase - 0),
    [disp0,disp1, disp2, disp3, disp4,disp5, disp6,disp7, disp8,disp9, disp10,disp11, disp12,disp13, disp14,disp15], idx
    PAUSE 1
    GOSUB SET
    GOSUB SETWRITE
    GOSUB CLEAR
    GOSUB DMAX
    GOSUB COUNT15
    GOTO start
    'set display TO 6×12 segments
    SET:
    EN = 0
    SHIFTOUT DOUT, CLK, LSBFIRST, [$02]
    EN = 1
    RETURN
    'set TO writing mode, auto increment address after DATA WRITE
    SETWRITE:
    EN = 0
    SHIFTOUT DOUT, CLK, LSBFIRST, [$40]
    EN = 1
    RETURN
    'clear 8 bytes of the display RAM – This will get rid of weird looking symbols
    CLEAR:
    EN = 0
    SHIFTOUT DOUT, CLK, LSBFIRST, [$C0] 'This is the RAM address
    FOR x = 1 TO 8
    SHIFTOUT DOUT, CLK, LSBFIRST, [$00] 'This writes 0 TO RAM
    NEXT
    EN = 1
    RETURN
    'display ON, MAX brightness
    DMAX:
    EN = 0
    SHIFTOUT DOUT, CLK, LSBFIRST, [$8F]
    EN = 1
    PAUSE 10
    RETURN
    'COUNT through 0-9-a-f
    COUNT15:
    FOR b = 0 TO 15
    READ idx ,char
    EN = 0
    SHIFTOUT DOUT, CLK, LSBFIRST,[$C0,char,$C2,char,$C4,char,$C6,char]' reads idx of data starting at 0 to f
    EN = 1
    DEBUG ? idx , CR
    idx = idx + 1 ' <<< I put this line below shiftout so it will read 0 instead of starting with 1
    PAUSE 1000
    NEXT
    RETURN
  • This is what I have so far...
    {Object_Title_and_Purpose}
    
    
    CON
            _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
            _xinfreq = 5_000_000
    
            datpin = 7
            clkpin = 8
            stbpin = 9
               
    VAR
    
      
       
    OBJ
      SPI      : "Spi_spin.spin"
      
    PUB Strt 
      spi.start(15,1)
    
           Disp[0]   :=  $3F
           Disp[1]   :=  $06
           Disp[2]   :=  $5B 
           Disp[3]   :=  $4F
           Disp[4]   :=  $66
           Disp[5]   :=  $6D 
           Disp[6]   :=  $7D
           Disp[7]   :=  $07
           Disp[8]   :=  $7F
           Disp[9]   :=  $6F 
           Disp[10]  :=  $77 
           Disp[11]  :=  $7C
           Disp[12]  :=  $58
           Disp[13]  :=  $5E
           Disp[14]  :=  $79
           Disp[15]  :=  $71
    
     
       
        stbhigh
     repeat 
          set
          setwrite
          clear
          dmax
          count15
      
          
    
    PUB set  
                 stblow 
                 spi.SHIFTOUT(datpin, clkpin, SPI#LSBFIRST, 8, $02)
                 stbhigh
                 
                 return
    PUB setwrite 
                stblow 
                spi.SHIFTOUT(datpin, clkpin,  SPI#LSBFIRST, 8, $C0)
                stbhigh
    
                return
    PUB clear
                stblow 
                spi.SHIFTOUT(datpin, clkpin,  SPI#LSBFIRST, 8, $00)
                stbhigh
              
                return 
    PUB dmax
    
               stblow 
               spi.SHIFTOUT(datpin, clkpin,  SPI#LSBFIRST, 8, $8F)
               stbhigh
                  
                 return
    
    Pub count15  | x
                 
        
              repeat x from 0 to 15
                stblow
                 spi.SHIFTOUT(datpin, clkpin,  SPI#LSBFIRST, 8, disp[x])
                      
                     
    
    
              return
              
    pub stblow
      dira[stbpin]~~ 
      outa[stbpin]~ 
         return
    
    pub stbhigh
      dira[stbpin]~~ 
      outa[stbpin]~~ 
         return
    
    
    
    
    
    DAT
        disp      byte 0[16]
    



    When I load this to ram I get segments on then after about 2 seconds
    it goes blank again. when loaded to eeprom the display remains on
  • I think I know the problem but can't find it.
    There is something in my code resetting the propeller.....
    When loaded to eeprom the segments stay on but flash about twice a second.
  • Never mind. I found the problem.
    Thanks for the help.
  • Jammer,
    It might be useful to others if you shared what the problem was.
    Jim
  • It was my usb to serial adapter. for some reason it was sending the dtr signal twice.
Sign In or Register to comment.