Connecting Dump Terminal
Computer circuits

Connecting Dump Terminal

By Wichit Sirichote


Some applications may not need user display and key interface, dump terminal is an alternative way for program setting, displaying user interfacing command.

Some applications may not need user display and key interface, dump terminal is an alternative way for program setting, displaying user interfacing command.Debugging, dump terminal connects with serial port, use only 2-i/o pin, P3.0 for Rxd and P3.1 for Txd. Any computers that has serial port and emulates as a dump terminal can be used for the purpose, the example used PC run terminal emulation program has COM1 9600baud 8data bit no parity, 1 stop bit. standard serial port is RS232C needs level converter from TTL to RS232C by using MAX232 or DS275. D1 is a dot LED used for testing program running.

Connecting Dump Terminal circuit
Connecting Dump Terminal circuit

terminal.c

This program displays simple clock on terminal. The 89C2051 sends ascii string representing real-time through TxD pin at 9600 baud.

/*
 * terminal.c
 * use terminal for displaying clock
 * Copyright (c) 1999 by Wichit Sirichote
 * compiled with Dunfield Micro-C for 8051 Release 3.2
 * c:\mc\cc51 terminal -i h=c:\mc m=t
 */

#include c:\mc\8051io.h  /* include i/o header file */
#include c:\mc\8051reg.h

extern register char cputick;

unsigned register char sec100,sec,min,hour,flag1;
 

main()
{
          flag1 = 0;
          hour = 17;
          min = 59;
          sec = 0;
          serinit(9600);
          while(1){
                while(cputick <10)
                ;
                cputick = 0;
                time();
                printtime();
          }
}

time ()
/* update real-time clock  */
{
   sec100++;
   if (sec100 >= 10)  /* 100 * 10 ms = 1 s */
   {sec100 = 0;
    flag1 |= 0x01;   /* set bit 0 */
    sec++;
    if (sec >= 60)
    {sec = 0;
     flag1 |= 0x02; /* set bit 1 */
     min++;
     if (min >= 60)
     {min = 0;
     hour++;
     if (hour >= 24)
     {hour = 0;

    }
  }
 }
}
}

printtime()
{
        if ((flag1 & 0x01) != 0)
        {
        printf("\n %02u:%02u:%02u",hour,min,sec);
        flag1 &= ~0x01;
        }
}

1371 19 September 2009

See also:


Soap 2 day

Search