DS1307 Interaction

I'm trying to understand how the 'T' in the following lines of code equates to 84. Or rather, what does the 84 mean? Thanks for the help in advance. I'm trying to learn.

void setup() {
Wire.begin();
Serial.begin(57600);

}

void loop() {
if (Serial.available()) { // Look for char in serial que and process if found
command = Serial.read();
if (command == 84) { //If command = "T" Set Date
setDateDs1307();
getDateDs1307();
Serial.println(" ");
}
else if (command == 81) { //If command = "Q" RTC1307 Memory Functions

Looks like it is just some users preferred command codes. You send a T down the serial line to set the date and a Q to set the memory functions.

84 is the ascii value of character 'T' => wiki

If writing :

       if (command == 84) {      //If command = "T" Set Date
...
     }
     else if (command == 81) {      //If command = "Q" RTC1307

seems a bit unmemorable, you can write it in a more natural way

      if (command == 'T') {      // 'T' Set Date
...
     }
     else if (command == 'Q') {      // 'Q' RTC1307

The only thing to remember is that for a single character that isn't a string, then use the single quote character ' instead of the double quote ".

HTH

Got it! Thanks.

Can someone provide some guidance? what does the following lines of code mean?.......for (i = 1; i <= 64; i++).........is it saying___ (if I=1 I is less than 64 Increase i)? Is this for Arduino memor or DS1307?

else if (command == 50)
{ //If command = "2" RTC1307 Memory Dump
getDateDs1307();
Serial.println(": RTC 1307 Dump Begin");
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.send(0x00);
Wire.endTransmission();
Wire.requestFrom(DS1307_I2C_ADDRESS, 64);
for (i = 1; i <= 64; i++)
{

It looks like that code will get all 64 of the RTC low level registers and display the contents to the serial port..

The DS 1307 datasheet describes the registers, if you only need the date and time you probably only need the first 8 registers.

for (i = 1; i <= 64; i++)
{
// do something
}

equates to:

Set variable i to equal 1.
continue to loop while variable i is less than or equal to 64
each iteration of the loop, increment variable i to equal the value of variable i + 1.

there is an article on c++ for loops here if you want more information
http://www.bluesfear.com/tutorials/C%2B%2BForloop.php