Search This Blog

Powered by Blogger.

Translate

Moving Message Display On LCD

Moving-message displays are ideal to get your message (advertisements, greetings, etc) across in an eye-catching way. You can make an LCD show a brief moving message by interfacing it to a microcontroller.

Here’s an AVR-based moving-message display that uses a 16×2 LCD display incorporating HD44780. The 16×2 LCD can display 16 characters per line and there are two such lines.

Circuit description
Fig. 1 shows the circuit for AVR ATmega16-based moving-message display on an LCD. It consists of an ATmega16 microcontroller, a 16×2 LCD, an SPI6 connector and a power supply section.
 

Fig. 1: Circuit for AVR microcontroller-based moving-message display on the LCD
To derive the power supply for the circuit, 230V AC mains is stepped down by a 9V, 250mA secondary transformer, rectified by bridge rectifier module BR1A and filtered by capacitor C1. The voltage is regulated by a 7805 regulator. LED1 glows to indicate the presence of power in the circuit. The regulated 5V DC powers the entire circuit including SPI6 connector.

Port-C pins PC4 through PC7 of the microcontroller (IC2) are connected to data lines D4 through D7 of the LCD. The LCD control lines—read/write (R/W), register-select (RS) and enable (E)—are connected to PD6, PC2 and PC3 of IC2, respectively.

Why AVR microcontroller? AVR is faster and more powerful than 8051 microcontroller, yet reasonably cheaper and in-circuit programmable. Most AVR development software are free as these are Open Source. Moreover, discussions and tutorials on the AVR family of processors are available on the Internet.

ATmega16 is a high-performance, low-power 8-bit AVR microcontroller. It has 16 kB of in-system self-programmable flash, 1 kB of internal SRAM, 512 bytes of EEPROM, 32×8 general-purpose working registers and JTAG Interface (which supports programming of flash, EEPROM, fuse and lock bits).

Some of the on-chip peripheral features are:
1. Two 8-bit timers/counters with separate pre-scaler and compare modes
2. One 16-bit timer/counter with separate pre-scaler, comparator and capture modes
3. Four pulse-width-modulation channels
4. 8-channel, 10-bit analogue-to-digital converter
5. Byte-oriented two-wire serial interface
6. Programmable serial USART
7. Master/slave serial peripheral interface
8. Programmable watchdog timer with separate on-chip oscillator

LCD display module 
The project uses a Hitachi HD44780-controlled LCD module. The HD44780 controller requires three control lines and four or eight input/output (I/O) lines for the data bus. The user may choose to operate the LCD with a 4-bit or 8-bit data bus. If a 4-bit data bus is used, the LCD will require a total of seven data lines—three lines for sending control signals to the LCD and four lines for the data bus. If an 8-bit data bus is used, the LCD will require a total of eleven data lines—three control lines and eight lines for the data bus.

The enable control line is used to tell the LCD that the microconroller is sending the data to it. To send data to the LCD, first make sure that the enable line is low (0). When other control lines are completely ready, make enable pin high and wait for the LCD to be ready. This time is mentioned in the datasheet and varies from LCD to LCD. To stop sending the data, bring the enable control low (0) again. Fig. 2 shows the timing diagram of LCD control lines for 4-bit data during write operation.

When the register-select line is low (0), the data is treated as a command or special instruction (such as clear screen and position cursor). When register-select is high (1), the text data being sent is displayed on the screen. For example, to display letter ‘L’ on the screen, register-select is set to high.

When the read/write control line is low, the information on the data bus is written to the LCD. When read/write is high, the program effectively queries (or reads) the LCD. This control command can be implemented using ‘C’ programming language.

For 4-bit interface data, only four bus lines (D4 through D7) are used for data transfer. Bus lines D0 through D3 are disabled. The data transfer between HD44780 and the microcontroller completes after the 4-bit data is transferred twice.

Fig. 2: Timing diagram of LCD control lines for 4-bit data during write operation

Controlling a standard numeric LCD is not that difficult. To display text on the LCD, correct library files for the LCD are needed. Many LCD libraries are available on the Internet, which are used in various applications. You may get confused which library is suitable for your application.

Libraries for LCDs found in AVRLIB library occupy unnecessary program memory space. To solve the problem, you can write your own library for LCD control.

Software program
This project demonstrates sending the text to the LCD controller and scrolling it across the LCD. For the project, AVR Studio 4 and WINAVR software need to be installed in your PC. Three program codes are used here—movm.c, lcd2.c and lcd2.h. The movm.c contains the text message to be scrolled on the LCD. lcd2.c and lcd2.h are the library files. The programming technique given here may not be the best as it uses a simple logic, but it works pretty fine.

The LCD library for 4-line or 4-bit mode operation is used here. Each pin connected to the LCD can be defined separately in the lcd2.h code. The LCD and AVR port configurations in the C code along with comments are given below:

#define LCD_RS_PORT LCD_PORT
LCD port for RS line
#define LCD_RS_PIN 2               
PORTC bit 2 for RS line 
#define LCD_RW_PORT PORTD    
Port for RW line
#define LCD_RW_PIN  6             
PORTD bit 6 for RW line
#define LCD_E_PORT LCD_PORT  
LCD port for enable line
#define LCD_E_PIN 3                 
PORTC bit 3 for enable line

Enable control line. The E control line is used to tell the LCD that the  instruction for sending the data on the data bus is ready to be executed. E must always be manipulated when communicating with the LCD. That is, before interacting with the LCD, E line is always made low. The following instructions toggle enable pin to initiate write operation:

/* toggle enable pin to initiate  
write * /  
static void toggle_e(void)   
{    
 lcd_e_high();  
 lcd_e_delay(); 
 lcd_e_low();  
}    

The complete subroutine of this code can be found in lcd2.c.

The E line must be left high for the time required by the LCD to get ready for receiving the data; it’s normally about 250 nanoseconds (check the datasheet for exact duration).

Busy status of the LCD. It takes some time for each instruction to be executed by the LCD. The delay varies depending on the frequency of the crystal attached to the oscillator input of the HD44780 as well as the instruction being executed.

While it is possible to write the code that waits for a specific amount of time to allow the LCD to execute instructions, this method of waiting is not very flexible. If the crystal frequency is changed, the software needs to be modified. Additionally, if the LCD itself is changed, the program might not work even if the new LCD is HD44780-compatible. The code needs to be modified accordingly.

The delay or waiting instruction can be implemented easily in C language.

In C programing, the delay is called using the delay( ) function. For instance, delay(16000) command gives a delay of 16 milliseconds.

Initialising the LCD. Before using the LCD, it must be initialised and configured. This is accomplished by sending a number of initialisation instructions to the LCD.

In WINAVR GCC programming given here, the first instruction defines the crystal frequency used in the circuit. This is followed by a standard header file for AVR device-specific I/O definitions and header file for incorporating program space string utilities. The initialisation steps in movm.c file are as follows:

#define F_CPU 16000000  
#include 
#include 
#include 
#include “lcd2.h”  
#define RATE 250 
Clearing the display. When the LCD is first initialised, the screen should automatically be cleared by the HD44780 controller. This helps to clear the screen of any unwanted text. Clearing the screen also ensures that the text being displayed on the LCD is the one intended for display. An LCD command exists in ‘Assembly’ to accomplish this function of clearing the screen. Not surprisingly, the AVR GCC function is flexible and easy to implement.
Refer the code given below:
lcd_init(LCD_DISP_ON);      
lcd_clrscr();                     
Here the first line is for LCD initialisation (turn on the LCD) with cursor ‘off.’ The second line clears the display routine to clear the LCD screen.
Writing text to the LCD. To write text to the LCD, the desired text is put in the memory using the char string[ ] function as follows:
char string[] PROGMEM=”WECOME TO 
ELECTRONICS FOR YOU – NEW DELHI”; 
The program makes this text scroll on the first line and then the second line of the LCD. The speed of scrolling the text on the LCD screen is defined by “# define RATE 250” in the beginning of the movm.c code. To start with, first the LCD screen is cleared and then the location of the first character to appear on the screen is defined. Getting the text from the program memory and then scrolling it on the LCD screen continuously is achieved using the following code:
while(j<=(len-1))  
    {    
        lcd_clrscr();  
        lcd_gotoxy(0,0); 

        for(k=0,i=j;(k<16) && ( pgm_  
        read_byte(&string[i])!=’\0’  
        );k++,i++)   
        {  
          lcd_putc(pgm_read_  
          byte(&string[i]));  
        }   

        WaitMs(RATE);  
        j++;  
    }  
Compiling and programming. Compiling the movm.c to generate the movm.hex code is simple. Open AVR Studio4 from the desktop and select new project from ‘Project’ menu option. Select AVR GCC option and enter the project name. Next, select ‘AVR Simulator’ and click ‘Ok’ button.
First, copy the three codes (movm.c, lcd2.c and lcd2.h) to your computer. Import the movm.c and lcd2.c files into ‘Source Files’ option on the left side of the screen. Next, import the lcd2.h file into ‘Header Files’ option. Select the device as ATmega16 and tick the box against ‘Create Hex’ option in the project configuration window. Now click ‘Rebuild All’ option in ‘Build’ menu. If the code is compiled without error, the movm.hex code is generated automatically under ‘Default’ folder of the project folder.

To burn the hex code into ATmega16, any standard programmer supporting ATmega16 device can be used. There are four different AVR programming modes: 

1. In-system programming (ISP)
2. High-voltage programming
3. Joint test action group (JTAG) programming
4. Program and debug interface programming
Here two options for burning the hex code in standard ISP mode are explained. Some AVR tools that support ISP programming include STK600, STK500, AVRISP mkII, JTAGICE mkII and AVR Dragon. There are also many other AVR programming tools available in the market.
PonyProg2000 software. This software along with programmer circuit is available from www.lancos.com/prog.html website. After installing PonyProg2000, select the device family as AVR Micro and device type as ATmega16. Now in ‘Setup’ menu, select ‘SI Prog’ I/O option for serial programmer and COM port from ‘Interface Setup’ option. In ‘Security and Configuration Bits’ option, configure the bits as shown in Fig. 3. Next, open the device file (hex code) and click ‘Write All’ option to burn the chip.
Frontline TopView software. This software along with programmer board is available from www.frontline-electronics.com website. After installing the software, select COM port from ‘Settings’ menu. In ‘Device’ menu, select the device as ATmega16. Burn the hex code into the chip by clicking ‘Program’ option. Note that the microcontroller uses a 16MHz externally generated clock. Program the fuse bits in the software by selecting upper and lower bytes as follows:
Fuse low byte = EF 
Fuse high byte = C9 
If the fuse bits are not configured properly, the text will scroll slowly or text scrolling may not function properly even if the scrolling rate in the code is changed. The SPI6 connector allows you to program the AVR using SPI adaptor in ISP mode.


Fig. 3: Screenshot of configuration and security bits option


Fig. 4: An actual-size, single-side PCB for the moving-message display on an LCD using AVR microcontroller

Click here to view/download a
n actual-size, single-side PCB for the moving-message display on an LCD using AVR microcontroller.


Fig. 5: Component layout for the PCB

Click here to view/download component layout for the PCB.


Construction and testing

An actual-size, single-side PCB for the moving-message display using AVR is shown in Fig. 4 and its component layout in Fig. 5. Before mounting the AVR onto the PCB, ensure proper power supply to the circuit. Program the AVR as mentioned above, insert it into the PCB and power-‘on’ the circuit. The text will scroll from right to left in the first line and then in the second line of the LCD, repeatedly. If there is any problem in the display, press reset switch S1 momentarily. If there is no message display at all, vary the contrast-control preset (VR1) until the text is visible on the LCD.

SOurce: EFY

Android Applications For Electronics And Electrical Engineers

The world around us is changing at a much faster pace than any one can anticipate. The world of “computing” has already seen great shifts from Desktops to Notebooks to Smartphones and Tablets. The coming decade will be more focused on mobile computing and cloud computing. Here in this article, I am listing some of the best and really useful applications released in Android market (aka Google Play), that comes handy for any one who is working in Electrical and Electronics industries/professions. 
Best and Free Android Applications for Electronics and Electrical Engineers
ElectroDroid – is the most popular and useful application in Android market for an electronics engineer. This app is a collection of many simple and useful tools like Resistor color code calculator, Filter value calculator, Inductor color code calculator, SMD resistor code calculator,  LED resistor calculator etc. The App also has a great collection of pin out diagrams of USB port, Parallel port, Ethernet port, VGA connector, Firewire connector etc and other resources and references which lists PIC micro controller database, ISP specs of AVR and PIC, Circuit schematic symbol reference, ASCII table references, Battery references etc.  This application has been downloaded by more than 10,000,00 smart phone devices and has been rated by more than 30,000 users. If you are looking for a much better version of the app without ads, you can buy it from the Google Play store (Electrodroid Pro) for less than 3 USD
Best and Free Android Applications for Electronics and Electrical Engineers
EveryCircuit - is a simple and beautiful application for android which helps you to build and simulate circuit ideas. It has a really good & simple user interface which begins with a workspace where you can start building your circuits. You can add your components like resistors, capacitors, inductors, power sources, signal sources etc and wire them together to complete the circuit. You can alter the values of each and every component and then finally Run/Simulate them. You will see the current flow, input and output waveforms graphically represented etc when you run the circuit you have built. You can alter the component values in real time and see the changes in output instantly. Additionally the app developers have provided a set of built in circuit applications like inverting amplifier, rectifier circuits, voltage regulator etc which the user can simulate instantly to learn the working of these circuits. The attractive feature is the graphical representation (animation) of the electron flow, input and output signals which helps the user to understand the circuit functioning within no time.  Their free version doesn’t have a large work space area, which limits the number of components you can play with. They also have limited their component library in their free application. I think they have deliberately done this to promote their paid application –EveryCircuit Premium – which they sell for around 10 USD. They have sold more than 10,000 apps in Play store, which shows people are quiet interested in their appI suggest you try their Free app first and if you like it, go ahead and buy the premium version.
Best and Free Android Applications for Electronics and Electrical Engineers
PartSeeker – is an app for searching electronic parts and components. Unfortunately this app is a paid one and the good side is that you can buy it for less than 2 USD. This app is made and released by the same company (IERO) which made ElectroDroid (see above) app. IERO has made this app by using the extensive component library of Octopart (the electronic component search engine). This app comes handy while you are away travelling and is keen to search for a component using your mobile device (may be smart phone or a tab!). 
Best and Free Android Applications for Electronics and Electrical Engineers
PIC Microdatabase - another free app from IERO, which integrates well with ElectroDroid app. This app is nothing more than a database of PIC micro controllers manufactured by Microchip. This app lists all PIC and dsPIC family of controllers in an easy to use user interface. Features and specifications of all controllers along with pinout diagrams of select ones are available. The most attractive feature is a search functionality in which you can search for a controller with particular features you would like to have.As an example you can search for controller from PIC that belongs to a particular PIC family like PIC 10, with specific EPROM values, specific RAM, USB 2.0 or higher, specific internal oscillator values  etc. The app will output all PIC controllers that matches your search criterias. So far more than 10,0000 users have downloaded this application.
Best and Free Android Applications for Electronics and Electrical Engineers
DroidTesla – is another free app for simulating electronic circuits. This SPICE simulation tool is quiet similar to the app “EveryCircuit” mentioned above in its functionality - means you can build and simulate a circuit. But they both (EveryCircuit and DroidTesla) differ in user interface and features provided. I found the free version of “EveryCircuit” much more appealing than DroidTesla. EveryCircuit has certain predefined circuits like halfwave rectifier, inverting amplifier etc which you can simply load to workspace and simulate in realtime. DroidTesla has given a list of examples in their free app version but none of them loads properly to workspace. The reason is most of the example circuits contain a particular component which may be available only on DroidTesla’s commercial version. User interface of  EveryCircuit is much better than that of DroidTesla. DroidTesla’s commercial version might be much better than EveryCircuits premium version, as DroidTesla has large set of component library to choose from. DroidTesla will definitely outshine EveryCircuit – if the number of component libraries available is taken into account. Both of the apps commercial versions are priced competitively. If “user interface” is your primary preference, I will recommend EveryCircuit premium. On the other hand, if number of component library is your first preference, I shall recommend DroidTesla commercial version
ElectronicsToolKit – is another free app which is a collection of simple tools like resistor color code calculator, series and parallel calculator etc. Almost all those tools are available in ElectroDroid app too, except for a Power Triangle calculator. I have listed this app here as it is free (and I have spent some time to download and test this app in my Galaxy) and you guys can try out, if you have time.More than 10,000 users have tried this application.
Best and Free Android Applications for Electronics and Electrical Engineers
AllDataSheet App – This app is free version of the Datasheet website Alldatasheet.com. This app is nothing more than a book mark to alldatasheet website’s mobile version. I dont recommend you to download this app as your purpose will be served by visiting Alldatasheet.com from your mobile browser (which will get automatically redirected to mobile version) 
EquivalentResistanceSolver – is another free app which helps you to calculate the equivalent resistance of a circuit. This app may not be that useful for a professional as the “user interface” is average. It takes lots of time to build a “Series-Parallel” combination. Might be handy for students who are learning about the concepts for the first time. 
RF Pad Calculator – is a free app that helps to calculate the resistor values required to build an RF attenuator. 
AmpliCalc - is a simple and free app to calculate inverting and non inverting operational amplifier values.
FilterCalc – is another free app from the same developer of Amplicalc, which helps to realize filter design by finding the appropriate values. 
ControlCalc – is yet another free app from the same developer of Amplicalc, which helps in simulating closed and open systems, calculate transfer functions, state response & you can save the output as PNG. 
M32 Assembly – is another interesting application which helps you to learn assembly language by yourself. This app infact is a simulator for the M32 processor.
Electronica – is another app which is open source (the source code of this app is available for free download). This app is also a collection of simple and easy to use tools that comes handy for an every day electronics enthusiast/professional or even a student.   
There are a handful of other free android applications like Ohms Law calculator, 555 Timer Calculator which I have not mentioned here. The reason is simple, most of the “electronics tools apps like ElectroDroid, Electronica, ElectronicsToolsKit etc has Ohms Law calculation, Resistor Colourcode calculation and 555 Timer calculator embedded in them!

Source:Circuitstoday.com

Page Rank

google pagerank

Write For Us

Submit a Guest Post

Find us on Facebook

Categories

555 Timer IC 7 segment Display 8051 Project AC Circuits Adafruit Alarms Amplifier Circuits Analog Circuits android Arduino arm processor Assembly Languange Atmel Atom Size Audio Circuits augmented reality Automotive Circuits avr Battery Circuits Bicycle Gurad bluetooth Cable TV Circuits Cambridge University Camera Technology Circuit Boards Clipping And Clamping Circuits Clocking And Timer Circuits Computing contact lens Contact Us Form Contests Controller Circuit Conversion Circuits Counter Circuits Digital Electronics diy circuits Downloads EFY EFYTimes Electronic Books Electronic Components Electronic Locks And Keys Engineering Fan Circuits Filter Circuits Fire Alarm free Frequency Fun And Game Circuits future Google Hack n Mod Ham Radio Circuits heart rate monitoring High Voltage Circuits Home Circuits IC Guide ieee Industrial Circuits Infrared Instructables Inventions ipad lcd Led Circuits Light Related Lighting Circuits Medical Circuits Meter Clocks Microcontrollers Microprocessors Mini Projects modules Movie maker NatGeo Navigation Notice Optical Fiber PC Circuits PCB Boards Physics pnp transistor Power Supplies Printing Projects Programmer Project Ideas Projectors Protection circuits Proximity Detectors Radar Radio Circuits Radio Transmitters Raspberry Raspberry Pie Remote Circuits Retis Lab RFID Robot Cars Robotics Science Science Alert Security And Safety Sensor Circuits Servo Motors Smallest Smartwatches sms Software solar cell sound application Spectram Switch Technology News Telephone Related Television Related Test And Measurement Circuits Thermal Projects Tone generator circuits Touch Screen Tutorials Wearables Wi-Fi Wireless
Like us on Facebook
Follow us on Twitter
Recommend us on Google Plus
Subscribe me on RSS