Download DE2_Library_Manual.pdf PDF

TitleDE2_Library_Manual.pdf
TagsPointer (Computer Programming) Random Access Memory Parameter (Computer Programming) Library (Computing) Subroutine
File Size357.7 KB
Total Pages29
Document Text Contents
Page 15

DE2 Function Library Manual ▪ 11

SDRAM

Overview

The DE2 board has one 16-bit wide, 8-Mbyte SDRAM, which can be used for
frame buffer. The SDRAM is clocked at 100 MHz and this library support using the
SDRAM as a SRAM.

Setting up the SDRAM Driver

In order to use the SDRAM, you must first set up the driver by:

5. Initialize the Flash Memory Driver by calling the DE2SDRAMDriver()
macro.

6. Pass a pointer of type DE2SDRAM to the macro as a parameter.

Example: Setting up the SDRAM Driver


set clock = external "N2";



#include "DE2.hch"



void main(void)

{

DE2_SDRAM SDRAM; //Create a SDRAM Driver structure



DE2SDRAMDriver(&SDRAM); //Passing a pointer of type DE2_SRAM

}

Reading from and Writing to SDRAM

There are two macros for reading from and writing to the SDRAM. You must
ensure that you do not read and write to the SDRAM at the same time.



Chapter

4

Page 28

DE2 Function Library Manual ▪ 24

Expansion Header

Overview

The DE2 board has two 40-pin expansion headers / GPIO (General Purpose I/O).
The DE2 Library includes macros that allow you to

� Write to or read from the expansion headers

Assessing the Expansion Headers

You can access the expansion headers using the macro procedure:

� DE2GPIO_0(PinN,IO,Data)

� DE2GPIO_1(PinN,IO,Data)

PARAMETERS DESCRIPTION TYPE

PinN Pin number of the expansion header (0-40) unsigned 6

IO Set the particular pin to input or output taking value
1 or 0. 1 for input and 0 for output.

unsigned 1

Data Data to be written to or read from the particular pin unsigned 1



For example, to read a value from pin 0 on the expansion header GPIO_0 (JP1),
you would call DE2GPIO_0(0,1,data).



Chapter

10101010

Similer Documents