buy hot The Fixer cool video Year One download Kasabian album nice Terminator Salvation hit cool track Jordin Sparks USA Whatever Works video download Check My Brain melodies nice video Finding Nemo nice Pop - Various Artists hit cheap DIVX Year One

digital-diy.com

Swordfish Tutorial - LCD Print E-mail
( 0 Votes )
  
Saturday, 04 April 2009 08:18

Swordfish has many built in libraries, one being "LCD.bas". This library allows seemingly easy control of LCD modules, and only requires a few declarations.

 

lcd_18F

 


Click here to see this circuit in action!

 

Note that the contrast resistor pot can be anything from 4.7K to 10K, and that the unused data lines on the LCD do not need to be tied to earth. Be sure to allow a small delay before sending data/commands to the LCD module on startup, as its microprocessor has to initialize as well. 150mS should be enough for most devices.

 

HEADS201


To make life even easier, you can solder pins to the LCD so that you can just 'insert' it into your breadboard


One thing to remember about LCD modules is to give them ~100-200ms to power-up. They run through their own initialization, and if you were to send data to it immediately, nothing would be displayed.

 

Device = 18F4520
Clock = 20
 
// some LCD options...
#option LCD_DATA = PORTD.4              // Assign the LCD connections
#option LCD_EN = PORTD.3                //
#option LCD_RS = PORTD.2                //
 
// import LCD library...
Include "LCD.bas"
Include "convert.bas"
Dim Variable As Word
 
// Start Of Program...
DelayMS(150)                            // Let the LCD warm up
LCD.Cls                                 // Clear the LCD screen
LCD.WriteAt(1,1,"Hello World")          // Send some text to the LCD
Variable = 0                            // Clear the "Variable" register
While True
    Inc(Variable)                       // Increment the "Var1" register
    // Convert to a string,
    //  and always display 5 characters   
    LCD.WriteAt(2,1,Convert.DecToStr(Variable,5))  
 
    DelayMS(1000)                       // Delay for 1 second                
Wend

 


 

 

Video Tutorials


Example of how to use Swordfish's LCD module

  • Explores the Swordfish LCD.bas Library
  • Covers pin configurations and contrast control
  • Explains some options for the LCD.bas Library

 

Video tutorial on how to Mod an LCD for breadboards and use them

  • Learn how to Mod a LCD for easy use with breadboards
  • I explain how to wire an LCD up and run a simple program to test it

 

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
Security
Please input the anti-spam code that you can read in the image.
Last Updated ( Friday, 24 April 2009 10:22 )