#include "sys/alt_stdio.h" #include "system.h" int main() { unsigned long regval; char onechar; lcd_init(); _wait(200000); while (1) { regval = *(volatile unsigned long *)PIO_1_BASE; *(volatile unsigned long *)PIO_0_BASE = regval; select_xy(0,0); lcd_prints("Toggle SW2(DIP8)"); select_xy(1,0); if((regval & 0x00000003) == 0) { lcd_prints("Bit1 Bit2 is L L"); } else if((regval & 0x00000003) == 1) { lcd_prints("Bit1 Bit2 is H L"); } else if((regval & 0x00000003) == 2) { lcd_prints("Bit1 Bit2 is L H"); } else { lcd_prints("Bit1 Bit2 is H H"); } } return 0; }