Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

selecting right LCD display

Status
Not open for further replies.
Hi,

The 'standard' lcd is a 16 x 2 character parallel lcd with a HD44780 compatible controller that uses standard logic voltages, typically +5v, they are cheap and common place.
Would suggest you start with one of these simpler displays before attemping the larger Graphic modules.

From your recent posts I'm not sure what complier you are using etc, but if you are using assembler then why not use ETs own tutorial guru where he gives full hardware and software details
 
using swordfish

do not need graphics
going to display the muzzle velocity of air cannon then blank for few seconds then display muzzle energy or projectile energy.
helping a good friend build an air cannon for a High School competition next year.
need to hit targets at 30, 60, and 90 yards
points awarded for accuracy, innovation, distance after the target competition.
with a PIC/LCD to determine velocity etc then its just a matter of doing some testing to determine where the projectile (baseballs) will land.
a wind speed input would add to the data. that's in the planning stages after I get the basic unit working.
just need a numeric LCD display. nothing fancy
 
code so far for a chronograph

written in swordfish
lots of notes to remember what I need to add or subtract
Code:
Device = 18F452
Clock = 40
Config OSC = HSPLL // NEED TO REVISE

Include "USART.bas"
Include "convert.bas"

Dim
    TMR1IE As PIE1.0,              // TMR1 Interrupt Enable
    TMR1IF As PIR1.0,              // TMR1 Interrupt Flag
    TMR1ON As T1CON.0,             // TMR1 Count Enable
    Timer1 As TMR1L.AsWord,        // A quick way of creating a Word Alias
    Signal1 As PORTC.0,            // Define the signal pin
    Signal2 As PORTC.1,            // Define the second signal pin
    //add second signal pin
    Overflow As Byte,              // Capture overflowsA   
    Time As LongWord               // A variable for calculating total time

Const   
    TMR1StartVal = 8,              // User defined TMR1 starting value
    TMR1ReloadVal = 11,            // The TMR1 reload value
    nSperIncrement = 100           // Number of nS per TMR1 increment

Sub TMR1_Initialize()
    TMR1ON = 0                 // Disable TMR1
    TMR1IE = 0                 // Disable TMR1 Interrupts
    TMR1IF = 0                 // Clear the TMR1 Interrupt Flag
    T1CON.1 = 0                // 1 = External clock from pin RC0/T1OSO/T1CKI (on the rising edge)
                               // 0 = Internal clock (FOSC/4)
    'TRISC.0 = 1               // If External clock, then set clock as an input
    'T1CON.2 = 1               // 1 = Do not synchronize external clock input
                               // 0 = Synchronize external clock input
                               // When T1CON.1 = 0;
                               //   this bit is ignored.
    T1CON.4 = 0                // 11 = 1:8 prescale value
    T1CON.5 = 0                // 10 = 1:4 prescale value
                               // 01 = 1:2 prescale value...
                               // 00 = 1:1 prescale value
    Timer1 = TMR1StartVal      // Fill the Timer register with a starting value
End Sub


// Start Of Main Program...
SetBaudrate(br38400)
Overflow = 0                          // Clear overflows
TMR1_Initialize                       // Setup TMR1
Input(Signal1)                        // Make Signal1 an input
Input(Signal2)                        // Make Signal2 an input
//input signal2---second sensor
While True
    While Signal1 = 0                 // Wait for a fresh cycle
    Wend                              //
    While Signal1 = 1                 // CHECKS FOR SIGNAL 1
    Wend                              //
   
    TMR1ON = 1                        // Begin clocking time
    Repeat   
        If TMR1IF = 1 Then            // Check for TMR1 overflow
            TMR1ON = 0                // Disable TMR1
            TMR1IF = 0                // Clear the TMR1 Interrupt           
            Timer1 = TMR1ReloadVal    // Reload a new start value (includes non-counted cycles while disabled)
            TMR1ON = 1                // Enable TMR1
            Inc(Overflow)             // Increment the overflow capture variable
        EndIf
    
    Until Signal2 = 1                 // Repeat until the signal2 pin goes high 
    // change to until signal2 = 1
    TMR1ON = 0                        // Stop clocking time
   
    // Calculate the total time in nS & display via USART
    Time = (Timer1 + (Overflow * 65535)) * nSperIncrement
    USART.Write(Convert.DecToStr(Time)," nS",13,10)   
   
    // Reset variables
    Overflow = 0
    Timer1 = TMR1StartVal   
Wend
 
From my understanding there are 2 ways of driving a LCD, parallel and serial.
Parallel takes what, 4 lines to control and maybe a bit more code.
Serial takes one line to control and is more straightforward in the code department.

I have only ever used a serial LCD, as my coding is done in Basic.
For parallel, you can drive the display directly and serial needs a driver, I have posted the link to the drivers I use above.
 
Last edited:
Serial LCDs are in general more expensive. If you have the pins to spare, there is no good reason not to use a parallel interface. The 4-bit mode only requires 6 or 7 pins.
 
I have never used a serial LCD, only parallel. It seems with serial LCD's, you simply send ASCII data serially and it get displayed. That seems to make them limited in functionality, if you can't initialise them and use the full command set. But as I say, I've never used one,
 
I have never used a serial LCD, only parallel. It seems with serial LCD's, you simply send ASCII data serially and it get displayed. That seems to make them limited in functionality, if you can't initialise them and use the full command set. But as I say, I've never used one,

Oh you can do all that, depending on the driver, the link I posted above you use a ? preceding any command, to print a ? just send 2 ??...:)
 
getting more lost

different driver types?
ks0066
hitachi???
spl????
I understand the hitachi driver is perfered or the standard??
 
The Hitachi (or clones) are quiet popular, easy to find and cheap. The one you linked from that surplus site would be perfect, you can find MANY code examples of how to interface to it, if you're lucky you may even find a C library that you can just plug and play to use. They have a handfull of programmable characters so you can do simple graphics like bar graphs small logo's are mini animations if you update it fast enough.
 
Now, there are some IC, which can convert the HD44780 LCD to serial port. You only need output the strings, which can immediatly disply on LCD. and If you want fully control the LCD, you can enter another mode. The IC is DFL-D44780, if you use GRAPHIC LCD such as KS108, The IC is DFL-KS108, You can get details on About Dafulai
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top