Driving the SmartDisplay, first impressions


Results 1 to 10 of 10

Threaded View

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


    Did you find this post helpful? Yes | No

    Cool Nkk - is01dbfrgb

    OK, I think I've got it all turned around the right way now.
    And there's some options to flip it around different ways if it's not, so hopefully this should do it.

    I was asking about the USART, because it's possible to use it in Sychronous mode to drive the display really fast, but it only sends data LSB first so I needed to reverse the bit order in case you want to use it. But for now, let's stick with SHIFTOUT.

    Note: You MUST be assembling with MPASM. The default PM.exe will not work.<hr>
    There are 8 modes that are selectable at any time.
    Simply set the variable NKKmode to the mode number and update the display.
    See the mode examples in post #2. <hr>
    There are 5 commands for use with the NKK display.
    NKKclear&nbsp; - clears the screen
    NKKtext&nbsp;&nbsp; - write Text at a specified location
    NKKbyte&nbsp;&nbsp; - display a BYTE variable
    NKKword&nbsp;&nbsp; - display a WORD variable
    NKKupdate - Update the Display
    <hr>
    NKKclear
    This will clear the screen buffer in memory.
    Code:
    @   NKKclear                      ; clear the NKK screen buffer
    You must call NKKupdate for the changes to be seen.
    NKKtext (row, col, "Text")
    Displays a string of text at the specified location.
    Code:
    @   NKKtext (1,1,"RPM:")
    Above code displays RPM: at Row1 Column1.
    The end of each row wraps to the beginning of the next row. So you can actually fill the entire display with 1 command of 40 chars.
    Code:
    @   NKKtext (1,1,"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ=%$&")
    NKKbyte (row, col, width, justification, Variable)
    Displays a BYTE variable in a fixed width field, with leading zero blanking and left or right justification.
    Code:
    @   NKKbyte (1,3,3,right,ByteVar)
    The line above would display the value in ByteVar at Row1 Column3.
    The field size is 3 characters, and it will be Right justified with leading 0's blanked.
    Justification can be LEFT, RIGHT or ZEROS. Zeros will NOT blank the leading 0's.
    NKKword (row, col, width, justification, Variable)
    Displays a WORD variable in a fixed width field, with leading zero blanking and left or right justification.
    Code:
    @   NKKword (2,2,4,right,RPM)     ; Display RPM
    The line above would display the WORD value in RPM at Row2 Column2.
    The field width is 4 characters, right jusified.
    Justification can be LEFT, RIGHT or ZEROS. Zeros will NOT blank the leading 0's.
    NKKupdate - Update the Display
    This command does most of the work. It actually sends the screen to the display.
    The other commands only work on the character buffer.
    After they are done changing the buffer, call this to see them displayed.
    Code:
    @   NKKupdate                     ; Send data to the display
    <hr>
    There are 2 options available

    NKK_LSBFIRST
    This option reverses the bit order of each byte being sent.
    This would be useful when using the USART's synchronous mode.
    If using SHIFTOUT or the MSSP module. Do not use this option, and send all data MSB first.
    Code:
    DEFINE NKK_LSBFIRST
    NKK_REVERSED - Scans Left to Right
    This option makes a mirror image of the display.
    It's mainly there for me to debug with HyperTerminal.
    Code:
    DEFINE NKK_REVERSED
    <hr>

    This is a test program that I believe you should start with.
    You will need to fill in the NKKstartData: and NKKsendByte: subroutines with SHIFTOUT statements to interface with your display.
    Just follow the comments.
    Code:
    RPM   VAR WORD
    IPS   VAR WORD
    
    INCLUDE "NKK.pbp"
    
    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:
      ; *** 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
    You'll also need to turn on the backlight yourself.

    If all goes well, it should look something like this.

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3139" /><!-- Name:  RPM_Display.JPG
Views: 827
Size:  22.0 KB -->

    Download the NKK.pbp file below, and remove the .txt extension.
    Place it in your PBP folder. Usually c:\PBP. Or you can put it in the same folder as your main program file.

    The whole thing compiles to about 1400 words on a 16F, or 2600 bytes on an 18F.
    Good Luck!
    Attached Files Attached Files
    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