SHOW:
|
|
- or go back to the newest paste.
1 | #include "nidaqmx.h" | |
2 | ||
3 | #include "process.h" | |
4 | ||
5 | TaskHandle task_alarm; | |
6 | void process_init (void){ | |
7 | DAQmxCreateTask("Alarm",&task_alarm); | |
8 | DAQmxCreateDIChan(task_alarm,”Dev0/port0”,"",DAQmx_Val_ChanForAllLines); | |
9 | } | |
10 | ||
11 | TStatusAlarm process_ReadAlarmSensor(void){ | |
12 | int32 data; | |
13 | DAQmxStartTask(task_alarm); | |
14 | DAQmxReadDigitalScalarU32(task_alarm,0.0,&data,NULL); | |
15 | DAQmxStopTask(task_alarm); | |
16 | if ((data & 0x20) == 0) { | |
17 | return ALARM_YES; | |
18 | } else { | |
19 | return ALARM_NO; | |
20 | } | |
21 | ||
22 | } |