Beijing Institute of Electronic Technology (BESTI)
Real Inspection report
Course: Basic experiment of information security system design class: 1353 Name: Wei Hao Wang may also study number: 20135303 20135326
Score: Instructor: Lou Jia Peng Experimental Date: 2015.11.24
Experiment level: Preview degree: Experiment time: 15:30-18:00
Instrument Group: Compulsory/Elective: compulsory Test number: three
Experiment Name: draw sine cosine curve
Experimental purposes and requirements:
1. draw the sine cosine curve by ARM.
2. understand the meaning of the code, can modify the code, draw more than one curve.
Experimental instrument:
Name |
Model |
Number |
Computer |
|
1 |
Experiment contents, steps and experiences (attached paper):
First, the contents of the experiment
Write a simple virtual hardware driver on the PC and debug it, experiment-driven interface function implementation, analyze and understand the interaction between the driver and the application process.
Second, the experimental steps
1 Basic Development Environment
1.0 Connect the Experimental box power supply, use serial line, line, network cable, connect the experiment box and the host.
1.1 Install Ads (install files in 00-ads1.2 directory, crack method 00-ads1.2\crack directory)
1.2 Installing the Giveio driver (installation files in the 01-giveio directory)
Copy the entire Giveio directory to the C:\WINDOWS and copy the Giveio.sys file under the directory to c:/windows/system32/drivers.
In Control Panel, choose Add Hardware > Next > select-yes i have connected this hardware > Next > Check-Add New Hardware Device > Next > Check Install I manually select hardware from List > Next > select-Show All devices > Select-Install from disk-browse, specify drive as C:\WINDOWS\GIVEIO\giveio.inf file, click OK, install driver
1.3 Installing the JTAG driver (install files in the 02-uarmjtag2.0 directory)
1.4 Configure HyperTerminal: Baud rate is 115200, data bit 8, no parity, stop bit 1, no data flow control.
2 Test Installation
(1) First run the ADS1.2 integrated development environment.
(2) Select the project file we use the/ucos V6.0/exp11 drawing API function in the CD-ROM as an example, select EXP11.MCP and click Open.
(3) Click Make to compile the link. Compile results appear after compilation, and the secondary picture shows no errors, 4 warnings, and 15 additional information.
(4) Be sure to open Uarmjtag Click Initialize Configuration selection ARM9 Click OK before the debugger runs. Minimize to the pallet and ensure our platform stops in the Vivi state.
(5) Click the Debug button for simulation debugging
(6) Under Axd, click Options->configure target->configure. Modify the following: Name: Select Arm Ethernet driver;configuration: configured as: 127.0.0.1. Select ADP to click OK.
(7) Click the Run button.
Note: After the normal state he will stop at main function, which is automatic for the system.
(8) Then we continue to click the Run button to run the drawing experiment. This is the LCD screen will appear on our well-drawn sine graphics. Please pause and exit the program before closing.
3 modify code to show two curves
Modify the code as follows:
#include ". /ucos-ii/includes.h "/* Uc/os interface */
#include ". /ucos-ii/add/osaddition.h "
#include ". /inc/drivers.h "
#include ". /inc/sys/lib.h "
#include ". /src/gui/gui.h "
#include <string.h>
#include <stdio.h>
#pragma import (__USE_NO_SEMIHOSTING_SWI)//Ensure no functions that use semihosting
Task Definition ***************///
Os_stk main_stack[stacksize]={0,}; Main_test_task Stack
void Main_task (void *id); Main_test_task
#define Main_task_prio 12
Os_stk test_stack[stacksize]={0,}; Test_test_task Stack
void Test_task (void *id); Test_test_task
#define Test_task_prio 15
/************** already defined OS tasks *************
#define Sys_task_prio 1
#define Touch_screen_task_prio 9
#define Main_task_prio 12
#define Key_scan_task_prio 58
#define Lcd_fresh_prio 59
#define Led_flash_prio 60
***************************************/////////
Event Definition *****************///
/////////////////////////////////////////////////////
Main function. //
////////////////////////////////////////////////////
int main (void)
{
Armtargetinit (); Do Target (Uhal based ARM system) initialisation//
Osinit (); Needed by UC/OS-II//
Osinituart ();
Initosfile ();
#if use_minigui==0
Initosmessage ();
INITOSDC ();
Loadfont ();
#endif
Loadsystemparam ();
Create the tasks in Uc/os and assign increasing//
Priorities to them so, Task3 at the end of//
The pipeline has the highest priority. //
lcd_printf ("Create Task on ucos-ii...\n");
Ostaskcreate (Main_task, (void *) 0, (OS_STK *) &main_stack[stacksize-1], Main_task_prio);
Ostaskcreate (Test_task, (void *) 0, (OS_STK *) &test_stack[stacksize-1], Test_task_prio);// Remove this code comment to display two curves on the arm machine.
Osaddtask_init (1);
lcd_printf ("Starting ucos-ii...\n");
lcd_printf ("Entering graph mode...\n");
Lcd_changemode (Dspgramode);
Osstart (); Start the OS//
Never reached//
return 0;
}//main
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///
void Main_task (void *id)//main_test_task
{
int oldx,oldy;//Save the original coordinate system position
PDC pdc;//defining the drawing device context structure
int x,y;//coordinates
Double offset=0;//x coordinate offset
Clearscreen ();//Clear screen
Pdc=createdc ();//create Drawing device context
Setdraworg (PDC, LCDWIDTH/2,LCDHEIGHT/2, &OLDX, & Oldy); Set drawing origin as screen center
Circle (pdc,0, 0, 50);//Draw a circle
MoveTo (PDC,-50,-50);//Mobile
LineTo (PDC, 50,-50);//Draw Line
ArcTo (PDC, -20, TRUE, 30);//ARC Drawing
LineTo (PDC, 80, 20);
ArcTo (PDC, 30, TRUE);
LineTo (PDC,-50, 50);
ArcTo (PDC, -80, A, TRUE, 30);
LineTo (PDC,-80,-20);
ArcTo (PDC, -50, -50, TRUE, 30);
ostimedly (3000);//suspend a task for 3 seconds
Clearscreen ();
setdraworg (PDC, 0, LCDHEIGHT/2, &oldx,&oldy);//Set drawing origin to middle left of screen
for (;;)
{
MoveTo (PDC, 0, 0);
for (x=0;x<lcdwidth;x++)
{//Draw sine wave
y= (int) (50*sin ((double) x)/20.0+offset);
LineTo (PDC, x, y);
}
Offset+=1;
if (offset>=2*3.14)
offset=0;
ostimedly (1000);
Clearscreen ();
}
DESTORYDC (PDC);//delete drawing device context
}
void Test_task (void *id) // Add a curve
{
int oldx,oldy;//Save the original coordinate system position
PDC pdc;//defining the drawing device context structure
int x,y;//coordinates
Double offset=0;//x coordinate offset
Clearscreen ();//Clear screen
Pdc=createdc ();//create Drawing device context
Setdraworg (PDC, LCDWIDTH/4,LCDHEIGHT/4, &OLDX, & Oldy); Set drawing origin as screen center
Circle (pdc,0, 0, 50);//Draw a circle
MoveTo (PDC,-50,-50);//Mobile
LineTo (PDC, 50,-50);//Draw Line
ArcTo (PDC, -20, TRUE, 30);//ARC Drawing
LineTo (PDC, 80, 20);
ArcTo (PDC, 30, TRUE);
LineTo (PDC,-50, 50);
ArcTo (PDC, -80, A, TRUE, 30);
LineTo (PDC,-80,-20);
ArcTo (PDC, -50, -50, TRUE, 30);
ostimedly (3000);//suspend a task for 3 seconds
Clearscreen ();
setdraworg (PDC, 0, LCDHEIGHT/4, &oldx,&oldy);//Set drawing origin to middle left of screen
for (;;)
{
MoveTo (PDC, 0, 0);
for (x=0;x<lcdwidth;x++)
{//Draw sine wave
y= (int) (50*cos ((double) x)/20.0+offset);
LineTo (PDC, x, y);
}
Offset+=1;
if (offset>=2*3.14)
offset=0;
ostimedly (1000);
Clearscreen ();
}
DESTORYDC (PDC);//delete drawing device context
}
Ps: The code is marked red as the modified code.
Third, the experimental experience
This experiment is on the arm machine display sine cosine curve, because do not need to configure the virtual machine, the overall process is relatively concise, so according to the guide book introduction, installation Procedures, configuration and operation are achieved more smoothly. However, when compiling the code, the code will always compile errors, recompile after deleting the original compilation results, repeat several times after the error disappears, because the previous compilation results may not be overwritten. A sinusoidal curve eventually appears on the arm machine.
Through this experiment, we learned the ADS1.2 integrated development environment, and learned the new knowledge of using arm machine to compile. and read the understanding of C + + code, the learning of programming knowledge has certain help.
20135326. Three experimental reports of 20135303-linux experiment