?? welcome.c
字號:
/* File: Welcome.C */
/****************************************************************************
*
* STK16XSW.MAIN
* =============
*
* Main module for "hello world" demo with text moving on LCD
*
* TQ-Systems GmbH
* ----------------
* Customer: TQ-Components
* Project : STK16XSW
* Tools : uVision 2.05
*
* Rev: Date: Name: Modification:
* ----+---------+----------------+------------------------------------------
* 100 27.04.01 K. Z鰌f taken over from STK16X.506
*****************************************************************************/
/****************************************************************************
*
* availability summary
*
* available for Starterkit: STK16X STK16XU
* conformed for Starterkit: STK16X STK16XU
* available for Modul : TQM164 TQM165 TQM165U TQM166 TQM167
* TQM167UL TQM167U TQM167LC
*
* conformed for Modul : TQM164 TQM165 TQM165U TQM166 TQM167
* TQM167UL TQM167U TQM167LC
*****************************************************************************/
/*==========================================================================*
* include files (#INCLUDE):
*===========================================================================*/
/*--------------------------------------------------------------------------*
* standard include files:
*---------------------------------------------------------------------------*/
#include <stdio.h> /* standard I/O */
#include <string.h> /* string functions */
#include <absacc.h> /* absolue access */
#include <reg167.h>
/*--------------------------------------------------------------------------*
* project specific include files:
*---------------------------------------------------------------------------*/
#include "lcd.h"
#include "led.h"
#include "timer.h"
/*==========================================================================*
* module internal definitions (#DEFINE):
*===========================================================================*/
/*==========================================================================*
* module internal type declarations (TYPEDEF):
*===========================================================================*/
/*==========================================================================*
* module internal constants (CONST):
*===========================================================================*/
const char *tqmmodule[] =
{
"Module UNDEF",
"Module UNDEF",
"Module UNDEF",
"Module UNDEF",
"Module TQM164",
"Module TQM165",
"Module TQM166",
"Module TQM167",
"Module TQM167LC",
"Module TQM167U",
"Module TQM167UE",
"Module TQM165U",
"Module TQM167UL"
};
/*==========================================================================*
* extern available constants (CONST):
*===========================================================================*/
/*==========================================================================*
* modul internal variables:
*===========================================================================*/
/*==========================================================================*
* globale external available variables (EXTERN):
*===========================================================================*/
/*==========================================================================*
* modul internal functions:
*===========================================================================*/
/*==========================================================================*
* extern available functions:
*===========================================================================*/
/*--------------------------------------------------------------------------*
* void main(void)
*---------------------------------------------------------------------------*
* FT: -
* EP: -
* RV: -
* GP: -
*---------------------------------------------------------------------------*/
void main()
{ int i,j;
char text[] = "is ready to run... * * * ";
char *p1; /* 1st position for output */
char *p2; /* output pointer for loop */
timer_init(NULL);
lcd_init();
led_init();
lcd_center(0, "Welcome to");
lcd_center(1, "Startkit demo");
/* start-up LED demo: */
for (i=0; i<=LED_MAX; i++)
{
led_set(i, LED_ON);
timer_delay_10ms(5);
}
for (i=0; i<=LED_MAX; i++)
{
led_set(i, LED_OFF);
timer_delay_10ms(5);
}
DP2= 0xFFFF;
P2 = 0x0000;
if (TQMMOD == TQM164) // check for TQM164
{
MVAR(unsigned int, 0xF106) = 0xff; // set port P1H as output
}
timer_delay_10ms(20);
lcd_center(0,tqmmodule[TQMMOD]); // Display Module type
DP2= 0xffff;
P2 = 0x0000;
p1 = text;
p2 = p1;
/* endless main loop: */
while(1)
{
/* ** ** ** moving text with blinkling LED ** ** ** */
for (j=0; j<strlen(text); j++)
{
p2 = p1;
for (i=0; i<16; i++)
{
lcd_char_at(i, 1, *p2++);
if (*p2 == 0) p2 = text;
}
p1 += 1;
if (TQMMOD == TQM164)
P1H ^= 0x00FF;
else
P2 ^= 0xFFFF;
timer_delay_10ms(25);
}
p1 = text;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -