15.2 PROJECT 15.2 – Electronic Book

15.2.1 Project Description

This project describes the design of an electronic book, where a number of pages are displayed on the screen. In this project, there are three pages for simplicity. Two arrow shaped buttons are placed at the bottom of the display. Clicking the right-hand arrow displays the next page (unless it is the last page), while clicking the left-hand arrow displays the previous page (unless it is the first page).

The project is given the name BOOK. The MikroMMB board is used in the design, as in the previous project. The project configuration steps are as in the previous project, and only the changes are given here.

3. Add Screen and Give it a Name
In this project, the four book pages are converted into images and are displayed on the screen. A separate screen is assigned to each page. The screens are named as SCREEN1, SCREEN2 and SCREEN3.
4. Place components
We will now load the pages (images) in our book, with each page loaded to a different screen. Initially, you can use a word processing package (e.g. Word or Notepad) to create the pages. In this example, the Microsoft Publisher was used, with Times New Roman and font size of 8. The number of characters on each line should not exceed 40 and the maximum number of lines should be no more than 8, leaving space for the buttons at the bottom. After creating each page, you should then convert the pages into image format and store as separate files, as these files will be loaded to the screens. If using the Microsoft Publisher, you can save the text as a picture by right clicking on the text.
In this example, the book consists of three pages, with the following text in each page:

15.2.1.1 PAGE 1

Laboratories are a very important part of every engineering course. Students learn the theory in classes and apply their knowledge into practise by using real equipment in laboratory sessions. For example, electronic engineering students learn the complex theory of transistor amplifiers in the classroom.

15.2.1.2 PAGE 2

Simulation is an alternative to real experiments. In control engineering, Matlab is the most widely used software simulation tool. Students can create a model of the system to be simulated by using transfer function blocks, summing points, test inputs, and source and sink devices. The system model can then be simulated by applying inputs and observing the response graphically.

15.2.1.3 PAGE 3

Although laboratory experiments are very useful, they have some problems associated with them:

1. Laboratory equipment can easily be damaged, for example by dropping or by misusing them.
2. The characteristics of real equipment can change with ageing and temperature.
3. Laboratory equipment is costly to purchase and maintain.

In the screen Properties window on the left, set screen colour to White, and orientation to Landscape. Click the Image tool and place it on the screen. Click next to Picture Name in Properties, and select the first page image of the book from the appropriate directory. Position the image to fit the screen. Next, click the Rounded Button tool and place a button at the bottom right-hand side of the image. Change the caption of this button to be ‘NEXT ->’, as shown in Figure 15.9.

Figure 15.9 Adding the first page image to the screen

img

Now, create a new screen by clicking on the green ‘ + ’ Add Screen tool placed at the top of the menu. Set the screen colour to White and the orientation to Landscape as before. Add the second page image to the screen, and this time place two buttons at the bottom of the screen, as shown in Figure 15.10, so that we can navigate to the next or the previous screens.

Figure 15.10 Adding the second image to the screen

img

Finally, place the last page image and add a button, as shown in Figure 15.11, so that we can navigate back to the previous page.

5. Assign Actions to Components
We can now assign actions to our components. When the display is reset, after calibrating the screen, the first image will automatically be displayed, since the StartScreen property of this screen is set to True. Now, we have to assign an action to the ‘NEXT ->’ button, so that when this button is pressed, the next image is displayed. Click on the ‘NEXT ->’ button, and then double click on ‘OnClick’ in the Properties window. An empty event function corresponding to this button will be displayed. Enter the following code inside the function, so that the second image will be displayed when the button is clicked:

img

Select Screen2 and click on ‘<- Previous’ button. Double click on ‘OnClick’ in the Properties window and enter the following code:

img

Similarly, click on the ‘NEXT ->’ button, double click on ‘OnClick’ in the Properties window and enter the following code, so that the third image is displayed when the button is pressed:

img

Finally, select Screen3 and click on ‘<- Previous’ button. Double click on ‘OnClick’ in the Properties window and enter the following code, so that the previous page image (image 2) is displayed when the button is clicked:

img

Figure 15.12 shows all the user action codes.

6. Generate the Code
We are now ready to generate the code for our project. Just click the ‘Generate Code’ icon in the top menu. You should get a message to say that the code has been generated successfully. The generated code can be seen by clicking the ‘Generated Code’ at the bottom part of the screen.
7. Compile the Code and Load to the Microcontroller

Figure 15.11 Adding the last image

img

Figure 15.12 User action codes

img

Click the icon ‘Start Compiler’ in the top menu to start the mikroC Pro for PIC compiler. Compile the program as before by clicking the ‘Build’ icon in the top menu. Load the program into the program memory of the microcontroller, using the Bootloader software as described in the previous project. Press the reset button on the display board to start the project. After calibrating the screen, you should see the first image displayed and you should be able to navigate to other images by clicking the appropriate buttons.

Figure 15.13 shows a typical display on the screen.

Figure 15.13 A typical display

img
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.6.153