Altera DE2-115 User's Guide Page 65

  • Download
  • Add to my manuals
  • Print
  • Page
    / 107
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 64
SFSU - Embedded Systems Tutorial Nano- Electronics & Computing Research Lab
64
Basic Software Algorithm
Initialize the screen
screen_x = 319; screen_y = 239;
char text[16];
color = 0x0000; // black color
VGA_box (0, 0, screen_x, screen_y, color); // fill the screen with background
Values of switches are pointed by allocating their base address
volatile int * switch1_ptr = (int *) 0x00101810;
volatile int * switch2_ptr = (int *) 0x00101820;
volatile int * switch3_ptr = (int *) 0x00101830;
volatile int * switch4_ptr = (int *) 0x00101850;
According to the switch position, the operation of ALU is decided.
00 : Addition
01: Subtraction
10: Logical OR
11 : Logical And
if (sel1&sel2)
{
sprintf( text_top_VGA, "My ALU");
sprintf (text,"%d + %d = %d ",number1,number2,number1 + number2);
}
else if (!sel1&sel2)
{
sprintf( text_top_VGA, "My ALU");
sprintf (text,"%d - %d = %d ",number1,number2,number1 - number2);
}
else if (sel1&!sel2)
{
sprintf( text_top_VGA, "My ALU");
Page view 64
1 2 ... 60 61 62 63 64 65 66 67 68 69 70 ... 106 107

Comments to this Manuals

No comments