Quantcast
Channel: LCD Projects - PIC Microcontroller
Viewing all 253 articles
Browse latest View live

How to create custom characters on 16×2 LCD using PIC18F4550

$
0
0

The 16×2 character LCD can also be used to display custom characters other than numerals, alphabets & special characters. Refer LCD interfacing with PIC. Some special shapes like hearts, arrows, smileys etc. can easily be displayed on the 5×8 pixel pattern of character LCD. These shapes are first stored at a special location in LCD’s controller and then displayed on the LCD module. This procedure has been explained here by using PIC18F4550.

The special characters are generated by bit-mapping of LCD’s 5×8 bit pixel matrix. Refer Creating custom characters on LCD using 8051 for more details on bitmap generation and storing custom values in custom generator (CG) RAM of LCD’s controller. 

The mikroC IDE provides LCD Custom Character tool to create the bitmap of user defined custom character. (Also see Working with mikroC) To create the bitmaps using this tool, following steps are to be followed:

1. Go to Tools -> LCD Custom Character

How to create custom characters on 16×2 LCD using PIC18F4550

LCD Custom Character” title=”Screenshot Of MikroC IDE screen with Tools menu -> LCD Custom Character” />

2. Select 5×7 + cursor line font and start filling the pixels in the matrix by clicking on them to create a custom character. The following figure depicts the generation of heart shape’s bitmap.

Heart shape’s bitmap Generated on MikroC IDE Screen with PIC18F4550

3. After creating the character and click on GENERATE button. A window will appear containing the bitmap values of designed custom character as highlighted in the following figure.

Bitmap Values Of Designed Custom Character in MikroC IDE

4. These bitmap values can now be used in the code.

Bitmap Values used in Code for creating custom Character in PIC

The bitmap values of a custom character are stored in CGRAM of LCD controller module. The CGRAM can store up to 8 custom characters’ bitmaps. For more details, refer Custom character display using 8051. The addresses of CGRAM where bitmaps are stored are shown in the following table.
 
ASCII Code
Base Address
0
64
1
72
2
80
3
88
4
96
5
104
6
112
7
120

 

 The following programming steps are used to store the bitmap values into CGRAM and display the corresponding custom character on LCD. An example is also given at the end to understand the code and concept.
 
 
Programming Steps:
·            Select the base address of CGRAM where the bitmap values are to be stored. This address is sent as command instruction (RS=0).
·            After the address, the bitmap values are sent one by one as data (RS=1).
·            Next the LCD location is sent where the character is to be displayed.
·            The corresponding ASCII value of the base address of the CGRAM is sent to print the stored character. This is sent as data value (RS=1).
 
The above steps are integrated into a single function special_char() which makes it easier to display the custom characters on LCD.
void special_char(unsigned char cgram_loc, unsigned char lcd_loc, unsigned char *data)
{
unsigned int j=0;
          lcdcmd(cgram_loc);         // sends location of CGRAM
          while(j<8)
          {
                    lcddata(data[j]);      // sends bitmap values of the character
                    j++;
          }
          lcdcmd(lcd_loc);           // sends LCD location where the character is to displayed
          lcddata((cgram_loc-64)/8); //ASCII value of corresponding base address.
 
}
 
If a data array value[] (containing bitmap values) is to be stored at CGRAM location 64 (base address), and is to be displayed at 0x82 location on LCD (i.e., first line, third column); then the above function is called as follows.
 
special_char(64,0×82,value);

Project Source Code

###

// Program to display custom characters on 16×2 LCD using PIC18F4550 Microcontroller

// Configuration bits
/* _CPUDIV_OSC1_PLL2_1L, // Divide clock by 2
_FOSC_HS_1H, // Select High Speed (HS) oscillator
_WDT_OFF_2H, // Watchdog Timer off
MCLRE_ON_3H // Master Clear on
*/

//LCD Control pins
#define rs LATA.F0
#define rw LATA.F1
#define en LATA.F2

//LCD Data pins
#define lcdport LATB

void lcd_ini();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void special_char(unsigned char, unsigned char, unsigned char *);
unsigned char data1[]={10,21,17,17,17,10,4,0}; // Bitmap values of “heart” shape
unsigned char data2[]={12,18,1,2,4,8,0,8};
unsigned char data3[]={1,3,5,9,9,11,27,24};
unsigned int i=0;

void main(void)
{
TRISA=0; // Configure Port A as output port
LATA=0;
TRISB=0; // Configure Port B as output port
LATB=0;
lcd_ini(); // LCD initialization
special_char(64,0×82,data1); // Function call to store “Heart” shape’s bitmap at 64th base address
// and print it at 0x82 location on LCD
Delay_ms(1000);
special_char(72,0×84,data2);
Delay_ms(1000);
special_char(80,0×86,data3);
}

void special_char(unsigned char cgram_loc, unsigned char lcd_loc, unsigned char *data)
{
unsigned int j=0;
lcdcmd(cgram_loc); // Send location of CGRAM
while(j<8)
{
lcddata(data[j]); // Send bitmap values of the character
j++;
}
lcdcmd(lcd_loc); // Send LCD location where the character is to displayed
lcddata((cgram_loc-64)/8); // ASCII value of corresponding base address
}

void lcd_ini()
{
lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5×7 font
lcdcmd(0x0C); // Display On and Cursor Off
lcdcmd(0x01); // Clear display screen
lcdcmd(0x06); // Increment cursor
lcdcmd(0x80); // Set cursor position to 1st line, 1st column
}

void lcdcmd(unsigned char cmdout)
{
lcdport=cmdout; //Send command to lcdport=PORTB
rs=0;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

void lcddata(unsigned char dataout)
{
lcdport=dataout; //Send data to lcdport=PORTB
rs=1;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

###

Circuit Diagrams

Circuit Diagrams. 1

Project Components

Project Video

Source: How to create custom characters on 16×2 LCD using PIC18F4550

The post How to create custom characters on 16×2 LCD using PIC18F4550 appeared first on PIC Microcontroller.


How to display text on 16×2 LCD using PIC18F4550 Microcontroller

$
0
0

Several automated and semi-automated devices require a message to be displayed in order to indicate their working status. In continuation to LCD interfacing with PIC18F4550, this article explains how to display a message or string on a 16×2 character LCD.

Programming steps:
·         Configure the LCD.
·         Store a string in a character array.
unsigned char data[20]=“EngineersGarage”;
·         Run a loop till the loop counter encounters the null character ‘’ of the string.
·         Use lcddata() function to send individual character values of the string to be displayed on LCD. 

Code:

while(data[i]!=’’)
    {
        lcddata(data[i]);   
        i++;
        Delay_ms(300);
    }

Project Source Code

###

// Program to display text on 16×2 LCD using PIC18F4550 Microcontroller

// Configuration bits
/* _CPUDIV_OSC1_PLL2_1L, // Divide clock by 2
_FOSC_HS_1H, // Select High Speed (HS) oscillator
_WDT_OFF_2H, // Watchdog Timer off
MCLRE_ON_3H // Master Clear on
*/

//LCD Control pins
#define rs LATA.F0
#define rw LATA.F1
#define en LATA.F2

//LCD Data pins
#define lcdport LATB

void lcd_ini();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
unsigned char data[20]=”EngineersGarage”;
unsigned int i=0;

void main(void)
{
TRISA=0; // Configure Port A as output port
LATA=0;
TRISB=0; // Configure Port B as output port
LATB=0;
lcd_ini(); // LCD initialization
while(data[i]!=”)
{
lcddata(data[i]); // Call lcddata function to send characters
// one by one from “data” array
i++;
Delay_ms(300);
}

}
void lcd_ini()
{
lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5×7 font
lcdcmd(0x0C); // Display On and Cursor Off
lcdcmd(0x01); // Clear display screen
lcdcmd(0x06); // Increment cursor
lcdcmd(0x80); // Set cursor position to 1st line, 1st column
}

void lcdcmd(unsigned char cmdout)
{
lcdport=cmdout; //Send command to lcdport=PORTB
rs=0;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

void lcddata(unsigned char dataout)
{
lcdport=dataout; //Send data to lcdport=PORTB
rs=1;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

###

Circuit Diagrams

Circuit Diagrams 3

Project Components

Project Video

Source: How to display text on 16×2 LCD using PIC18F4550 Microcontroller

The post How to display text on 16×2 LCD using PIC18F4550 Microcontroller appeared first on PIC Microcontroller.

How to interface LCD with PIC18F4550 Microcontroller

$
0
0

The character LCDs are the most commonly used display modules. These LCDs are used to display text using alphanumeric and special characters of font 5×7/5×10. For basic working and operations of a character LCD, refer LCD interfacing with 8051. Here PIC18F4550 has been used to display a single character on a 16×2 character LCD.

For basic details and operations of character LCD, refer LCD interfacing with 8051. Here LCD has been interfaced in 8-bit mode* with data pins (D0-D7) connected to PortB of PIC18F4550. The LCD control pins RS, R/W and EN are connected to PortA pins RA0, RA1 and RA2 respectively.

*Character LCD can also be interfaced by using only 4 data lines. Refer LCD interfacing in 4-bit mode.
  
Programming Steps:
Before displaying anything on LCD, it needs to be configured with proper instructions. The following programming steps explain the procedure of configuring the LCD and display a character on it.
 
Step 1: Initialize the LCD.
The LCD must be initialized the by following pre-defined commands of character LCD.
·         0x38, to configure the LCD for 2-line, 5×7 font and 8-bit operation mode
·         0x0C, for Display On and Cursor Off
·         0x01, to Clear Display screen
·         0x06, to increment cursor
·         0x80, to set cursor position at first block of the first line of LCD.
 
The above set of commands is written in lcd_ini() function of the adjoining code.
 
Step 2: Send the commands to LCD.
·         Send the command byte to the port connected to LCD data pins
·         RS=0, to select command register of LCD
·         RW=0, to set the LCD in writing mode
·         EN=1, a high to low pulse to latch command instruction
·         Delay of 1ms
·         EN=0
 
The above set of commands is written in lcdcmd(unsigned char) function.
 
Step 3: Send data to LCD.
·         Send data at the port which connected to LCD data pins
·         RS=1, register select to select data register of LCD
·         RW=0, this set the LCD in writing mode
·         EN=1, a high to low pulse to latch data
·         Delay of 1ms
·         EN=0
 
The lcddata(unsigned char) function has the above set of instructions.
 
Step 4: Display character on LCD.
The functions lcdcmd() and lcddata() are user-defined functions. They are used to send a character (E in this case) to be displayed on LCD.
 
lcdcmd(0x38);             // send command 0x38 to LCD
lcddata(‘E’);                // send character E to LCD

Project Source Code

###

// Program to interface 16×2 LCD and display single character using PIC18F4550 Microcontroller

// Configuration bits
/* _CPUDIV_OSC1_PLL2_1L, // Divide clock by 2
_FOSC_HS_1H, // Select High Speed (HS) oscillator
_WDT_OFF_2H, // Watchdog Timer off
MCLRE_ON_3H // Master Clear on
*/

//LCD Control pins
#define rs LATA.F0
#define rw LATA.F1
#define en LATA.F2

//LCD Data pins
#define lcdport LATB

void lcd_ini();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
unsigned int i=0;

void main(void)
{
TRISA=0; // Configure Port A as output port
LATA=0;
TRISB=0; // Configure Port B as output port
LATB=0;
lcd_ini(); // LCD initialization
lcddata(‘E’); // Print ‘E’
Delay_ms(1000);
lcdcmd(0x85); // Position 1st Line, 6th Column
lcddata(‘G’); // Print ‘G’

}
void lcd_ini()
{
lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5×7 font
lcdcmd(0x0C); // Display On and Cursor Off
lcdcmd(0x01); // Clear display screen
lcdcmd(0x06); // Increment cursor
lcdcmd(0x80); // Set cursor position to 1st line, 1st column
}

void lcdcmd(unsigned char cmdout)
{
lcdport=cmdout; //Send command to lcdport=PORTB
rs=0;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

void lcddata(unsigned char dataout)
{
lcdport=dataout; //Send data to lcdport=PORTB
rs=1;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

###

Circuit Diagrams

Circuit Diagrams.3

Project Components

Project Video

Source: How to interface LCD with PIC18F4550 Microcontroller

The post How to interface LCD with PIC18F4550 Microcontroller appeared first on PIC Microcontroller.

Interfacing 16×2 Alphanumeric LCD display with STM8 Microcontroller

$
0
0

The 16×2 Alphanumeric LCD display is the most commonly used display among hobbyists and enthusiasts. The display is very useful when you want to display basic information to the user and can also help in testing or debugging our code. This particular 16×2 LCD module is easily available and has been popular for a long time. You can learn more about the basics of the 16×2 LCD module in the linked article.

Interfacing 16x2 Alphanumeric LCD display with STM8 Microcontroller

To continue with our series of STM8 Microcontroller tutorials, in this tutorial, we will learn how to interface a LCD with STM8 Microcontroller. We have previously interfaced 16×2 LCD with many other microcontrollers as well, the tutorials are listed below and you can check them if interested.

If you are new to STM8, do check out the getting started with the STM8 Microcontroller article to understand the basics of the controller board and programming environment. We will not be covering the basics in this tutorial.

Working of 16×2 LCD Display

As the name suggests, a 16×2 LCD will have 16 Columns and 2 Rows. So in total, we will be able to display 32 characters on this display and these characters can be alphabets or numbers or even symbols. A simple 16×2 LCD pinout that we use in this tutorial is shown below-

Working of 16x2 LCD Display

As you can see, the display has 16 pins and we can divide it into five categories, Power Pins, contrast pin, Control Pins, Data pins, and Backlight pins as shown in the table below. We will get into the details of each pin when we discuss the circuit diagram of this tutorial.

Category Pin NO. Pin Name Function
Power Pins 1 VSS Ground Pin, connected to Ground
2 VDD or Vcc Voltage Pin +5V
Contrast Pin 3 V0 or VEE Contrast Setting, connected to Vcc through a variable resistor.
Control Pins 4 RS Register Select Pin, RS=0 Command mode, RS=1 Data mode
5 RW Read/ Write pin, RW=0 Write mode, RW=1 Read mode
6 E Enable, a high to low pulse need to enable the LCD
Data Pins 7-14 D0-D7 Data Pins, Stores the Data to be displayed on LCD or the command instructions
Backlight Pins 15 LED+ or A To power the Backlight +5V
16 LED- or K Backlight Ground

On the backside of the LCD, as shown in the image below, you will find two black dots, inside which we have the HD44780 LCD driver IC (encircled in red). Our microcontroller should communicate with this IC which in turn will control what is being displayed on the LCD. If you are curious to know how exactly all this works you should check out the working of 16×2 LCD display where we have already discussed how the LCD works in detail.

In this tutorial, we will discuss the circuit diagram and code to display alphamerical characters (alphabets and numbers) on a 16×2 LCD display using simple LCD_print_char and LCD_print_string commands. These commands can directly be used in the program after including our header file. The header file deals with all most of the stuff for you so it is not mandatory to know how the display or the HD44780 driver IC works.

Circuit Diagram to Interface LCD with STM8 Microcontroller

The complete STM8 LCD Circuit can be found in the below image. As you can see the connection for STM8S103F3P6 Controller with LCD is very simple, we have the LCD display directly connected to our board and the ST-link is also connected to program the board.

Circuit Diagram to Interface LCD with STM8 Microcontroller

The power pins Vss and Vcc are connected to the 5V pin on the STM8S board, note that the operating voltage of LCD is 5V and is connected to operate on 3.3V. So even though the STM8S103F3P6 Microcontroller operates on 3.3V is mandatory to have a 5V supply for the LCD, you can avoid this by using a charge controller IC but we won’t be discussing that in this tutorial.

Next, we have the contrast pin which is used to set the contrast of the LCD, we have connected it to the potentiometer so that we can control the contrast. We have used a 10k pot, but you can also use other nearby values, the pot acts as a potential divider to provide 0-5 V to the contrast pin, typically you can also use a resistor directly to provide around 2.2V for reasonable contrast value. Then we have the reset (RS), Read/Write (RW), and Enable (E) pins. The read-write pin is grounded because we won’t be reading anything from the LCD we will only perform write operations. The other two control pins Rs and E are connected to PA1 and PA2 pins respectively.

Then we have the data pins DB0 to DB7. The 16×2 LCD can operate in two modes, one is an 8-bit operation mode where we have to use all the 8 data pins (DB0-DB7) on the LCD and the other is the 4-bit operation mode where we only need 4 data pins (DB4-DB7). The 4-bit mode is commonly used because it requires less GPIO pins from the controller, so we have also used 4-bit mode in this tutorial and have connected only pins DB4, DB5, DB6, and DB7 to pins PD1, PD2, PD3, and PD4 respectively.

The last two pins BLA and BLK are used to power the internal backlight LED, we have used a 560-ohm resistor as a current limiting resistor. The ST-Link programmer is connected as always like in our previous tutorial. I made the complete connection on the breadboard and my set-up looks like this shown in the image below.

Source: Interfacing 16×2 Alphanumeric LCD display with STM8 Microcontroller

 

The post Interfacing 16×2 Alphanumeric LCD display with STM8 Microcontroller appeared first on PIC Microcontroller.

Using STONE LCD screen and ESP32 MCU to implement home massage chair application

$
0
0

Project Overview                                                  

Here we do is a home massage chair application, will STONE TFT After the LCD serial screen is powered on, a start interface will appear. After a short stay, it will jump to a specific interface. This interface is used to set our current time. When setting, a keyboard will pop up. After setting, click OK to enter the massage mode selection interface. Here, I have set three modes: head massage, back massage and comprehensive mode. In the mode, the massage intensity can be set, the high, middle and low gears can be set, and the corresponding LED light will be used for intensity indication; the massage times can also be set, after reaching the set number, it will automatically stop; in the comprehensive mode, the head and back will be massaged at the same time, and it can be turned off when it is not needed. These actions are through the STONE TFT LCD serial port screen to achieve command transmission.

Using STONE LCD screen and ESP32 MCU to implement home massage chair application

The communication functions are as follows:

            ① The serial port screen of STONE TFT LCD realizes the function of button switching interface;

② The serial port screen of STONE TFT LCD realizes the function of automatic jump when starting up;

③ The serial port screen of STONE TFT LCD realizes time setting;

④ The serial port screen of STONE TFT LCD realizes data variable distribution;

⑤ STONE TFT LCD serial port screen realizes serial command communication.

⑥ STONE TFT LCD serial port screen realizes the function of menu bar selection;

Modules required for the project:

STONE TFT LCD

Arduino ESP32

③ Stepper motor drive and module;

④ LED array module;

Block diagram:

Block diagram

Hardware introduction and principle

Size: 10.1 inch

Resolution: 1024×600 

Brightness: 300cd / m2, LED backlight;

RGB color: 65K;

visual area: 222.7mm * 125.3mm;

working life: 20000 hours. 32-bit cortex-m4 200Hz CPU;

flash memory: 128MB (or 1GB) ;

UART interface: RS232 / RS485 / TTL / USB;

Toolbox software for GUI design, simple and powerful hex instructions.

STVC101WT-01 TFT display module communicates with MCU through serial port, which needs to be used in this project. We only need to add the designed UI picture through the upper computer through the menu bar options to buttons, text boxes, background pictures, and page logic, then generate the configuration file, and finally download it to the display screen to run.

Hardware introduction and principle

The manual can be downloaded through the official website:

https://www.stoneitech.com/support/download

LED array module

Product features

This is a galloping lamp display module with 8 LEDs on board. The external voltage is 3-5.5vdc, and the corresponding LED can be lighted at low level. It is especially suitable for IO test of single chip microcomputer to realize indicator control.

Electrical parameters

-Working voltage: 3 – 5.5VDC

-Working current: 24Ma (maximum)

-Effective level: low level

-Number of LEDs: 8

-Display color: red (D1 / D2 / D3 / D4 / D5 / D6 / D7 / D8)

-It is very suitable for MCU experiment and DIY

ESP32 EVB

Esp32 is a single-chip scheme integrated with 2.4 GHz WiFi and Bluetooth dual-mode. It adopts TSMC’s ultra-low power consumption 40 nm technology, with ultra-high RF performance, stability, versatility and reliability, as well as ultra-low power consumption, which meets different power consumption requirements and is suitable for various application scenarios.

Wi-Fi

  • 802.11 b/g/n
  • 802.11 n (2.4 GHz) up to 150 Mbps
  • wireless multimedia (WMM)
  • frame aggregation (TX / RX A-MPDU, Rx A-MSDU)
  • immediate block ACK
  • defragmentation
  • beacon automatic monitoring (hardware TSF)
  • 4x virtual Wi Fi interface

Bluetooth

  • Bluetooth v4.2 complete standard, including traditional Bluetooth (BR / EDR) and low power Bluetooth (ble)
  • supports standard class-1, class-2 and class-3 without external power amplifier
  • enhanced power control

Output power up to +12 dBm

  • nzif receiver has – 94 DBM ble reception sensitivity
  • adaptive frequency hopping (AFH)
  • standard HCI based on SDIO / SPI / UART interface

• high speed UART HCI up to 4 Mbps

Support for Bluetooth 4.2 br / EDR and ble dual-mode controller

Support for Bluetooth 4.2 br EDR and ble dual-mode controller

  • synchronous connection oriented / extended synchronous connection oriented (SCO / ESCO)
  • CVSD and SBC audio codec algorithms
  • piconet and scatternet
  • multi device connection with traditional Bluetooth and low power Bluetooth
  • support simultaneous broadcast and scanning

ULN2003 Steeper Motor

ULN2003 Steeper Motor

Product features

ULN2003 is a Darlington display with high voltage and high current. It consists of seven Silicon NPN Darlington tubes. Each pair of Darlington of ULN2003 is connected in series with a 2.7K base resistor. Under 5V working voltage, it can be directly connected with TTL and CMOS circuit, which can directly process the data that needs standard logic buffer. Here we use DIP-16 package, 4-phase 5-wire 5V stepping motor.

Structure and Application

Development steps

Development steps

Arduino ESP32

Download IDE

To complete the code development of esp32, Arduino is used to develop and compile. First, you need to install the environment and enter the Arduino official website:

https://www.arduino.cc/en/Main/Software, and download the version for your own platform.

Code

Code

HeadGearHigh is used to set the gear to high in receive head mode

HeadGearMiddle is used to set the gear to middle in receive head mode

HeadGearLow is used to set the gear to low in receive head mode

HeadTiming is used to receive the number of times set in head mode

HeadModeStart is used to start in receive header mode

HeadModeStop is used to stop in receive header mode

BackGearHigh is used to set the gear to high in receive back mode

BackGearMiddle is used to set the gear to middle in receive back mode

BackGearLow is used to set the gear to low in receive back mode

BackModeStart is used to start in receive back mode

BackModeStop is used to stop in receive back mode

IntegratedModeStart is used to receive start in integrated mode

IntegratedModeStop is used to receive stop in integrated mode

After the code is written, we start to compile. After the compilation is successful, download the code to the esp32 EVB board. The operation is as follows:

STONE TOOL 2019

New Project

Find the tool 2019 directory and double-click to open STONE Tool 2019

STONE TOOL 2019

Click new project and make changes to the resolution, project name, and save path.

Click new project and make changes to the resolution, project name, and save path

Then set the boot page, and set the communication packet header:

Then set the boot page, and set the communication packet header

Add picture

By default, there is a blue back image after a new project is created.

Add picture

Right click 0.jpg and select remove to delete it. In the same way, select Add to add the image required by the project.

Setting of selection interface

Setting of selection interface

RTC

RTC

To set the time function, first add a clock setting control.

Add an RTC control.

Add an RTC control

To make input keyboard, we need to add a button control to each array and give the corresponding key value.

To make input keyboard, we need to add a button control to each array and give the corresponding key value

Menu bar selection

Menu bar selection

Add the menu bar control, set the initial value, and add the corresponding ICO library.

Page jump function

Page jump function

You can set the button effect and the switch page, and the switching interface effect of other buttons is also similar.

Key command setting

Each button needs to be given corresponding action, so the following settings are made:

//HEAD

uint8_t   HeadGearHigh[9]       = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x03};

uint8_t   HeadGearMiddle[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x02};

uint8_t   HeadGearLow[9]        = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x01};

uint8_t   HeadTiming[9]         = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x11, 0x01, 0x00, 0x09};

uint8_t   HeadModeStart[9]    = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x19, 0x01, 0x41, 0x61};

uint8_t   HeadModeStop[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x24, 0x01, 0x46, 0x66};

//BACK

uint8_t   BackGearHigh[9]       = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x01};

uint8_t   BackGearMiddle[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x02};

uint8_t   BackGearLow[9]      = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x03};

uint8_t   BackModeStart[9]      = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0C, 0x01, 0x42, 0x62};

uint8_t   BackModeStop[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0D, 0x01, 0x43, 0x63};

//Integrated

uint8_t   IntegratedModeStart[9]= {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0F, 0x01, 0x44, 0x64};

uint8_t   IntegratedModeStop[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1F, 0x01, 0x45, 0x65};

Connection

connections

Connections 2

Connections 3

Code

/*

 Stepper Motor Control – one revolution

 This program drives a unipolar or bipolar stepper motor.

 The motor is attached to digital pins 8 – 11 of the Arduino.

 The motor should revolve one revolution in one direction, then

 one revolution in the other direction.

 Created 11 Mar. 2007

 Modified 30 Nov. 2009

 by Tom Igoe

 */

//#include <Stepper.h>

#include “stdlib.h”

#include <AccelStepper.h>

const float STEPCYCLE = 2050;//A Cycle by Step is 2050;

//  myStepper.setSpeed(100);//5V, it can be set up to 180

const float TheMaxSpeed = 1000.0;  // change this to fit the number of steps per revolution

const float headspeed_str[4] =

{

  0,

  TheMaxSpeed / 4,

  TheMaxSpeed / 2,

  TheMaxSpeed,

};

const float backspeed_str[4] =

{

  0,

  TheMaxSpeed,

  TheMaxSpeed / 2,

  TheMaxSpeed / 4,

};

// for your motor

// initialize the stepper library on pins 8 through 11:

AccelStepper HeadStepper(AccelStepper::FULL4WIRE, 15, 0, 2, 4);//The middle two IO are reversed

AccelStepper BackStepper(AccelStepper::FULL4WIRE, 16, 5, 17, 18);//The middle two IO are reversed

const int ledPin_1 =  14;      // the number of the LED pin

const int ledPin_2 =  27;      // the number of the LED pin

const int ledPin_3 =  26;      // the number of the LED pin

const int ledPin_4 =  25;      // the number of the LED pin

const int ledPin_5 =  33;      // the number of the LED pin

const int ledPin_6 =  21;      // the number of the LED pin

const int ledPin_7 =  22;      // the number of the LED pin

const int ledPin_8 =  23;      // the number of the LED pin

//buf

uint8_t   cout_i = 0;

uint8_t   RecievedTemp[9]       = {0};

float     settingbuf[2]       = {TheMaxSpeed, 0};

float   MorenCycle      = 100;

//HEAD

uint8_t   HeadGearHigh[9]       = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x03};

uint8_t   HeadGearMiddle[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x02};

uint8_t   HeadGearLow[9]        = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x01};

uint8_t   HeadTiming[9]         = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x11, 0x01, 0x00, 0x09};

uint8_t   HeadModeStart[9]    = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x19, 0x01, 0x41, 0x61};

uint8_t   HeadModeStop[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x24, 0x01, 0x46, 0x66};

//BACK

uint8_t   BackGearHigh[9]       = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x01};

uint8_t   BackGearMiddle[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x02};

uint8_t   BackGearLow[9]      = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x03};

uint8_t   BackModeStart[9]      = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0C, 0x01, 0x42, 0x62};

uint8_t   BackModeStop[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0D, 0x01, 0x43, 0x63};

//Integrated

uint8_t   IntegratedModeStart[9]= {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0F, 0x01, 0x44, 0x64};

uint8_t   IntegratedModeStop[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1F, 0x01, 0x45, 0x65};

void setup()

{

//Serial port initialization

    Serial.begin(115200);

//The motor starts running separately

//  HeadStepper_Setting_Run(TheMaxSpeed, 5);

//  BackStepper_Setting_Run(TheMaxSpeed, 5);

  // initialize the LED pin as an output:

  pinMode(ledPin_1, OUTPUT);

  pinMode(ledPin_2, OUTPUT);

  pinMode(ledPin_3, OUTPUT);

  pinMode(ledPin_4, OUTPUT);

  pinMode(ledPin_5, OUTPUT);

  pinMode(ledPin_6, OUTPUT);

  pinMode(ledPin_7, OUTPUT);

  pinMode(ledPin_8, OUTPUT);

  digitalWrite(ledPin_1, HIGH);   // turn the LED on (HIGH is the voltage level)

  digitalWrite(ledPin_2, HIGH);  // turn the LED on (HIGH is the voltage level)

  digitalWrite(ledPin_3, HIGH);  // turn the LED on (HIGH is the voltage level)

  digitalWrite(ledPin_4, HIGH);  // turn the LED on (HIGH is the voltage level)

  digitalWrite(ledPin_5, HIGH);  // turn the LED on (HIGH is the voltage level)

  digitalWrite(ledPin_6, HIGH);  // turn the LED on (HIGH is the voltage level)

  digitalWrite(ledPin_7, HIGH);  // turn the LED on (HIGH is the voltage level)

  digitalWrite(ledPin_8, HIGH);  // turn the LED on (HIGH is the voltage level)

}

void loop()

{

  if(Serial.available() != 0)

  {

    for(cout_i = 0; cout_i < 9; cout_i ++)

    {

        RecievedTemp[cout_i] = Serial.read();

    }

//    if(HeadStepper.isRunning() == true)

//    {

//      HeadStepper.stop();   

//    }

//    if(BackStepper.isRunning() == true)

//    {

//      BackStepper.stop();   

//    }

//  else

//  {

//    Stepper2_Setting_Run(TheMaxSpeed, 5);

//  }

//  Serial.write(RecievedTemp, 9);

  switch(RecievedTemp[5])

  {

  case 0x0E://head gear

        if(HeadStepper.isRunning() == true)

      {

        HeadStepper.stop();   

      }

      settingbuf[0] = headspeed_str[RecievedTemp[8]];

    if(RecievedTemp[8] == 1)

    {

      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_3, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_4, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_5, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_6, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_7, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_8, HIGH);   // turn the LED on (HIGH is the voltage level)

    }

    else if(RecievedTemp[8] == 2)

      {

      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_3, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_4, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_5, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_6, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_7, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_8, HIGH);   // turn the LED on (HIGH is the voltage level)

      }

    else

      {

      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_3, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_4, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_5, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_6, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_7, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_8, LOW);   // turn the LED on (HIGH is the voltage level)

      }

    break;

  case 0x11://head timing

        if(HeadStepper.isRunning() == true)

      {

        HeadStepper.stop();   

      }

    settingbuf[1] = RecievedTemp[8];

    break;

  case 0x19://head start

    if(settingbuf[1] == 0)

    {

      settingbuf[1] = 5;

    }

    break;

  case 0x24://head stop

      if(HeadStepper.isRunning() == true)

      {

          HeadStepper.stop();   

      }

    break;

  case 0x1A://backgear

    if(BackStepper.isRunning() == true)

      {

          BackStepper.stop();   

      }

      settingbuf[0] = backspeed_str[RecievedTemp[8]];

    if(RecievedTemp[8] == 3)

    {

      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_3, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_4, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_5, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_6, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_7, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_8, HIGH);   // turn the LED on (HIGH is the voltage level)

    }

      else if(RecievedTemp[8] == 2)

      {

      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_3, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_4, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_5, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_6, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_7, HIGH);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_8, HIGH);   // turn the LED on (HIGH is the voltage level)

      }

      else

      {

      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_3, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_4, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_5, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_6, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_7, LOW);   // turn the LED on (HIGH is the voltage level)

      digitalWrite(ledPin_8, LOW);   // turn the LED on (HIGH is the voltage level)

      }

    break;

  case 0x0C://backstart

    BackStepper_Setting_Run(settingbuf[0], MorenCycle);

      break;

  case 0x0D://backstop

      if(BackStepper.isRunning() == true)

    {

      BackStepper.stop();   

    }

    break;

  case 0x0F://integratestart

    if(HeadStepper.isRunning() == true)

    {

        HeadStepper.stop(); 

    }

    if(BackStepper.isRunning() == true)

    {

      BackStepper.stop();   

    }   

    break;

  case 0x1F://integratedstop

    if(HeadStepper.isRunning() == true)

    {

      HeadStepper.stop(); 

    }

    if(BackStepper.isRunning() == true)

    {

      BackStepper.stop(); 

    }  

    break;

  default:

    break;

  }

//    Serial.write(&Targetvalue, 1);

//    Serial.print(Targetvalue);

  }

}

Application of massage chair Appendix

Application of massage chair Appendix

Application of massage chair Appendix

clipboard

Application of massage chair Appendix lcd

clipboard 2

clipboard 3

The post Using STONE LCD screen and ESP32 MCU to implement home massage chair application appeared first on PIC Microcontroller.

PIC30F4011 OSCILLOSCOPE AND SPECTRUM ANALYZER 128×64 GLCD

$
0
0

Scopey II: A Simple Scope and Spectrum Analyzer Facing the demise of my Tektronix 2213 in an somebody transport traveling, I featured the mind of either purchase an costly CRT to get it running again, or payment my nights… Electronics Projects, PIC30F4011 oscilloscope and spectrum analyzer 128×64 glcd “dspic projects, microchip projects, microcontroller projects,

PIC30F4011 OSCILLOSCOPE AND SPECTRUM ANALYZER 128×64 GLCD

 

Scopey II: A Simple Scope and Spectrum Analyzer Facing the demise of my Tektronix 2213 in an somebody transport traveling, I featured the mind of either purchase an costly CRT to get it running again, or payment my nights aquatics ebay for other ambit. Having two not so uppercase options, and having conscionable mark with copious amounts of withdraw experience, I definite to upright sort my own. Patch it power not feature the unvaried bandwidth or accuracy of the old Tektronix, it is a accessible lowercase device that I’m trusty will be quite efficacious once I block tinkering with it, and it has several nifty features that a nimiety

THE OSCILLOSCOPE:

The oscilloscope consists of an input stage consisting of a resistive attenuator with 1Mohm impedance, a switch to remove or insert a capacitor for AC or DC coupling, followed by several amplifiers. The first amplifier is a unity gain inverting buffer, followed by a level shifting circuit to center the signal around .5Vcc (2.5V) for the PGA and ADC.

The stage immediately preceding the ADC pin on the dsPIC is a Microchip MCP6S21 PGA (programmable gain amplifier), which is used with gains of 1, 2, 4, 8, 16 and 32 to give gains (attenuation * gain) of 1/8, ¼, ½, 1, 2, and 4, allowing for a wide range of input signals to be visualized. The PGA is connected directly to an ADC pin on the dsPIC.

THE OSCILLOSCOPE

The Spectrum Analyzer uses the same input amplifiers as the oscilloscope, although the data format is signed fractional instead of unsigned integer in order to utilize the Microchip DSP libraries. Once acquired, the data is windowed using a Hann window and scaled to prevent overflow in the FFT functions. The data is then transformed to the frequency domain, scaled logarithmically, then displayed. When scaling the data, the bin containing the fundamental is found and the associated frequency is found and displayed in the text portion of the display. Author: Jaime Garnica

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-10483.zip

Source: PIC30F4011 OSCILLOSCOPE AND SPECTRUM ANALYZER 128×64 GLCD

The post PIC30F4011 OSCILLOSCOPE AND SPECTRUM ANALYZER 128×64 GLCD appeared first on PIC Microcontroller.

DSPIC30F301 LASER LIGHT BACKSCATTER LCD KEYPAD INPUT

$
0
0

Microchip 16-bit Embedded Design Contest Determining Surface Roughness By Laser Light Backscatter Registration Number – MT2254 October 16, 2007 As a stand alone measurement system with user interaction, the project needs some sort of intelligence. A Microchip brand dsPIC… Electronics Projects, dsPIC30F301 laser light backscatter lcd keypad input “dspic projects, microchip projects, microcontroller projects,

DSPIC30F301 LASER LIGHT BACKSCATTER LCD KEYPAD INPUT

Microchip 16-bit Embedded Design Contest Determining Surface Roughness By Laser Light Backscatter Registration Number – MT2254 October 16, 2007 As a stand alone measurement system with user interaction, the project needs some sort of intelligence. A Microchip brand dsPIC microcontroller was chosen to provide this intelligence.

A microcontroller can be described as a microprocessor, but with a high integration of memory and peripherals. The dsPIC30F3013 had all the memory and peripheral needed to control this project on-board. The schematic was created in Orcad Capture 10.5

A Microchip brand dsPIC microcontroller was chosen to provide this intelligence

The dsPIC30F3013 variant was chosen specifically for its 12-bit analog to digital converter and pin count. Each of the 28 pins of this device was consumed in the development and deployment of this project. The 12-bit ADC peripheral handles the conversion of an analog voltage to a 12-bit representation of the voltage. Author: Gregory Cloutier

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-10472.zip

Source: DSPIC30F301 LASER LIGHT BACKSCATTER LCD KEYPAD INPUT

The post DSPIC30F301 LASER LIGHT BACKSCATTER LCD KEYPAD INPUT appeared first on PIC Microcontroller.

LCD DISPLAY PIC16F84A TEMPERATURE FAN CONTROL CIRCUIT

$
0
0

Previously shared “PIC16F84 and DS1621 temperature measurement and temperature control relay” circuit’ve implemented the project is working smoothly. Proteus isis simulation study ds1621.dll file in the file C: \ program files \ Labcenter Electronics \ Proteus 7 Professional \… Electronics Projects, LCD Display PIC16F84A Temperature Fan Control Circuit “microchip projects, microcontroller projects, pic16f84 projects, picbasic pro examples,

LCD DISPLAY PIC16F84A TEMPERATURE FAN CONTROL CIRCUIT

Previously shared “PIC16F84 and DS1621 temperature measurement and temperature control relay” circuit’ve implemented the project is working smoothly.

Proteus isis simulation study ds1621.dll file in the file C: \ program files \ Labcenter Electronics \ Proteus 7 Professional \ models with the same file inside the folder you need to change

PIC16F84A LCD DISPLAY TEMPERATURE CONTROL TEST

Temperature Fan Control Circuit PIC16F84A picbasic pro code and circuit files:

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-10250.zip

Source: LCD DISPLAY PIC16F84A TEMPERATURE FAN CONTROL CIRCUIT

The post LCD DISPLAY PIC16F84A TEMPERATURE FAN CONTROL CIRCUIT appeared first on PIC Microcontroller.


How to display 5×8 and 5×10 size font characters on 16×2 lcd with 8-bit microcontrollers

$
0
0

Character lcds can display character of font size 5×8 and 5×10. In 5xn, 5 represents number of coulombs and N represents number of rows. Character lcd’s especially which are controlled by Hitachi HD44780 controller can display 5×8 and 5×10 size font character. Some lcd’s can only display character in 5×8 font. In this project i am going to teach you how to display characters of font size 5×8 and 5×10 on character lcd?

If you are newbie and don’t know about internal structure of character lcd and how to interface it with microcontrollers? Than i suggest you you first take the getting started with lcd tutorial.

As you know first we have to initialize the lcd that we are using (8×1, 8×2, 8×4, 16×1, 16×2, 16×4, 20×1, 20×2, 20×4, 24×1, 24×2, 24×4, 32×1, 32×2, 40×1, 40×2, 40×4). By initialization I mean 

  • Should the cursor appears on lcd or not? If appearing, whether it should be blinking or normal?
  • What should be the size of character-font appearing on lcd (5×8, 5×10)?

To learn about lcd initialization standard commands go through the simple tutorial below. 

We are going to discuss only commands that are related to character size Font-matrix in this tutorial. To initialize character lcd we have to send commands to command-register of lcd. All the commands are 8-bit in nature. For Initializing character font size, 8-bit commands individual bits represents.

How to display 5×8 and 5×10 size font characters on 16×2 lcd with 8-bit microcontrollers

  • DL selects lcd mode. 8-bit or 4-bit. Don’t know Go through the tutorial(Lcd in 4-bit and 8-bit mode)
  • N selects if lcd contains 2 rows or 1.
  • F selects character font size. (5×8 or 5×10)

Now if I have a 16×2 lcd and i want to initialize its Character font to be 5×10 my command will be.

5x10-character-size-initializing-command-for-16x2-lcd_orig

Standard Lcd Commands for 5×10 Display

Standard Lcd Commands for 5×10 Display

Now i am going to display characters on lcd in 5×8 and 5×10 font. I am going to print it on lcd using two different microcontrollers. Microchip pic16f877 and 8051(89c51,89c52) microcontroller. 

  • You can display 208 characters in 5×8 font and 32 characters in 5×10 font. Total ASCII characters present in HD44780 lcd controller are 240. In which 208 are in 5×8 font and 32 are in 5×10 font. 
  • In CG-RAM you can create 8 custom characters at a time in 5×8 font and 4 custom characters in 5×10 font. Don’t know about CG-RAM and custom characters? Go through(CG-RAM & custom characters generation and display)

See the difference in the same characters in same row, marked against red and green star. red star represents 5×8 font size character and green represents same character with 5×10 size font. Picture taken from hd44780 controller data sheet.

lcd 5×8 and 5×10 size characters present in hd44780 controller ascii set

Displaying 5×10, 5×8 font size Characters on character lcd Using PIC16f877 Microcontroller.

  Project Requirements
  • PIC 16f877 microcontroller
  • 16×2 lcd
  • Potentiometer (To set Lcd Contrast)
  • Crystal (20 MHz)
  • Capacitors 33Pf

I am going to print/display G,J,P & Q in 5×8 and 5×10 font. These characters are present in HD44780 Controller in 5×8 and 5×10 font. I will call their addresses and they will appear/display on lcd screen. 

Lcd data pins are Connected to Port-B of microcontroller. Lcd control pins (en,rs,rw) are connected to Port-D Pins#7,6,5. Rest of the connections are normal connections. Supplying power to microcontroller. Grounding GND pin. Connecting Crystal to microcontroller etc. Circuit diagram of the project is given below.

Code is written in Mp-Lab ide and high tech c compiler is used to compile the code. Pic kit-2 is used to upload the code to microcontroller.

/**************************************************
* Property of: www.microcontroller-project.com *
* Author: Usman Ali Butt *
* Created on 11 April, 2015, 2:30 PM *
**************************************************/
#include <htc.h>
#define _XTAL_FREQ 20000000
#define en RD7
#define rs RD6
#define rw RD5

void delay(unsigned int time) //Time delay function
{
unsigned int i,j;
for(i=0;i< time;i++)
for(j=0;j< 3;j++);
}
//Function for sending values to the command register of LCD
void lcdcmd(unsigned char value)
{
PORTB=value;
rs= 0; //register select-rs
rw = 0; //read-write-rd
en = 1; //enable-e
delay(50);
en=0; //enable-e
delay(50);
}
//Function for sending values to the data register of LCD
void display(unsigned char value)
{
PORTB=value;
rs= 1; //register select-rs
rw= 0; //read-write-rd
en= 1; //enable-e
delay(500);
en=0; //enable-e
delay(50);
}
//function to initialize the registers and pins of LCD
//always use with every lcd of hitachi
void lcdint(void)
{
TRISB=0x00; //Port B is used as output port-connected to lcd
TRISD5=0; //Lcd controlling pins
TRISD6=0; //Lcd controlling pins
TRISD7=0; //Lcd controlling pins
delay(15000);
display(0x30);
delay(4500);
display(0x30);
delay(300);
display(0x30);
delay(650);
lcdcmd(0x3C); //5×10 Font Selected
delay(50);
lcdcmd(0x0C); //Display on Cursor off
delay(50);
lcdcmd(0x01); //Clear Lcd
delay(50);
lcdcmd(0x06); //Entry Mode, Increment Cursor Automatically
delay(50);
lcdcmd(0x80); //Control set at Lcd 1 Row, 1 Coulomb
delay(50);
}

void main()
{
lcdint(); //Initialize Lcd
display(0xea);//Display 5×10 J
display(0x6a);//Display 5×8 j
display(‘ ‘);
display(0x67);//Display 5×8 g
display(0xe7);//Display 5×10 G
display(‘ ‘);
lcdcmd(0xC0);
display(0x70);//Display 5×8 p
display(0xf0);//Display 5×10 P
display(‘ ‘);
display(0x71);//Display 5×8 q
display(0xf1);//Display 5×10 Q
while(1);
}

D​isplaying 5×10, 5×8 Characters on 16×2 lcd Using 8051(89c51, 89c52) Microcontroller.

 Project Requirements
  • 8051(89c51,89c52) series microcontroller
  • 16×2 lcd
  • Potentiometer (To set Lcd Contrast)
  • Crystal (11.0592 MHz)
  • Capacitors 33Pf

Lcd data pins are connected to Port-1 of microcontroller. Lcd controlling pins en,rs,rw are connected to Port-3 pins#5,6,7. Circuit diagram of the project is given below.

D​isplaying 5×10, 5×8 Characters on 16×2 lcd Using 8051(89c51, 89c52) Microcontroller.

Code is almost same like of the pic microcontroller. Only the syntax of the code is changed. Code is written in keil u-vision ide.

/**************************************************
* Property of: www.microcontroller-project.com *
* Author: Usman Ali Butt *
* Created on 13 April, 2015, 2:30 PM *
**************************************************/
#include<reg51.h>
sbit rs=P3^5; //Register select (RS)
sbit rw=P3^7; //Read write (RW) pin
sbit en=P3^6; //Enable (EN) pin

void delay(unsigned int time) //Time delay function
{
unsigned int i,j;
for(i=0;i< time;i++)
for(j=0;j< 5;j++);
}

//Function for sending values to the command register of LCD
void lcdcmd(unsigned char value)
{
P1=value;
P3=0x40;
delay(50);
en=0;
delay(50);
return;
}
//Function for sending values to the data register of LCD
void display(unsigned char value)
{
P1=value;
P3=0x60;
delay(500);
en=0;
delay(50);
return;
}
//function to initialize the registers and pins of LCD
//always use with every lcd of hitachi
void lcdint(void)
{
P1=0x00; //Port-1 as output
P3=0x00; //Port-3 as output
delay(15000);
display(0x30);
delay(4500);
display(0x30);
delay(300);
display(0x30);
delay(650);
lcdcmd(0x3C); //5×10 Font Selected
delay(50);
lcdcmd(0x0C); //Display on Cursor off
delay(50);
lcdcmd(0x01); //Clear Lcd
delay(50);
lcdcmd(0x06); //Entry Mode, Increment Cursor Automatically
delay(50);
lcdcmd(0x80); //Control set at Lcd 1 Row, 1 Coulomb
delay(50);
}

//MAIN FUNCTION
void main()
{
lcdint(); //Initialize Lcd
display(0xea);//Display 5×10 J
display(0x6a);//Display 5×8 j
display(‘ ‘);
display(0x67);//Display 5×8 g
display(0xe7);//Display 5×10 G
display(‘ ‘);
lcdcmd(0xC0);
display(0x70);//Display 5×8 p
display(0xf0);//Display 5×10 P
display(‘ ‘);
display(0x71);//Display 5×8 q
display(0xf1);//Display 5×10 Q
while(1);
}

Source: How to display 5×8 and 5×10 size font characters on 16×2 lcd with 8-bit microcontrollers

The post How to display 5×8 and 5×10 size font characters on 16×2 lcd with 8-bit microcontrollers appeared first on PIC Microcontroller.

KS0108 LCD THERMOMETER CCS C PIC16F88 LM35 SENSOR

$
0
0

Thermometer circuit LM35 temperature sensor with 2 PIC16F88 based on temperature information kc0108 128 × 64 graphic LCD displays on Very simple thermometer with PIC16F88, two LM35 sensors and KS0108 graphic LCD. Schematic from Proteus VSM. Note that almost… Electronics Projects, KS0108 LCD Thermometer CCS C PIC16F88 LM35 Sensor “microchip projects, microcontroller projects, pic16f88 projects,

KS0108 LCD THERMOMETER CCS C PIC16F88 LM35 SENSOR

Thermometer circuit LM35 temperature sensor with 2 PIC16F88 based on temperature information kc0108 128 × 64 graphic LCD displays on

Very simple thermometer with PIC16F88, two LM35 sensors and KS0108 graphic LCD. Schematic from Proteus VSM. Note that almost every pin of PIC16F88 is used.

Here’s the source code, I’m sorry it isn’t commented very well. The code is written for CCS C compiler. There’s also Proteus VSM simulation file and compiled hex file.

LCD THERMOMETER TEST

https://youtu.be/8-oW223RfyA

source mehilainen.homeip.net/lcdthermo/lcdthermo.html The CCS C Thermometer Project has all the files proteus isis, ccs c source code library and others: :

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-8525.zip

Source: KS0108 LCD THERMOMETER CCS C PIC16F88 LM35 SENSOR

The post KS0108 LCD THERMOMETER CCS C PIC16F88 LM35 SENSOR appeared first on PIC Microcontroller.

PICMICRO LCD BAR APPLICATIONS HI TECH C AND PROTON IDE EXAMPLE

$
0
0

Greetings friends I share the LCD bar applications with C spelled my earlier application with basic proton HiTech C and I’ve taken this time. In case that codes for functions can easily be adapted to the application. In addition,… Electronics Projects, PICMicro LCD Bar Applications Hi Tech C and Proton ide Example “hi tech c examples, microchip projects, microcontroller projects,

PICMICRO LCD BAR APPLICATIONS HI TECH C AND PROTON IDE EXAMPLE

Greetings friends I share the LCD bar applications with C spelled my earlier application with basic proton HiTech C and I’ve taken this time.

In case that codes for functions can easily be adapted to the application. In addition, with minor changes in the other pic c compiler used. The links made ​​with both basic and C applications can be downloaded.

HI TECH C EXAMPLE LCD BAR BALANCED, 32, 48, 80

HI TECH C EXAMPLE LCD BAR BALANCED, 32, 48, 80

HI TECH C EXAMPLE LCD BAR BALANCED, 32, 48, 80

HI TECH C EXAMPLE LCD BAR BALANCED, 32, 48, 80

PICMicro LCD Bar Applications Hi Tech C and Proton ide Example files

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-8323.zip

Source: PICMICRO LCD BAR APPLICATIONS HI TECH C AND PROTON IDE EXAMPLE

 

The post PICMICRO LCD BAR APPLICATIONS HI TECH C AND PROTON IDE EXAMPLE appeared first on PIC Microcontroller.

HI TECH C LCD EXAMPLES PIC18F452, PIC16F877

$
0
0

Software Hi-Tech C language prepared by the various applications of electronic sections PIC18F452 PIC16F877 PIC18F4550 based on the Hi Tech C source code and the PCB drawings and all other documents have been shared, LCD character graphics used for… Electronics Projects, Hi Tech C LCD Examples PIC18F452, PIC16F877 “hi tech c examples, microchip projects, microcontroller projects, pic16f877 projects,

HI TECH C LCD EXAMPLES PIC18F452, PIC16F877

Software Hi-Tech C language prepared by the various applications of electronic sections PIC18F452 PIC16F877 PIC18F4550 based on the Hi Tech C source code and the PCB drawings and all other documents have been shared, LCD character graphics used for the conversion in the programs are

GRAPHIC LCD DISPLAY 240×128. T6963 CONTROLLER

Graphic LCD display 240 * 128. T6963 controller. The display is controlled by a 18F4550. The usb is not yet managed. This screen comes from diffusion in Electronics (reference TX-1741-C3M Toshiba).

GRAPHIC LCD DISPLAY 240×128. T6963 CONTROLLER

GRAPHIC LCD KS0107B PIC18F452

Routines in ‘C’ to drive a 128×64 graphic LCD type OGM64GS12D / OGM128GN15D (Orion Display Technology) Lextronic home. This display uses drivers KS0107B + type + HD61203 HD61202 or KS0108B or S6B0107 + S6B0108.
The display is controlled by a PIC18F452.

GRAPHIC LCD KS0107B PIC18F452

WINAMP LCD PIC16F877

This arrangement allows you to control Winamp from an infrared remote control and display the song title on a LCD 122×32 pixels.

It uses a PIC16F877 connected to the RS232 port of the PC to the infrared receiver. The display is assigned to a graphic LCD 122×32 (drivers NJU6450A or SED1520) with backlight in Selectronic (ref. 41.6026 to 13.50 euro including VAT). This allows to display images of 122×32 pixels, not against it displays text directly, the PIC is responsible; and can display 20 characters (x 4 lines) with 5×7 font and 15 characters with 8×8 font. The PC sends the text and images via the serial port to which the PIC transmits to the display with checksum verification. This solution saves time at the PC that does not have to manage the 5×7 and 8×8 fonts and thus divides transfers by 6-8.

WINAMP LCD PIC16F877

PIC18F452 NOKIA 3310 LCD SPI

Nokia 3310 LCD screen LCD focussed Le piloted by un 18F452 SPI soft

 

PIC18F452 NOKIA 3310 LCD SPI

source: sjeffroy.free.fr Hi Tech C LCD Examples source code circuits schematic files alternative link:

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-7964.zip

Source: HI TECH C LCD EXAMPLES PIC18F452, PIC16F877

The post HI TECH C LCD EXAMPLES PIC18F452, PIC16F877 appeared first on PIC Microcontroller.

PIC16F876 MIDI SPLITTER CIRCUIT WITH LCD DISPLAY

$
0
0

Circuit pic16f876 microcontroller and SN74LS00 NAND gate integrated based on the midi input CNY17 opto Kubla with disabled insulated isolated single midi signal 2 as output enlarge able 2 × 16 LCD screen on the selected channel information can… Electronics Projects, PIC16F876 Midi splitter Circuit with LCD display “microchip projects, microcontroller projects, pic16f876 projects,

PIC16F876 MIDI SPLITTER CIRCUIT WITH LCD DISPLAY

Circuit pic16f876 microcontroller and SN74LS00 NAND gate integrated based on the midi input CNY17 opto Kubla with disabled insulated isolated single midi signal 2 as output enlarge able 2 × 16 LCD screen on the selected channel information can be seen software in assembly language prepared pic audio Signals processing in can be an example

source davbucci.chez-alice.fr PIC16F876 Midi splitter Circuit with LCD display schematic source code Alternative link:

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-6617.zip

Source: PIC16F876 MIDI SPLITTER CIRCUIT WITH LCD DISPLAY

The post PIC16F876 MIDI SPLITTER CIRCUIT WITH LCD DISPLAY appeared first on PIC Microcontroller.

COLOR SENSE CIRCUIT LCD PIC16F877 PICBASIC PRO

$
0
0

This circuit using a PIC 16F877 microcontroller LCD (Liquid Crystal Display) has been applied on the color sensor. For circuit design and printed circuit board operations and Proteus ISIS Proteus ARES program is used. The operating logic circuits in … Electronics Projects, Color Sense Circuit LCD PIC16F877 Picbasic Pro ” microchip projects, microcontroller projects, pic16f877 projects, picbasic pro examples,

COLOR SENSE CIRCUIT LCD PIC16F877 PICBASIC PRO

This circuit using a PIC 16F877 microcontroller LCD (Liquid Crystal Display) has been applied on the color sensor. For circuit design and printed circuit board operations and Proteus ISIS Proteus ARES program is used. The operating logic circuits in a closed environment in order of ARD flashing light emitted from the LEDs is based on the influence resistance to change.

PIC16F877 Microcontroller Color Sense Project LDR placed in front of the light reflected from the object generates an analog signal with the effect of this signal microcontroller 16F877 ADC PORTA.0 from pins to entering the measurement is made. This circuit is previously determined LD colored cardboard placed in front of each color has its own signal table is deleted.

LDR CONNECTION

LDR CONNECTION

LDR as shown in the middle of three LEDs to be soldered to phenolic hole is made and resistance connections. Then close the circuit to the sensor panel of any box cover, etc .. and LEDs to close around a triangle is black colored cardboard.

NOTE: Circuit ldren in parallel to the signal cable from the LEDs if you put a value close to this value you can find. Values ​​in this way, but I try to find the resistance less than 330Ω resistor is not in my hand was making a very small value led me hooked 🙂

Circuit of the microcontroller code “microcode Studio Plus” “PicBasic PRO” and has been compiled compiler written in. For compiling files on your computer, the compiler must PBP246 and MPASM assembly.

All files belong to the color sensor with PIC16F877 isis circuit simulation software ares pcb and source files PicBasic pro:

FILE DOWNLOAD LINK LIST ( in TXT format ): LINKS-6483.zip

Source: COLOR SENSE CIRCUIT LCD PIC16F877 PICBASIC PRO 

The post COLOR SENSE CIRCUIT LCD PIC16F877 PICBASIC PRO appeared first on PIC Microcontroller.

WITH BUTTON CONTROL CCS C CIRCUIT LCD DISPLAY PIC16F877

$
0
0

CCS-C code that prepare “@ fxdev” a project done on request circuit up and down the third button 2 buttons to control the direction of the desired output number appears on the LCD

screen when the output of the… Electronics Projects, With Button Control CCS C Circuit LCD display PIC16F877 “ccs c examples, microchip projects, microcontroller projects, pic16f877 projects,

WITH BUTTON CONTROL CCS C CIRCUIT LCD DISPLAY PIC16F877

CCS-C code that prepare “@ fxdev” a project done on request circuit up and down the third button 2 buttons to control the direction of the desired output number appears on the LCD screen when the output of the first (+5 v) ensures that the

LCDs used 2 × 16 pic 2 LEDs on the bar connected to the outputs of simulation by making the necessary changes that will control transistor relay can add elements by

With Button Control Circuit LCD display PIC16F877 CCS C scurce code proteus isis simulation schematif files

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-6101.zip

Source: WITH BUTTON CONTROL CCS C CIRCUIT LCD DISPLAY PIC16F877

The post WITH BUTTON CONTROL CCS C CIRCUIT LCD DISPLAY PIC16F877 appeared first on PIC Microcontroller.


PIC16F877 LCD MOTORS SPEED INDICATOR ENCODER CIRCUIT

$
0
0

PIC16F877 microcontroller with LCD also shows the engine speed encoder circuit. These and the interrupt routine of the main program flow chart is a flow chart. PORT in the main program and is defined PORTB aspects. Then the program… Electronics Projects, PIC16F877 LCD Motors Speed indicator Encoder Circuit “microchip projects, microcontroller projects, pic16f877 projects,

PIC16F877 LCD MOTORS SPEED INDICATOR ENCODER CIRCUIT

PIC16F877 microcontroller with LCD also shows the engine speed encoder circuit. These and the interrupt routine of the main program flow chart is a flow chart.

PORT in the main program and is defined PORTB aspects. Then the program enters an infinite loop and is expected to come from the encoder pulse. Each pulse from the encoder when the “count” variable is incremented by one.

An interrupt routine to get every 66 ms. LCD is prepared to start the program again. Then every 66 ms to a motor speed is calculated and printed peers. Again using our program the ADC is adjusted by the motor speed PWM. PWM is already indicated in the flow chart.

PIC16F877 MOTORS SPEED INDICATOR ENCODER SCHEMATIC

PIC16F877 MOTORS SPEED INDICATOR ENCODER SCHEMATIC

Encoder project Files isis simulation schematic and pic c source code files

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-5596.zip

Source: PIC16F877 LCD MOTORS SPEED INDICATOR ENCODER CIRCUIT

The post PIC16F877 LCD MOTORS SPEED INDICATOR ENCODER CIRCUIT appeared first on PIC Microcontroller.

GRAPHIC LCD MODULE LIBRARY FOR SG12864AS CCS C COMPILER

$
0
0

Graphic LCD Module Library 2.0 CCS C This has created a dedicated library and font control.PIC so as not to create a library Tetsuya Gokan famous, I’d be with you This library has been included in the PIC16 SG12864… Electronics Projects, Graphic LCD Module Library for SG12864AS CCS C Compiler “ccs c examples, microchip projects, microcontroller projects,

GRAPHIC LCD MODULE LIBRARY FOR SG12864AS CCS C COMPILER

Graphic LCD Module Library 2.0 CCS C This has created a dedicated library and font control.PIC so as not to create a library Tetsuya Gokan famous, I’d be with you This library has been included in the PIC16

SG12864 new electronic products controlled by the PIC. I made the font libraries and library control. SG12232 previously handled by the vertically than two times the length of a large area. This module memory control LSI, and the visceral power of the LCD, outside the control IC can easily be controlled without having to connect directly to a microcontroller. Applications can be applied to a variety of shapes so not only can display fonts.

Graphic LCD Module Library for SG12864AS CCS C Compiler download:

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-5201.zip

Source: GRAPHIC LCD MODULE LIBRARY FOR SG12864AS CCS C COMPILER

The post GRAPHIC LCD MODULE LIBRARY FOR SG12864AS CCS C COMPILER appeared first on PIC Microcontroller.

AT89S52 DS1620 THERMOMETER CIRCUIT (LCD DISPLAY)

$
0
0

This project gave ds1620’n given as a result of the digitally using AT89S52 microcontroller is a graphic display of temperature information of the LCD screen. Moreover, the circuit ambient temperature when it reaches a temperature above 250C is no … Electronics Projects, AT89S52 DS1620 Thermometer Circuit (LCD Display) ” 8051 example, avr project, keil example, microcontroller projects,

AT89S52 DS1620 THERMOMETER CIRCUIT (LCD DISPLAY)

This project gave ds1620’n given as a result of the digitally using AT89S52 microcontroller is a graphic display of temperature information of the LCD screen.

Moreover, the circuit ambient temperature when it reaches a temperature above 250C is no longer a red LED lighting in the same way as the ambient temperature drops below 250C, a green LED lights up to notify user intended. 12 MHz crystal clock oscillator circuit to set the clock oscillator is used.

DS1620 is a temperature sensor and also the legs 8 is used as thermostat. Temperature is given as 9-bit data.

Demonstration of circuit temperature is obtained by using a 128 × 64 graphic LCD. LCD’s D0, D1, D2, D3, D4, D5, D6, D7 is provided with a connection to microcontrollers. Second intervals in the program I set the LCD also seems my school ID.

THERMOMETER CIRCUIT SCHEMATIC

THERMOMETER CIRCUIT SCHEMATIC

AT89S52 DS1620 Thermometer Circuit keil source code and proteus isis simulation schematic files:

FILE DOWNLOAD LINK LIST ( in TXT format ): LINKS-4761.zip

Source: AT89S52 DS1620 THERMOMETER CIRCUIT (LCD DISPLAY)

The post AT89S52 DS1620 THERMOMETER CIRCUIT (LCD DISPLAY) appeared first on PIC Microcontroller.

PIC16F628 LCD DISPLAY THERMOMETER CIRCUIT (DATE TIME)

$
0
0

LCD Display LCD display thermometer circuit have all the source files ares proteus simulation and PicBasic PRO source code files and proteus isis simulation proteus ares pcb files and other software Circuit Diagram and finished photos LCD Display Thermometer… Electronics Projects, PIC16F628 LCD Display Thermometer Circuit (date time) “microchip projects, microcontroller projects, pic16f628 projects, picbasic pro examples,

LCD Display LCD display thermometer circuit have all the source files ares proteus simulation and PicBasic PRO source code files and proteus isis simulation proteus ares pcb files and other software

CIRCUIT DIAGRAM AND FINISHED PHOTOS

CIRCUIT DIAGRAM AND FINISHED PHOTOS

LCD Display Thermometer Circuit Project files:

FILE DOWNLOAD LINK LIST (in TXT format): LINKS-4592.zip

Source: PIC16F628 LCD DISPLAY THERMOMETER CIRCUIT (DATE TIME)

The post PIC16F628 LCD DISPLAY THERMOMETER CIRCUIT (DATE TIME) appeared first on PIC Microcontroller.

PIC16F84 LCD DISPLAY LC METER

$
0
0

PIC16F84 LCD Display LC Meter circuit Box front waisted measure be careful when buying the box to cut the picture box paste it on top and falçata or drawing a knife then stop in the box bourdu to keep… Electronics Projects, PIC16F84 LCD Display LC Meter “microchip projects, microcontroller projects, pic16f84 projects,

PIC16F84 LCD DISPLAY LC METER

PIC16F84 LCD Display LC Meter circuit Box front waisted measure be careful when buying the box to cut the picture box paste it on top and falçata or drawing a knife then stop in the box bourdu to keep the four M3 screws and nuts, use Bordt USING the reader relays internal diode line is I’m a little late, I realized I did board relay leg reverse came first problem was that but in the scheme and BoardTM fix but I still protection diode I used the relay of different uses for kaldırmadım.pow source 12 Volt DC Jack (interior +) (outer portion of the Gnd)

I’ve used for testing terminal born request you make the connection, but the cable is too long to keep going to use.

Also I do jumper in a description:

J1: 16 × 1 LCD for those who want to use
J2: Frequency test
J3: Background light

CIRCUIT DIAGRAM, BOX SIZE, BOX SECTION, BOX CUT METHOD

CIRCUIT DIAGRAM, BOX SIZE, BOX SECTION, BOX CUT METHOD

Source: PIC16F84 LCD DISPLAY LC METER

The post PIC16F84 LCD DISPLAY LC METER appeared first on PIC Microcontroller.

Viewing all 253 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>