EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Input text in array with push button.

Input text in array with push button.

|

Microcontroller › PIC › Input text in array with push button.

  • This topic has 1 reply, 2 voices, and was last updated 9 years, 7 months ago by GANEEV SINGH.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • July 18, 2016 at 10:33 am #4519
    Sujit Mishra
    Participant

    Dear Sir,

    Can you please guide me how to enter text in an array with simple 4 push button and save that array in an internal eeprom of pic16f877a.

    First buttton to increment character, Second button to decrement character, third button to shift cursor and fourth button to save the data in eeprom.

    Thanks,

    Sujit Mishra

    September 20, 2016 at 2:24 pm #14144
    GANEEV SINGH
    Participant

    Hi Sujit

    I don't know how to work with a PIC but I can surely help you with the logic behind this kind of code.

    Lets make it simple by using if-else instructions to check which button has been pressed and then perform the respective task. The code would be somewhat like this:

    first of all declare all variables to be used, like

    integer variable (say int i=0,j=64;)    //characters' ASCII value start from 65=90, check it out.

    character string (say char arr[10];)

    if(button 1 pressed)

    {

    if(j==90) //char is 'Z'

    {j=65}    //char becomes 'A'

    else

    {j++;}     //increment char

    arr=j;  //put char value in string's ith position

    }

    else if(button 2 pressed)

    {

    if(j==65 || j==64)   //char is either 'A' or its ASCII value is 64

    {j=90}  //char becomes 'Z'

    else

    {j–;}

    arr=j;

     

    }

    else if(button 3 pressed)

    {

    i++;   //increment string's position

    }

    else if(button 4 pressed)

    {

    arr[i+1]='';  //close the string with a null character

    i=0;   //reset i's value to 0

    //also here you should include a code which will store this string on eeprom of PIC

    } 

    You can adjsut the string size according to your need and look out for some code that will help you to store string in eeprom. Try searching out at EGs search bar (top right corner).

    You can also write a code to print this process on LCD, just add the LCDdisplay() lines just after if-else instructions.

    This might hlep you. Good luck!!

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Voltage comparator circuit verification May 10, 2026
  • What is this??? May 10, 2026
  • Why aren’t the power windows in my 2006 Volkswagen Polo 2006 working despite repairing the control unit circuit board? May 10, 2026
  • infiniBand Layer 1 specifications testing question May 8, 2026
  • block RF May 8, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise