lcd buttons control 3 steppers and display position

I want to use buttons control 3 steppers and display position on 12864LCD. but I don't know how to record pos and display.Anyone can help me
/------------------------VARIABLES FOR THE PUSH BUTTONS--------------------/

int x_button1State = 0; // current state of the x_button
int x_button2State = 0; // previous state of the x_button

int y_button1State = 0; // current state of the y_button
int y_button2State = 0; // previous state of y_button

int z_button1State = 0; // current state of the z_button
int z_button2State = 0; // previous state of z_button

/------STUFF FOR SENDING STRING TO GRBL VIA SERAL-------------------------/

#define _X_axis 'X'
//tbd define all values nothing hard coded
#define DUMMY_VALUE 'b' //dummy value in case of noise
#define SCALE '1' //number of milimiters to move
//may change it to a char for user to change it
char dir;
char axis;
#include "pins.h"
#include "control.h"
void readPushButtons(){
x_button1State = digitalRead(x_button1Pin);
x_button2State = digitalRead(x_button2Pin);
y_button1State = digitalRead(y_button1Pin);
y_button2State = digitalRead(y_button2Pin);
z_button1State = digitalRead(z_button1Pin);
z_button2State = digitalRead(z_button2Pin);

void logicPushButtons(){
// compare the buttonState to its previous state
if (((x_button1State == LOW) && !(x_button2State == LOW))) {
axis = 'X';
else if(((x_button2State == LOW) && !(x_button1State == LOW))) {
axis = 'X';
if (((y_button1State == LOW) && !(y_button2State == LOW))) {
axis = 'Y';
else if(((y_button2State == LOW) && !(y_button1State == LOW))) {
axis = 'Y';
if (((z_button1State == LOW) && !(z_button2State == LOW))) {
axis = 'Z';
else if(((z_button2State == LOW) && !(z_button1State == LOW))) {
axis = 'Z';

/void readEncoder_sendToGRBL(){
encoder_A_status = digitalRead(encoder0PinA);
if ((encoder0PinALast == LOW) && (encoder_A_status == HIGH)) {
if (digitalRead(encoder0PinB) == LOW) { //if encoder(mouse) goes backwards
dir = '-';
} else { //if encoder(mouse) goes forewards
dir = '+';
encoder0PinALast = encoder_A_status;

void sendValue(){
if(axis != DUMMY_VALUE){//print only when user has selected an axis

void DEBUG_sendValue(){
axis = 'X';
dir = '+';

void ini_pushButtons(){
// initialize the button pin as a input:
pinMode(x_button1Pin, INPUT);
pinMode(x_button2Pin, INPUT);
pinMode(y_button1Pin, INPUT);
pinMode(y_button2Pin, INPUT);
pinMode(z_button1Pin, INPUT);
pinMode(z_button2Pin, INPUT);

axis = DUMMY_VALUE;//this will disable sending anything to GRBL
//until the user selects an axis

If the device is send-only you are sending relative moves you will need to keep track of the position locally. Every time you send a command you will have to increment or decrement the position of the selected axis. Of course as soon as you hit a limit switch and GRBL prevents the motion from taking effect your position information will be incorrect.

You could keep the position locally and end only absolute moves (if the GRBL interface allows it). Then you could set your limits in the sender and always keep your position valid.

Most people would use Marlin on an Arduino MEGA 2560 and RAMPS shield. It has built-in support for LCD displays and manual positioning controls.