Swordfish Basic

LCD Commands scrolling text

A very structured and modular approach to PIC programming. Also known as SF.

LCD Commands scrolling text

Postby bitfogav » Mon Dec 06, 2010 11:34 am

Thought I would share some LCD commands that I cant seem to find in the LCD.bas on Swordfish..

For a recent project of mine I wanted to scroll the screen of the LCD either Right or Left so the text will scroll across the screen..

Here are some commands I added:
Code: Select all
Public Const                   
cmdDisplayRight = %00011100,
cmdDisplayLeft = %00011000


So when I wanted to make the screen scroll I just called the command like this:
Code: Select all
Command(cmdDisplayLeft)




Full code can be found here:
Code: Select all
// Device and Clock
Device = 18F452
Clock = 20
                               
// LCD optional settings
#option LCD_DATA = PORTC.4   // LCD setup data port (sets it to 4 data lines only)
#option LCD_RS = PORTE.0         
#option LCD_EN = PORTE.1
 
// Modules
Include "LCD.bas"           // include LCD module

// LCD special Commands to shift LCD screen left and right.
Public Const                   
cmdDisplayRight = %00011100,
cmdDisplayLeft = %00011000

// Delay for LCD and Ports setup
DelayMS(200)                  // Allow LCD to warm up               
ADCON1 = $07                  // Make all pins digital I/O's - check datasheet

TRISA = %111111     // Make PORTA all inputs 
TRISB = %11111111   // Make PORTB all inputs
TRISC = %00000000   // Make PORTC all outputs         
TRISD = %00000000   // Make PORTD all outputs
TRISE = %000        // Make PORTE all outputs


// clear LCD before we start and then write our data
LCD.Cls                    // Clear the LCD screen


// Main Program Here.
While true                 // Main program loop that is multi-tasked   

        LCD.WriteAt(1,2,"Hello World!")   // Send text to the LCD screen
        Command(cmdDisplayLeft)           // Scrolls the text left along LCD
        DelayMS(380)                      // delay to display the text on the LCD
Wend
____________________________________________________________________
www.bitfogav.com
www.bradsprojects.com
____________________________________________________________________

For this message the author bitfogav has received thanks: 2
be80be, RogerTango
User avatar
bitfogav
Enthusiast
Enthusiast
 
Posts: 262
Joined: July 2010
Location: United Kingdom
Has thanked: 31 times
Have thanks: 43 times

  • Similar topics
    Replies
    Views
    Author

Return to Swordfish Basic

  • In total there are 2 users online :: 1 registered, 0 hidden and 1 guests (based on recent activity)
  • Most users ever online was 179 on Wed Jan 04, 2012 3:31 pm
  • Users browsing this forum: Bing [Bot] and 1 guests