?? demo.c
字號:
/*-----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support - ROUSSET -
*------------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*------------------------------------------------------------------------------
* File Name : demo.c
* Object : main application written in C.
* : Graphics LCD Demo Example
* Version | mm | dd | yy | author :
* 1.0 11 17 06 PFi : Creation
*
*------------------------------------------------------------------------------
* 1)Description:
*
* This file contains the different demo function to be called by the main
* application.
* It contains 3 demos:
* - AT91F_Demo1 : Simple ASCII character set and ATMEL logo display
* - AT91F_Demo2 : Animated Dancing pingouin
* - AT91F_Demo1 : Animated running cat.
*
-----------------------------------------------------------------------------*/
/* Include Standard LIB files */
#include "project.h"
#include "..\common\lib_twi.h"
#include "glcd_i2c_batron.h"
//#include "Images\atmel_logo.h"
#include "Images\atmel.h"
#include "Images\anime_cat.h"
#include "Images\anime_pingouin.h"
//#include "font\full_5_x_7_charset.h"
/* value of the PIT value to have 350ms @ 48 MHz */
#define PIT_PIV_SECOND_VALUE 0xFFFFF
/* value of the PIT value to have 333ns @ 48 MHz */
#define PIT_PIV_MILI_SECOND_VALUE 0x668
#define DELAY_PINGOUIN_IMG 120
#define DELAY_CAT_IMG 40
/*-----------------------------------------------------------------------------
* Wait function with the Periodic Interval Timer (PIT)
* The wait time unit is the max PIT rollover value, i.e 350ms @ 48 MHz
-----------------------------------------------------------------------------*/
void AT91F_WaitSecond (unsigned int seconde)
{
unsigned int PitStatus = 0; /* Status register of the PIT */
unsigned int PitLoop = 0; /* Store the number of PIT Loop */
AT91C_BASE_PITC->PITC_PIMR = AT91C_PITC_PITEN|PIT_PIV_SECOND_VALUE;
for( PitLoop=0; PitLoop <(seconde*3);) /* One PIT loop equals 333ms */
{
/* Wait for the PIT counter overflow occurs */
while ((AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS)==0);
/* Read the PIT Interval Value Reg to clear it for the next overflow */
PitStatus = AT91C_BASE_PITC->PITC_PIVR ;
/* dummy access to avoid IAR warning */
PitStatus = PitStatus ;
PitLoop++;
}
}
/*-----------------------------------------------------------------------------
* Wait function with the Periodic Interval Timer (PIT)
* The wait time is from 1ms to 999ms.
*----------------------------------------------------------------------------*/
void AT91F_WaitMiliSecond (unsigned int MiliSeconds)
{
unsigned int PitStatus = 0; /* Status register of the PIT */
unsigned int PitLoop = 0; /* Store the number of PIT Loop */
AT91C_BASE_PITC->PITC_PIMR = AT91C_PITC_PITEN|PIT_PIV_MILI_SECOND_VALUE;
for( PitLoop=0; PitLoop <(MiliSeconds*3);) /* One PIT loop equals 333ms */
{
/* Wait for the PIT counter overflow occurs */
while ((AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS)==0);
/* Read the PIT Interval Value Reg to clear it for the next overflow */
PitStatus = AT91C_BASE_PITC->PITC_PIVR ;
/* dummy access to avoid IAR warning */
PitStatus = PitStatus ;
PitLoop++;
}
}
void AT91F_Demo1(void)
{
/* Clear the LCD */
AT91F_Glcd_ClearLcd();
/* Printing the Standard ASCII CHARACTER SET 33 to 126 */
AT91F_Glcd_PutString(" Printing",LCD_PAGE_0,0);
AT91F_Glcd_PutString(" the",LCD_PAGE_1,0);
AT91F_Glcd_PutString(" Standard ASCII",LCD_PAGE_2,0);
AT91F_Glcd_PutString(" Character Set",LCD_PAGE_3,0);
AT91F_WaitSecond(2);
/* Clear the LCD and put it in normal mode */
AT91F_Glcd_ClearLcd();
AT91F_Glcd_VideoMode(Normal);
AT91F_WaitSecond(2);
/* Printing on page 0. /!\ To print the " character, use (\") */
AT91F_Glcd_PutString(" !\"#$%&'()*+,-./012",LCD_PAGE_0,0);
/* Printing on page 1 */
AT91F_Glcd_PutString("3456789:;<=>?@ABCDE",LCD_PAGE_1,0);
/* Printing on page 2 */
AT91F_Glcd_PutString("FGHIJKLMNOPQRSTUVWX",LCD_PAGE_2,0);
/* Printing on page 3 */
AT91F_Glcd_PutString("YZ[\"]^_`abcdefghijk",LCD_PAGE_3,0);
/* Printing on page 4 */
AT91F_Glcd_PutString("lmnopqrstuvwxyz{|}~",LCD_PAGE_4,0);
AT91F_WaitSecond(2);
/* Clear the LCD and put it in normal mode */
AT91F_Glcd_ClearLcd();
AT91F_Glcd_VideoMode(Normal);
/* Printing the Extended ASCII CHARACTER SET */
AT91F_Glcd_PutString(" Printing",LCD_PAGE_0,0);
AT91F_Glcd_PutString(" the",LCD_PAGE_1,0);
AT91F_Glcd_PutString(" Extended ASCII",LCD_PAGE_2,0);
AT91F_Glcd_PutString(" Character Set",LCD_PAGE_3,0);
AT91F_WaitSecond(2);
/* Clear the LCD and put it in normal mode */
AT91F_Glcd_ClearLcd();
AT91F_Glcd_VideoMode(Normal);
/* Printing on page 0 */
AT91F_Glcd_PutString("、¥ウЖ┆
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -