Driving the SmartDisplay, first impressions


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    Here is my compiled code.

    Code:
    @	__CONFIG _XT_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF &_BODEN_OFF
    
    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %10000010 ' Set PORTA analog and right justify
    CMCON = %00000111	'comparators off
    
    TRISC.3 = 0		'clock 
    TRISC.4	= 0		'chip select active low
    TRISC.5 = 0		'data
    
    RPM   VAR WORD
    IPS   VAR WORD
    clock	VAR	PORTC.3
    sdata	VAR	PORTC.5	
    
    INCLUDE "NKK.pbp"
    Include "modedefs.bas"
    
    shiftout clock,sdata,MSBFIRST,[$40]	'led color command
    shiftout clock,sdata,MSBFIRST,[%00111011]	'teal
    shiftout clock,sdata,MSBFIRST,[$41]	'led bright command
    shiftout clock,sdata,MSBFIRST,[%11111111]	'full bright
    
    Initialize:
        NKKmode = 6                   ; 4x5 mode
    @   NKKclear                      ; clear the NKK screen buffer
    @   NKKtext (1,1,"RPM:")          ; row 1, column 1
    @   NKKtext (3,1,"IPS:")          ; row 3, column 1
    @   NKKtext (4,2,"0.")            ; row 4, column 2
    
    ;----[ The Main Loop ]------------------------------------------------------
    Main:
    @   NKKword (2,2,4,right,RPM)     ; Display RPM
    @   NKKword (4,4,2,zeros,IPS)     ; Display IPS
    @   NKKupdate                     ; Send data to the display
        RPM = RPM + 10
        IPS = IPS + 2
        PAUSE 1000
    GOTO Main
    
    ;----[ Send Command to start Display Data Transfer ]------------------------
    NKKstartData:
    	shiftout clock,sdata,MSBFIRST,[$55]	'xfer data command
      ; *** this subroutine should send the $55 command ***
      
    RETURN
    
    ;----[ Send 1 byte to the NKK display ]-------------------------------------
    NKKsendByte:
    	shiftout clock,sdata,MSBFIRST, [1]
      ; *** this subroutine should send one byte at a time ***
      ; *** The byte to send is in the variable OutByte    ***
      ; *** Send the data MSB first                        ***
    
    RETURN
    What displays is 8 vertical lines, each 1 pixel wide. How many bytes should be sent in that last subroutine? Many thanks again for your time and help.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The shiftout in the NKKsendByte: routine is always sending a 1, not the data.

    I know I said to send 1 byte, but I didn't actually mean to send a 1.
    <br>
    DT

  3. #3
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    Code:
    @	__CONFIG _XT_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF  &_BODEN_OFF
    
    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %10000010 ' Set PORTA analog and right justify
    CMCON = %00000111	'comparators off
    
    TRISC.3 = 0		'clock 
    TRISC.4	= 0		'chip select active low
    TRISC.5 = 0		'data
    
    RPM   VAR WORD
    IPS   VAR WORD
    clock	VAR	PORTC.3
    sdata	VAR	PORTC.5	
    
    INCLUDE "NKK.pbp"
    Include "modedefs.bas"
    
    shiftout clock,sdata,MSBFIRST,[$40]	'led color command
    shiftout clock,sdata,MSBFIRST,[%00111011]	'teal
    shiftout clock,sdata,MSBFIRST,[$41]	'led bright command
    shiftout clock,sdata,MSBFIRST,[%11111111]	'full bright
    
    Initialize:
        NKKmode = 6                   ; 4x5 mode
    @   NKKclear                      ; clear the NKK screen buffer
    @   NKKtext (1,1,"RPM:")          ; row 1, column 1
    @   NKKtext (3,1,"IPS:")          ; row 3, column 1
    @   NKKtext (4,2,"0.")            ; row 4, column 2
    
    ;----[ The Main Loop ]------------------------------------------------------
    Main:
    @   NKKword (2,2,4,right,RPM)     ; Display RPM
    @   NKKword (4,4,2,zeros,IPS)     ; Display IPS
    @   NKKupdate                     ; Send data to the display
        RPM = RPM + 10
        IPS = IPS + 2
        PAUSE 1000
    GOTO Main
    
    ;----[ Send Command to start Display Data Transfer ]------------------------
    NKKstartData:
    	shiftout clock,sdata,MSBFIRST,[$55]	'xfer data command
      ; *** this subroutine should send the $55 command ***
      
    RETURN
    
    ;----[ Send 1 byte to the NKK display ]-------------------------------------
    NKKsendByte:
      ; *** this subroutine should send one byte at a time ***
      ; *** The byte to send is in the variable OutByte    ***
      ; *** Send the data MSB first                        ***
    
    RETURN
    Hope everyone enjoyed their time off this past week. Now back to coding

    Compiling the test program as above lights up the back light but nothing gets displayed. I tried defining the IPS and RPM vars with values in case that was the problem but nothing changed. Any ideas?

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Guess my hint didn't work too well.

    Put this line in the NKKsendByte: subroutine.
    Code:
    	shiftout clock,sdata,MSBFIRST, [OutByte]
    DT

  5. #5
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    Doh, it was pretty much spelled out for me. Everything works but I had to change the NKKsendByte: to LSBFIRST because it was garbled. Again many thanks and let me know where to send the case of beer

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Thumbs up

    Great! I'm glad you got it working.

    I'd REALLY like to have that BEER. But it always seems to go FLAT after shipment through Email.

    If you have a camera, I'd love to see a picture of the display working.
    Maybe next to your thumb, or a coin or something.

    Best regards,
    DT

Similar Threads

  1. Driving a SmartDisplay? (NKK)
    By astouffer in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st December 2008, 16:26
  2. Problem driving a laser pointer
    By Louis Cimon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd June 2008, 14:49
  3. Replies: 1
    Last Post: - 1st May 2008, 05:07
  4. driving APR6008
    By mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th December 2006, 18:37
  5. Driving a logic-level HEXFET
    By thelightbrain in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th November 2004, 23:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts