Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----------------------------//adresy elementow systemowych
- #define SW0 0x00000001
- //----------------------------//biblioteki
- #include <stdio.h>
- #include <io.h>
- #include <system.h>
- #include "altera_up_avalon_parallel_port.h"
- #include "altera_up_avalon_character_lcd.h"
- #include "sys/alt_irq.h"
- #include "alt_types.h"
- #include "sys/alt_timestamp.h"
- #include "sys/alt_alarm.h"
- int swstate;
- int flaga_alarm;
- int i=0;
- alt_alarm alarm;
- alt_u32 alarm_proc(void *context){
- i=i+1;
- printf("\n ALARM %d", i);
- //alt_alarm_stop(&alarm);
- return 0;
- }
- int main(){
- flaga_alarm=1;
- swstate = IORD(PARALLEL_PORT_0_BASE, 0);
- while(1){
- switch(swstate&SW0){
- case 0:
- if(flaga_alarm==0){
- flaga_alarm=1;
- alt_alarm_start(&alarm,3*alt_ticks_per_second(),alarm_proc,NULL);
- printf("\n po alarmie");
- }
- //printf(" 0 ");
- break;
- case 1:
- //alt_alarm_stop(&alarm);
- flaga_alarm=0;
- printf(" 1 ");
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement