1. 第0章
l 工具的使用,包括SecureCRT、DNW
Serial tools secure CRT : Open secure CRT , set the port : COM1, set the Baud rate is 115200.
Serial tools DNW: Open DNW, set USB Port ,选择要烧写的程序
Different: S:Can use serial line for connection, but Can't use USB to download.
D: not only use serial line for connection, but also use USB to download.
l 测试程序TQ2440 Testing Program,11项功能
l Nandflash下载方法
1. Connect the serial port and USB.
2. Open the SecureCRT and DNW, and set the parameters of the tools.
3. After the success of the serial port connection, and restart.
4. Open ADS1.2, open theprogram, click the button of compile, click button of make and produce the file “*.bin”
5. In norflash state, with DNW, through the USB download this file “*.bin”
6. switch to nandflash options, View the downloaded program.
2. 第1章
l LCD_Type的作用
is mean of screen type, Through changing the value of the LCD_Type to change the type of screen, for example, LCD_Type == LCDS35 is mean of using the screen of 3.5 inch; LCD_Type == LCDW43 is mean of using the screen of 4.3 inch.
l CmdTip[]的作用
CmdTip[] is defined as a structure, including 12 strings corresponding 12 types of testing function, when we make testing, after displaying the 12 strings, we can choose one of them, and realize the performance of the function which corresponding the string.
l Paint_Bmp的基本原理
The function is used of giving value to LCD_BUFFER [x] [y] continually. Progressive scan the each pixel in the LCD and write different pixel which corresponds color values of the different locations of these points of the picture.
l TQ_LOGO.c的基本结构
l UART打印测试原理
l 3. 第2章
l ADS中创建新工程的流程
1. open ADS1.2, File >>new, Add the project name and path then click ok.
2. Got a empty new project.
3.Add the files to the new project, ADD File…
4.click ok .
l mcp工程中文件启动顺序
l Paint_Bmp()中bug的修改(P36)
The function of Paint_Bmp() can't display a picture of the not-full-screen with the accurate position.
void Paint_Bmp(int x0,int y0,int h,int l,unsigned char bmp[])
{
int x,y;
U32 c;
int p = 0;
for( y = 0 ; y < l ; y++ )
{
for( x = 0 ; x < h ; x++ )
{
c = bmp[p+1] | (bmp[p]<<8) ;
if ( ( (x0+x) < SCR_XSIZE_TFT) && ( (y0+y) < SCR_YSIZE_TFT) )
LCD_BUFFER[y0+y][x0+x] = c ;
p = p + 2 ;
}
}
}
l 科比投篮动画程序原理
On a picture of Kobe shot without the ball, Successive display the picture of the ball along a predetermined trajectory.
l RGB三原色16位表达的基本原理
RGB color principle is to use three primary colors, red, green, and blue, in different proportion together to produce a wide variety of colored light. Each pixel 16 (bits per pixel, BPP) code of RGB value: separately using 5, 6, 5 unsigned integer to represent the strength of red, green, and blue.
4. 第3章
l 触摸区域划分程序的基本原理
With xdata and ydata to on the screen divided area, which contains part for touch screen area,
For example,
if(ydata>0&&ydata<600&&xdata>0&&xdata<600)
Paint_Bmp(0,0,320,240,tul_320240);
The area divided by xdata and ydata can trigger touch interrupt.
l Paint_Bmp1的基本原理(图像缩放)
Suppose shrink eight times, Each row of the big picture, take a pixel every eight points, and then take one time every 8 rows, so that complete the picture shrink.
l 触摸点X轴和Y轴坐标值与像素点的映射关系及相关代码原理(触摸校正)
xdata = b*x+a, x is Pixel display coordinates of horizontal ordinate and xdata is touch the coordinates of the return value. the vertical axis is the same. for example:
xdata*=0.272;
ydata*=0.480;
ydata=480-ydata;
temp=ydata;
ydata=xdata;
xdata=temp;
xdata= (xdata-20.0303)/0.8972;
ydata= (ydata-37.86667)/0.7486;
5. 第4章
l Buzzer_Freq_Set代码原理
void Buzzer_Freq_Set( U32 freq )
{
rGPBCON &= ~3; //set GPB0 as tout0, PWM output
rGPBCON |= 2;
rTCFG0 &= ~0xff; // take the low eight as 0,
rTCFG0 |= 15; //prescaler = 15+1 Timer0,1 prescale value
rTCFG1 &= ~0xf;
rTCFG1 |= 2; // prescaler mux = 1/8
rTCNTB0 = (PCLK>>7)/freq; // Buffer register
rTCMPB0 = rTCNTB0>>1; // 50% comparator, and comparison the above registers, this is a low level share.
rTCON &= ~0x1f; // The timer control registers. To register is all the same. Low five for timer0
rTCON |= 0xb; //disable deadzone, auto-reload, inv-off, update
TCNTB0&TCMPB0, start timer 0
rTCON &= ~2; //clear manual update bit
}
l PWM占空比调节原理
duty ratio of PWM is controled by the comparison buffer registers(TCMPBn), for example,
rTCMPB0 = rTCNTB0>>1, the duty ratio of PWM is 50%.we can change the value of rTCMPB0 to change the duty ratio.
6. 第5章
l 理解char __CHS[]和char __VGA[]
l 理解Lcd_PutHZ和Lcd_PutASCII
7. 第6章(自己查资料)
l RTC原理
In an embedded system, real-time clock unit can provide a reliable clock, including the hour, minute, second, and year, month, day. Even if the system is turned off, it is also able to work properly (usually using the back-up battery-powered, can work reliably for decades), its peripherals do not need too much of the auxiliary circuit, you only need a high-precision crystal .
The data of clock uses the BCD code or binary to represent.
Real-time clock special function registers, including :
1.Real-time clock control (RTCCON -) register, The RTCCON register consists of four components, such as RTCEN for controlling the BCD register the ability of reading / writing, CLKSEL, CNTSEL and t CLKRST for testing .
The bit of RTCEN can control all of the interface between the CPU and the RTC, after system reset, the RTC control program must be set to 1 to make it to read / write. The same in the power-down before, the RTCEN bit should be cleared to 0 to prevent mistakenly from writing to the RTC registers
2. RTC alarm control register (RTCALM), RTCALM register determines enable of the alarm and alarm time. Please note that while the RTCALM register in the power-down mode through INT_RTC and PMWKUP alarm clock signal, but only produced in the normal operating mode INT_RTC.
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
void RTC_Time_Set( void )
{
rRTCCON = 1 ; //RTC read and write enable
rBCDYEAR = 0x08 ; //年
rBCDMON = 0x11 ; //月
rBCDDATE = 0x07 ; //日
rBCDDAY = 0x05 ; //星期
rBCDHOUR = 0x12 ; //小时
rBCDMIN = 0x00 ; //分
rBCDSEC = 0x00 ; //秒
rRTCCON &= ~1 ; //RTC read and write disable
}
void RTC_Display(void)
{
U16 year ;
U8 month, day ; // week
U8 hour, minute, second ;
RTC_Time_Set() ;
Uart_Printf( "\nRTC TIME Display, press ESC key to exit !\n" ) ;
while( Uart_GetKey() != ESC_KEY )
{
rRTCCON = 1 ; //RTC read and write enable
year = 0x2000+rBCDYEAR ; //年
month = rBCDMON ; //月
day = rBCDDATE ; //日
// week = rBCDDAY ; //星期
hour = rBCDHOUR ; //小时
minute = rBCDMIN ; //分
second = rBCDSEC ; //秒
rRTCCON &= ~1 ; //RTC read and write disable
Uart_Printf( "RTC time : %04x-%02x-%02x %02x:%02x:%02x\n", year, month, day, hour, minute, second );
Delay( 900 ) ;
}
l 万年历算法
char day=[“星期日”,“星期一”,“星期二”,“星期三”, “星期四”,“星期五”, “星期六”];
int a,b;
if(year<=2000)
{
a=2000-year;
b=6-(a+a/4-a/100+a/400)%7;
return b;
}
else
{
a=year-2000;
b=(a+1+(a-1)/4-(a-1)/100+(a-1)/400)%7+6;
return b%7;
}
l 模拟时钟的三针转动算法
#include <math.h>
#define Pi 3.1416
void function(int x0, int y0)//xo, yo
{
hour = rBCDHOUR;
min = rBCDMIN;
sec = rBCDSEC;
float h;
h = hour +(float)min/60+(float)sec/60;
int r_sec, r_min, r_hour;
Glib_Line(x0+r_hour*sin(h*6*Pi/180), y0-r_hour*cos(h*6*Pi/180),0xffffff);
Glib_Line(x0+r_sec*sin(sec*6*Pi/180), y0-r_sec*cos(sec*6*Pi/180),0xffffff);
Glib_Line(x0+r_min*sin(min*6*Pi/180), y0-r_min*cos(min*6*Pi/180),0xffffff);
}