05.07.2013 Views

Script for Laboratory: Designing embedded ASIPs - CES

Script for Laboratory: Designing embedded ASIPs - CES

Script for Laboratory: Designing embedded ASIPs - CES

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Now we will demonstrate how you can create a small application that is using the LCD of the<br />

hardware prototype:<br />

• Create a new subdirectory inside the application directory of your ASIP Meister project<br />

and change into this new directory<br />

• Link to lib_lcd and loadStorByte, but executing:<br />

ln –s /usr/epp/StdLib/lib_lcd.* .<br />

ln –s /usr/epp/StdLib/loadStoreByte.* .<br />

lib_lcd has a dependency to loadStoreByte, that’s why you need both.<br />

• Add a new C file that contains you main method. This main method shall contain the<br />

following code as example:<br />

char* string = “Hello World\r\n”;<br />

t_print(string);<br />

The LCD needs the “\r\n” in the declared string, as it is handling carriage return (\r)<br />

and line feed (\n) independently.<br />

• Compile your project by executing ../mkall.<br />

The resulting program can be simulated with dlxsim or ModelSim or it can be uploaded to the<br />

hardware prototype as it is explained in Chapter 6.3.<br />

After you have once compiled a C-Code that rarely changes with mkall, you can reuse the<br />

created assembly code <strong>for</strong> future compilations. That will enormously speed up the whole<br />

compilation process. This is especially good <strong>for</strong> all applications in the StdLib directory. Just<br />

compile them one time with mkall and then copy the created .asm file from the compiler temp<br />

directory to the directory of your other application files, but name it .s instead of .asm. Then<br />

remove the C code (but not the header) to make sure the code does not exist twice (in the C<br />

code and in the Assembly file).<br />

8.5.1 Functions of the LCD library<br />

This chapter will summarize some of the available functions to access the features of the<br />

touch screen LCD of our hardware prototyping board.<br />

int checkbuffer()<br />

Returns the number of available bytes in the send buffer of the LCD. This instruction can be<br />

used to wait <strong>for</strong> a return value of the LCD. For example when pressing a button on the touch<br />

panel, a value of this button will be written to the LCD send buffer.<br />

int getbytes (char* dest, int bytes_to_read)<br />

Reads a specific number of bytes from the send buffer. With the checkbuffer function you can<br />

test how many bytes are available in the buffer.<br />

- 81 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!