Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
c8e01bfe
Commit
c8e01bfe
authored
Mar 14, 2018
by
Vinogradov Aleksei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
добавил параметр для настройки задержки считывания аналоговых каналов
parent
8929597c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
8 deletions
+25
-8
ComediInterface.cc
extensions/IOControl/ComediInterface.cc
+2
-2
ComediInterface.h
extensions/IOControl/ComediInterface.h
+1
-1
IOControl.cc
extensions/IOControl/IOControl.cc
+6
-3
IOControl.h
extensions/IOControl/IOControl.h
+2
-0
iocalibr.cc
extensions/IOControl/iocalibr.cc
+7
-1
iotest.cc
extensions/IOControl/iotest.cc
+7
-1
No files found.
extensions/IOControl/ComediInterface.cc
View file @
c8e01bfe
...
...
@@ -42,10 +42,10 @@ ComediInterface::~ComediInterface()
}
// -----------------------------------------------------------------------------
int
ComediInterface
::
getAnalogChannel
(
int
subdev
,
int
channel
,
int
range
,
int
aref
)
const
int
ComediInterface
::
getAnalogChannel
(
int
subdev
,
int
channel
,
int
range
,
int
aref
,
int
adelay
)
const
{
lsampl_t
data
=
0
;
int
ret
=
comedi_data_read_delayed
(
card
,
subdev
,
channel
,
range
,
aref
,
&
data
,
10000
);
int
ret
=
comedi_data_read_delayed
(
card
,
subdev
,
channel
,
range
,
aref
,
&
data
,
adelay
);
if
(
ret
<
0
)
{
...
...
extensions/IOControl/ComediInterface.h
View file @
c8e01bfe
...
...
@@ -32,7 +32,7 @@ namespace uniset
virtual
~
ComediInterface
();
// throw uniset::Exception
virtual
int
getAnalogChannel
(
int
subdev
,
int
channel
,
int
range
=
0
,
int
aref
=
AREF_GROUND
)
const
;
virtual
int
getAnalogChannel
(
int
subdev
,
int
channel
,
int
range
=
0
,
int
aref
=
AREF_GROUND
,
int
adelay
=
10
*
1000
)
const
;
// adelay = 10 мкс
// throw uniset::Exception
virtual
void
setAnalogChannel
(
int
subdev
,
int
channel
,
int
data
,
int
range
=
0
,
int
aref
=
AREF_GROUND
)
const
;
...
...
extensions/IOControl/IOControl.cc
View file @
c8e01bfe
...
...
@@ -37,7 +37,7 @@ namespace uniset
{
os
<<
"("
<<
inf
.
si
.
id
<<
")"
<<
uniset_conf
()
->
oind
->
getMapName
(
inf
.
si
.
id
)
<<
" card="
<<
inf
.
ncard
<<
" channel="
<<
inf
.
channel
<<
" subdev="
<<
inf
.
subdev
<<
" aref="
<<
inf
.
aref
<<
" range="
<<
inf
.
range
<<
" aref="
<<
inf
.
aref
<<
" range="
<<
inf
.
range
<<
" adelay="
<<
inf
.
adelay
<<
" default="
<<
inf
.
defval
<<
" safeval="
<<
inf
.
safeval
;
if
(
inf
.
cal
.
minRaw
!=
inf
.
cal
.
maxRaw
)
...
...
@@ -599,7 +599,7 @@ namespace uniset
{
if
(
it
->
stype
==
UniversalIO
::
AI
)
{
int
val
=
card
->
getAnalogChannel
(
it
->
subdev
,
it
->
channel
,
it
->
range
,
it
->
aref
);
int
val
=
card
->
getAnalogChannel
(
it
->
subdev
,
it
->
channel
,
it
->
range
,
it
->
aref
,
it
->
adelay
);
iolog3
<<
myname
<<
"(iopoll): read AI "
<<
" sid="
<<
it
->
si
.
id
...
...
@@ -869,6 +869,7 @@ namespace uniset
inf
->
disable_testmode
=
IOBase
::
initIntProp
(
it
,
"disable_testmode"
,
prop_prefix
,
false
);
inf
->
aref
=
0
;
inf
->
range
=
0
;
inf
->
adelay
=
10000
;
if
(
inf
->
stype
==
UniversalIO
::
AI
||
inf
->
stype
==
UniversalIO
::
AO
)
{
...
...
@@ -891,6 +892,8 @@ namespace uniset
<<
". Must be aref=[0..3]"
<<
endl
;
return
false
;
}
inf
->
adelay
=
IOBase
::
initIntProp
(
it
,
"adelay"
,
prop_prefix
,
false
);
}
iolog3
<<
myname
<<
"(readItem): add: "
<<
inf
->
stype
<<
" "
<<
inf
<<
endl
;
...
...
@@ -1019,7 +1022,7 @@ namespace uniset
else
if
(
it
->
stype
==
UniversalIO
::
AI
)
{
card
->
configureChannel
(
it
->
subdev
,
it
->
channel
,
ComediInterface
::
AI
);
it
->
df
.
init
(
card
->
getAnalogChannel
(
it
->
subdev
,
it
->
channel
,
it
->
range
,
it
->
aref
)
);
it
->
df
.
init
(
card
->
getAnalogChannel
(
it
->
subdev
,
it
->
channel
,
it
->
range
,
it
->
aref
,
it
->
adelay
)
);
}
else
if
(
it
->
stype
==
UniversalIO
::
AO
)
card
->
configureChannel
(
it
->
subdev
,
it
->
channel
,
ComediInterface
::
AO
);
...
...
extensions/IOControl/IOControl.h
View file @
c8e01bfe
...
...
@@ -276,6 +276,8 @@ namespace uniset
3 - analog ref = other (undefined)
*/
int
aref
;
int
adelay
;
/*! Задержка на чтение аналоговых входов с мультиплексированием ( в мкс ) */
/*! Измерительный диапазон
0 - -10В - 10В
...
...
extensions/IOControl/iocalibr.cc
View file @
c8e01bfe
...
...
@@ -72,6 +72,7 @@ int subdev = 0;
int
chan
=
0
;
int
range
=
0
;
int
aref
=
AREF_GROUND
;
int
adelay
=
10
*
1000
;
// 10 мкс
static
struct
option
longopts
[]
=
{
...
...
@@ -79,6 +80,7 @@ static struct option longopts[] =
{
"read"
,
required_argument
,
0
,
'r'
},
{
"subdev"
,
required_argument
,
0
,
's'
},
{
"aref"
,
required_argument
,
0
,
'a'
},
{
"adelay"
,
required_argument
,
0
,
'y'
},
{
"range"
,
required_argument
,
0
,
'x'
},
{
"device"
,
required_argument
,
0
,
'd'
},
{
"open_xml"
,
required_argument
,
0
,
'o'
},
...
...
@@ -143,6 +145,10 @@ int main(int argc, char* argv[])
range
=
uni_atoi
(
optarg
);
break
;
case
'y'
:
adelay
=
atoi
(
optarg
);
break
;
case
'a'
:
aref
=
uni_atoi
(
optarg
);
break
;
...
...
@@ -202,7 +208,7 @@ int main(int argc, char* argv[])
while
(
1
)
{
if
(
comedi_data_read_delayed
(
card
,
subdev
,
chan
,
range
,
aref
,
&
data
,
10000
)
<
0
)
if
(
comedi_data_read_delayed
(
card
,
subdev
,
chan
,
range
,
aref
,
&
data
,
adelay
)
<
0
)
{
fprintf
(
stderr
,
"can't read from channel %d
\n
"
,
chan
);
exit
(
EXIT_FAILURE
);
...
...
extensions/IOControl/iotest.cc
View file @
c8e01bfe
...
...
@@ -28,6 +28,7 @@
int
subdev
=
0
;
int
range
=
0
;
int
aref
=
AREF_GROUND
;
int
adelay
=
10
*
1000
;
// 10 мкс
int
chan
[
50
];
int
blink_msec
=
300
;
...
...
@@ -42,6 +43,7 @@ static struct option longopts[] =
{
"device"
,
required_argument
,
0
,
'd'
},
{
"verbose"
,
no_argument
,
0
,
'v'
},
{
"aref"
,
required_argument
,
0
,
'z'
},
{
"adelay"
,
required_argument
,
0
,
'y'
},
{
"range"
,
required_argument
,
0
,
'x'
},
{
"config"
,
required_argument
,
0
,
'c'
},
{
"autoconf"
,
no_argument
,
0
,
'a'
},
...
...
@@ -174,6 +176,10 @@ int main(int argc, char* argv[])
range
=
atoi
(
optarg
);
break
;
case
'y'
:
adelay
=
atoi
(
optarg
);
break
;
case
'z'
:
aref
=
atoi
(
optarg
);
break
;
...
...
@@ -312,7 +318,7 @@ int main(int argc, char* argv[])
if
(
autoconf
)
insn_config
(
card
,
subdev
,
chan
[
k
],
100
,
range
,
aref
);
int
ret
=
comedi_data_read_delayed
(
card
,
subdev
,
chan
[
k
],
range
,
aref
,
&
data
,
10000
);
int
ret
=
comedi_data_read_delayed
(
card
,
subdev
,
chan
[
k
],
range
,
aref
,
&
data
,
adelay
);
if
(
ret
<
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment