Help with a binary counter

I am having difficulty getting the sketch below to work. The aim was to develop a binary counter by utilising a while loop with a bitwise conditional operator, which uses a function which increments or decrements the count.

I also need to be able to start and stop the counter by entering A or B on the keyboard.

The issue i'm having is it doesn't seem to be counting upwards it should reach 63 before counting back down and also function does not stop when i enter B on my keyboard.

Any help/advice would be greatly appreciated by this newbie

// include the library code:
#include <LiquidCrystal.h>
// Sets up Global variales for serial data
bool stringComplete = false;
// Sets character input to serial monitor
char choice;
// Sets up out array of data
//byte values[63] ;
byte startByte = B0000001;

volatile bool on = false;
// initializes the library and defines the LCD interface pin numbers
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

void setup() {
  // Defines the ports
  DDRB = B11000000; //defines the port as read only
  DDRC = B00111111; //defines the port as write only
  
  // Defines which of the LCD's columns and rows will be used
  lcd.begin(16,2);
  // Message to greet the user
  lcd.print("Kenny's Counter");
  Serial.begin(19200);
  // creates 1 second delay
  delay(1000);
 }
  
  void loop()
  {
   // Set the cursor to column 0, line 1
     lcd.setCursor(0, 1);
     // check if the data has been received from the serial port
     byte receive;  
     // start of the if statement
   if (on)  
    {  
     // defines the count up loop
       while((startByte <= B00111111 || startByte >= B00000001) && true)
        {
     // debug print
     Serial.println(startByte);  
     // sends the value to the port C
     PORTC = startByte; 
     // peads the value to the port B
     receive = PINB;  
     // sets the cursor
     lcd.setCursor(0, 0);
     // clear the LCD
     lcd.clear();
     // print the number received to lcd
     // the BIN defines a binary output is wanted
     lcd.print(receive, BIN); 
     delay(300);
           Serial.println(startByte);
        }   
    
        
 void countUp();
        {
 if(!countUp)
 {
 startByte--;
 }
 else(countUp);
 { 
               startByte++;
 }
        

 } 
    }
  }
    

  
  void serialEvent(){
  while (Serial.available()){
    // read the new received byte
    char inchar = (char) Serial.read();
    // set the input string to the input char
    choice = inchar;
    // set the flag so that the loop will know to display the received data
    stringComplete=true;
    Serial.println(choice);
    if(choice == 'A')
    {
      on=true;
      
    }
    if (choice =='B')
    {
      on = false;
    }
    Serial.println(on);
    
  }
  }

Please explain. Any value that is and'ed with true is just itself, so

    while((startByte <= B00111111 || startByte >= B00000001) && true)

is exactly the same as

    while(startByte <= B00111111 || startByte >= B00000001)

I mention this not just to help you clean up, but in case there was something that it was supposed to do (which it won't...).

Also this

void countUp();

is a function declaration, not a function definition (i.e. body of code). Then you follow it with this:

 if(!countUp)

Again, not how this language works.

You mention bitwise operators, but there are none in the entire program.

Altogether quite a mess. I suggest hitting the books on C language, and writing some simpler sketches to learn how things work before you leap into port manipulation.

If you auto-format your code (CTRL-T in the IDE) you will see that your closing parenthesis are not correct. That is an easy way to see if you have balanced sets. You should also get rid the serialEvent() and just check Serial.available() to see if something is available and read that inside loop(). There are many examples in the IDE that you could leverage.