BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
4e6cf8e
Branches
Tags
master
mips_sys
fw
main.c
implemented displaying rotary counter (octal)
Stefan Schuermans
commited
4e6cf8e
at 2012-02-12 21:51:32
main.c
Blame
History
Raw
#include "cyc_cnt.h" #include "lcd.h" #include "leds.h" #include "switches.h" const int myconst = 0x12345678; int myvar = 0x11223344; volatile int data[100]; void switches(void) { lcd_chr(1, 0, switches_get_state(sw_0) ? '0' : ' '); lcd_chr(1, 1, switches_get_state(sw_1) ? '1' : ' '); lcd_chr(1, 2, switches_get_state(sw_2) ? '2' : ' '); lcd_chr(1, 3, switches_get_state(sw_3) ? '3' : ' '); lcd_chr(1, 4, switches_get_state(sw_east) ? 'E' : ' '); lcd_chr(1, 5, switches_get_state(sw_north) ? 'N' : ' '); lcd_chr(1, 6, switches_get_state(sw_south) ? 'S' : ' '); lcd_chr(1, 7, switches_get_state(sw_west) ? 'W' : ' '); lcd_chr(1, 8, switches_get_state(sw_center) ? 'C' : ' '); lcd_chr(1, 9, switches_get_state(sw_rot_a) ? 'a' : ' '); lcd_chr(1, 10, switches_get_state(sw_rot_b) ? 'b' : ' '); unsigned int cnt = switches_get_rot_cnt(); lcd_chr(1, 12, '0' + (cnt >> 9 & 0x7)); lcd_chr(1, 13, '0' + (cnt >> 6 & 0x7)); lcd_chr(1, 14, '0' + (cnt >> 3 & 0x7)); lcd_chr(1, 15, '0' + (cnt & 0x7)); } void delay(void) { unsigned int i; for (i = 0; i < 10; ++i) { switches(); cyc_cnt_delay_ms(20); } } int main() { unsigned int i; for (i = 0; i < sizeof(data) / sizeof(data[0]); ++i) data[i] = i; lcd_init(); lcd_str(0, "MIPS I system"); lcd_str(1, ""); while (1) { for (i = 0x1; i < 0x80; i <<= 1) { leds_set_state(i); delay(); } for (i = 0x80; i > 0x1; i >>= 1) { leds_set_state(i); delay(); } } return 0; }