Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
9402d6a0
Commit
9402d6a0
authored
Jan 12, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of claes@pwrcvs:/data1/git/pwr
parents
b4d82252
9882e66f
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1497 additions
and
24 deletions
+1497
-24
otherio/exp/rt/src/os_templ/hw_templ/makefile
otherio/exp/rt/src/os_templ/hw_templ/makefile
+5
-1
otherio/exp/rt/src/pwr_arduino_uno.pde
otherio/exp/rt/src/pwr_arduino_uno.pde
+321
-0
otherio/lib/rt/src/os_linux/rt_io_m_velleman_k8055_board.c
otherio/lib/rt/src/os_linux/rt_io_m_velleman_k8055_board.c
+12
-3
otherio/lib/rt/src/rt_io_m_arduino_uno.c
otherio/lib/rt/src/rt_io_m_arduino_uno.c
+609
-0
otherio/lib/rt/src/rt_io_otherio.meth
otherio/lib/rt/src/rt_io_otherio.meth
+1
-0
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+463
-17
src/doc/man/en_us/man_iog.odt
src/doc/man/en_us/man_iog.odt
+0
-0
src/doc/man/en_us/man_iog.pdf
src/doc/man/en_us/man_iog.pdf
+0
-0
src/lib/rt/src/rt_plc.h
src/lib/rt/src/rt_plc.h
+1
-0
src/lib/rt/src/rt_plc_thread.c
src/lib/rt/src/rt_plc_thread.c
+10
-1
src/tools/pkg/ubu/pwr/control
src/tools/pkg/ubu/pwr/control
+1
-1
src/tools/pkg/ubu/pwrdemo/build.sh
src/tools/pkg/ubu/pwrdemo/build.sh
+1
-1
src/wbl/pwrb/src/pwrb_c_plcthread.wb_load
src/wbl/pwrb/src/pwrb_c_plcthread.wb_load
+10
-0
src/wbl/pwrb/src/pwrb_td_threadoptionsmask.wb_load
src/wbl/pwrb/src/pwrb_td_threadoptionsmask.wb_load
+63
-0
No files found.
otherio/exp/rt/src/os_templ/hw_templ/makefile
View file @
9402d6a0
...
...
@@ -23,7 +23,7 @@ all : init copy lib
init
:
copy
:
$(inc_dir)/libusbio.h
copy
:
$(inc_dir)/libusbio.h
$(inc_dir)/pwr_arduino_uno.pde
lib
:
...
...
@@ -43,6 +43,10 @@ $(inc_dir)/libusbio.h : ../../libusbio.h
@
echo
"Copying libusbio.h"
@
$(cp)
$(cpflags)
$(source)
$(target)
$(inc_dir)/pwr_arduino_uno.pde
:
../../pwr_arduino_uno.pde
@
echo
"Copying pwr_arduino_uno.pde"
@
$(cp)
$(cpflags)
$(source)
$(target)
...
...
otherio/exp/rt/src/pwr_arduino_uno.pde
0 → 100644
View file @
9402d6a0
//
// Proview
// Copyright (C) 2010 SSAB Oxelösund AB.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 2 of
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the program, if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Description:
// Sketch for Arduino USB board to communicate with Proview I/O
// object OtherIO:Arduino_Uno.
//
byte
msg
=
0
;
byte
sts
;
int
val
=
0
;
byte
amsg
[
50
];
byte
smsg
[
10
];
byte
diSize
=
0
;
byte
doSize
=
0
;
byte
aiSize
=
0
;
byte
aoSize
=
0
;
byte
diMask
[
10
];
byte
doMask
[
10
];
byte
aiMask
[
4
];
byte
aoMask
[
4
];
int
watchdogTime
=
5000
;
int
status
;
int
i
;
int
j
;
int
aiList
[
32
];
int
aiCnt
;
byte
msgType
;
byte
msgId
;
byte
msgSize
;
byte
msgData
[
100
];
byte
rmsg
[
40
];
int
sizeErrorCnt
=
0
;
int
noMessageCnt
=
0
;
const
int
delayTime
=
1
;
const
int
debug
=
0
;
const
int
MSG_TYPE_WRITE
=
1
;
const
int
MSG_TYPE_DIREAD
=
2
;
const
int
MSG_TYPE_AIREAD
=
3
;
const
int
MSG_TYPE_CONFIGURE
=
4
;
const
int
MSG_TYPE_STATUS
=
5
;
const
int
MSG_TYPE_DEBUG
=
6
;
const
int
ARD__SUCCESS
=
1
;
const
int
ARD__DICONFIG
=
2
;
const
int
ARD__DOCONFIG
=
4
;
const
int
ARD__AICONFIG
=
6
;
const
int
ARD__AOCONFIG
=
8
;
const
int
ARD__COMMERROR
=
10
;
const
int
ARD__MSGSIZE
=
12
;
const
int
ARD__NOMSG
=
14
;
void
sendDebug
(
byte
sts
)
{
rmsg
[
0
]
=
4
;
rmsg
[
1
]
=
0
;
rmsg
[
2
]
=
MSG_TYPE_DEBUG
;
rmsg
[
3
]
=
sts
;
Serial
.
write
(
rmsg
,
rmsg
[
0
]);
}
//
// Reset all outputs when communication communication is down
//
void
resetOutput
()
{
if
(
msgSize
==
doSize
)
{
for
(
i
=
0
;
i
<
doSize
;
i
++
)
{
for
(
j
=
0
;
j
<
8
;
j
++
)
{
if
(
((
1
<<
j
)
&
doMask
[
i
])
!=
0
)
digitalWrite
(
i
*
8
+
j
,
LOW
);
}
}
}
}
//
// Read a message from the serial port
//
int
serialRead
()
{
int
num
;
num
=
Serial
.
available
();
if
(
num
==
0
)
return
ARD__NOMSG
;
msgSize
=
Serial
.
peek
();
if
(
num
<
msgSize
)
return
ARD__MSGSIZE
;
msgSize
=
Serial
.
read
();
msgId
=
Serial
.
read
();
msgType
=
Serial
.
read
();
msgSize
-=
3
;
for
(
int
i
=
0
;
i
<
msgSize
;
i
++
)
msgData
[
i
]
=
Serial
.
read
();
if
(
debug
)
{
rmsg
[
0
]
=
msgSize
+
3
;
rmsg
[
1
]
=
msgId
;
rmsg
[
2
]
=
MSG_TYPE_DEBUG
;
for
(
int
j
=
0
;
j
<
msgSize
;
j
++
)
rmsg
[
j
+
3
]
=
msgData
[
j
];
Serial
.
write
(
rmsg
,
msgSize
+
3
);
}
return
ARD__SUCCESS
;
}
void
setup
()
{
// Start serial port at the configured baud rate
Serial
.
begin
(
9600
);
Serial
.
flush
();
}
void
loop
()
{
status
=
serialRead
();
if
(
status
==
ARD__NOMSG
)
{
if
(
watchdogTime
!=
0
)
{
// Increment watchdog counter
noMessageCnt
++
;
if
(
noMessageCnt
*
delayTime
>
watchdogTime
)
resetOutput
();
}
}
else
if
(
status
==
ARD__MSGSIZE
)
{
sizeErrorCnt
++
;
if
(
sizeErrorCnt
>
50
)
{
Serial
.
flush
();
sizeErrorCnt
=
0
;
}
}
else
if
(
(
status
&
1
)
!=
0
)
{
// A message is received
sizeErrorCnt
=
0
;
noMessageCnt
=
0
;
if
(
msgType
==
MSG_TYPE_WRITE
)
{
// Write digital outputs
if
(
msgSize
==
doSize
)
{
for
(
i
=
0
;
i
<
doSize
;
i
++
)
{
for
(
j
=
0
;
j
<
8
;
j
++
)
{
if
(
((
1
<<
j
)
&
doMask
[
i
])
!=
0
)
{
if
(
((
1
<<
j
)
&
msgData
[
i
])
!=
0
)
digitalWrite
(
i
*
8
+
j
,
HIGH
);
else
digitalWrite
(
i
*
8
+
j
,
LOW
);
}
}
}
sts
=
ARD__SUCCESS
;
}
else
{
sts
=
ARD__COMMERROR
;
}
}
else
if
(
msgType
==
MSG_TYPE_DIREAD
)
{
// Read Digital inputs
smsg
[
0
]
=
diSize
+
3
;
smsg
[
1
]
=
msgId
;
smsg
[
2
]
=
MSG_TYPE_DIREAD
;
for
(
i
=
0
;
i
<
diSize
;
i
++
)
{
smsg
[
i
+
3
]
=
0
;
for
(
j
=
0
;
j
<
8
;
j
++
)
{
if
(
((
1
<<
j
)
&
diMask
[
i
])
!=
0
)
{
val
=
digitalRead
(
i
*
8
+
j
);
if
(
val
==
HIGH
)
smsg
[
i
+
3
]
|=
1
<<
j
;
}
}
}
Serial
.
write
(
smsg
,
smsg
[
0
]);
}
else
if
(
msgType
==
MSG_TYPE_AIREAD
)
{
// Read analog inputs
amsg
[
0
]
=
aiCnt
*
2
+
3
;
amsg
[
1
]
=
msgId
;
amsg
[
2
]
=
MSG_TYPE_AIREAD
;
for
(
i
=
0
;
i
<
aiCnt
;
i
++
)
{
val
=
analogRead
(
aiList
[
i
]);
amsg
[
i
*
2
+
3
]
=
val
/
256
;
amsg
[
i
*
2
+
1
+
3
]
=
val
%
256
;
}
Serial
.
write
(
amsg
,
amsg
[
0
]);
}
else
if
(
msgType
==
MSG_TYPE_CONFIGURE
)
{
// Configure message
int
offs
=
0
;
sts
=
ARD__SUCCESS
;
if
(
debug
)
{
smsg
[
0
]
=
msgSize
+
3
;
smsg
[
1
]
=
msgId
;
smsg
[
2
]
=
MSG_TYPE_DEBUG
;
for
(
int
j
=
0
;
j
<
msgSize
;
j
++
)
smsg
[
j
+
3
]
=
msgData
[
j
];
Serial
.
write
(
smsg
,
smsg
[
0
]);
}
watchdogTime
=
msgData
[
offs
++
]
*
100
;
diSize
=
msgData
[
offs
++
];
if
(
diSize
>
10
)
{
diSize
=
10
;
sts
=
ARD__DICONFIG
;
}
if
(
sts
&
1
!=
0
)
{
for
(
i
=
0
;
i
<
diSize
;
i
++
)
diMask
[
i
]
=
msgData
[
offs
++
];
}
if
(
sts
&
1
!=
0
)
{
doSize
=
msgData
[
offs
++
];
if
(
doSize
>
10
)
{
doSize
=
10
;
sts
=
ARD__DOCONFIG
;
}
}
if
(
sts
&
1
!=
0
)
{
for
(
i
=
0
;
i
<
doSize
;
i
++
)
doMask
[
i
]
=
msgData
[
offs
++
];
}
if
(
sts
&
1
!=
0
)
{
aiSize
=
msgData
[
offs
++
];
if
(
aiSize
>
4
)
{
aiSize
=
4
;
sts
=
ARD__AICONFIG
;
}
}
if
(
sts
&
1
!=
0
)
{
for
(
i
=
0
;
i
<
aiSize
;
i
++
)
aiMask
[
i
]
=
msgData
[
offs
++
];
}
if
(
sts
&
1
!=
0
)
{
aoSize
=
msgData
[
offs
++
];
if
(
aoSize
>
4
)
{
aoSize
=
4
;
sts
=
ARD__AOCONFIG
;
}
}
if
(
sts
&
1
!=
0
)
{
for
(
i
=
0
;
i
<
aoSize
;
i
++
)
aoMask
[
i
]
=
msgData
[
offs
++
];
}
if
(
sts
&
1
!=
0
)
{
// Set Di pinmode
for
(
i
=
0
;
i
<
diSize
;
i
++
)
{
for
(
j
=
0
;
j
<
8
;
j
++
)
{
if
(
((
1
<<
j
)
&
diMask
[
i
])
!=
0
)
pinMode
(
i
*
8
+
j
,
INPUT
);
}
}
// Set Do pinmode
for
(
i
=
0
;
i
<
doSize
;
i
++
)
{
for
(
j
=
0
;
j
<
8
;
j
++
)
{
if
(
((
1
<<
j
)
&
doMask
[
i
])
!=
0
)
pinMode
(
i
*
8
+
j
,
OUTPUT
);
}
}
// Create list of configured Ai
aiCnt
=
0
;
for
(
i
=
0
;
i
<
aiSize
;
i
++
)
{
for
(
j
=
0
;
j
<
8
;
j
++
)
{
if
(
((
1
<<
j
)
&
aiMask
[
i
])
!=
0
)
{
aiList
[
aiCnt
]
=
i
*
8
+
j
;
aiCnt
++
;
}
}
}
}
// Send configuration status
smsg
[
0
]
=
4
;
smsg
[
1
]
=
msgId
;
smsg
[
2
]
=
MSG_TYPE_STATUS
;
smsg
[
3
]
=
sts
;
Serial
.
write
(
smsg
,
4
);
}
}
else
{
// Return error status
smsg
[
0
]
=
4
;
smsg
[
1
]
=
msgId
;
smsg
[
2
]
=
MSG_TYPE_STATUS
;
smsg
[
3
]
=
status
;
Serial
.
write
(
smsg
,
4
);
}
delay
(
delayTime
);
}
otherio/lib/rt/src/os_linux/rt_io_m_velleman_k8055_board.c
View file @
9402d6a0
...
...
@@ -36,6 +36,7 @@
#include "rt_io_m_usb_agent.h"
#include "rt_io_m_velleman_k8055_board.h"
static
int
last_usblib_sts
=
0
;
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
...
...
@@ -160,10 +161,14 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
pwr_tUInt32
error_count
=
op
->
Super
.
ErrorCount
;
// You have to read twice to get the latest ?????
sts
=
libusb_interrupt_transfer
(
local
->
libusb_device
,
endpoint
,
data
,
8
,
&
tsize
,
2
0
);
sts
=
libusb_interrupt_transfer
(
local
->
libusb_device
,
endpoint
,
data
,
8
,
&
tsize
,
2
0
);
sts
=
libusb_interrupt_transfer
(
local
->
libusb_device
,
endpoint
,
data
,
8
,
&
tsize
,
10
0
);
sts
=
libusb_interrupt_transfer
(
local
->
libusb_device
,
endpoint
,
data
,
8
,
&
tsize
,
10
0
);
if
(
sts
!=
0
||
tsize
!=
size
)
{
op
->
Super
.
ErrorCount
++
;
if
(
sts
!=
0
&&
sts
!=
last_usblib_sts
)
{
errh_Error
(
"K8055 libusb transfer error %d"
,
sts
);
last_usblib_sts
=
sts
;
}
return
IO__SUCCESS
;
}
else
{
...
...
@@ -278,9 +283,13 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
}
}
sts
=
libusb_interrupt_transfer
(
local
->
libusb_device
,
endpoint
,
data
,
size
,
&
tsize
,
2
0
);
sts
=
libusb_interrupt_transfer
(
local
->
libusb_device
,
endpoint
,
data
,
size
,
&
tsize
,
10
0
);
if
(
sts
!=
0
||
tsize
!=
size
)
{
op
->
Super
.
ErrorCount
++
;
if
(
sts
!=
0
&&
sts
!=
last_usblib_sts
)
{
errh_Error
(
"K8055 libusb transfer error %d"
,
sts
);
last_usblib_sts
=
sts
;
}
return
IO__SUCCESS
;
}
...
...
otherio/lib/rt/src/rt_io_m_arduino_uno.c
0 → 100644
View file @
9402d6a0
This diff is collapsed.
Click to expand it.
otherio/lib/rt/src/rt_io_otherio.meth
View file @
9402d6a0
...
...
@@ -5,6 +5,7 @@ Modbus_Module
Modbus_Master
Modbus_TCP_Server
Modbus_TCP_ServerModule
Arduino_Uno
#if OS_LINUX
GPIO
GPIO_Module
...
...
otherio/wbl/mcomp/src/otherio.wb_load
View file @
9402d6a0
This diff is collapsed.
Click to expand it.
src/doc/man/en_us/man_iog.odt
View file @
9402d6a0
No preview for this file type
src/doc/man/en_us/man_iog.pdf
View file @
9402d6a0
No preview for this file type
src/lib/rt/src/rt_plc.h
View file @
9402d6a0
...
...
@@ -154,6 +154,7 @@ struct plc_sThread {
plc_sArea
copy
;
io_tCtx
plc_io_ctx
;
pwr_tBoolean
first_scan
;
int
skip_count
;
};
struct
plc_sProcess
{
...
...
src/lib/rt/src/rt_plc_thread.c
View file @
9402d6a0
...
...
@@ -282,6 +282,7 @@ scan (
if
(
time_Dcomp
(
&
delta
,
NULL
)
>
0
)
{
pwr_tStatus
sts
;
int
phase
=
0
;
tp
->
skip_count
=
0
;
if
(
tp
->
csup_lh
!=
NULL
)
{
pwr_tTime
now
;
...
...
@@ -322,8 +323,16 @@ scan (
}
break
;
}
else
}
else
{
tp
->
sliped
++
;
if
(
tp
->
PlcThread
->
Options
&
pwr_mThreadOptionsMask_OverExecScanSingle
&&
tp
->
skip_count
<
10
)
{
tp
->
skip_count
++
;
break
;
}
else
if
(
tp
->
PlcThread
->
Options
&
pwr_mThreadOptionsMask_OverExecScanAlways
)
break
;
}
}
while
(
!
tp
->
exit
);
...
...
src/tools/pkg/ubu/pwr/control
View file @
9402d6a0
...
...
@@ -3,7 +3,7 @@ Version: 4.8.0-1
Section: base
Priority: optional
Architecture: i386
Depends: libc6 (>= 2.12.1-0ubuntu6), libgtk2.0-0 (>= 2.22.0-0ubuntu1), libasound2 (>= 1.0.23-1ubuntu2), libdb4.
7 (>=4.8.30-1), libdb4.7++ (>=4.8.30.
1), libmysql++3 (>= 3.0.9-1ubuntu2), g++ (>= 4:4.4.4-1ubuntu2)
Depends: libc6 (>= 2.12.1-0ubuntu6), libgtk2.0-0 (>= 2.22.0-0ubuntu1), libasound2 (>= 1.0.23-1ubuntu2), libdb4.
8 (>=4.8.30-1), libdb4.8++ (>=4.8.30-
1), libmysql++3 (>= 3.0.9-1ubuntu2), g++ (>= 4:4.4.4-1ubuntu2)
Replaces: pwrrt,pwr34,pwr39,pwr40,pwr41,pwr42,pwr43,pwr44,pwr45,pwr46,pwr47
Maintainer: Proview <postmaster@proview.se>
Description: Proview development and runtime environment package
...
...
src/tools/pkg/ubu/pwrdemo/build.sh
View file @
9402d6a0
...
...
@@ -75,7 +75,7 @@ cd $currentdir
echo
"Name=Proview Demo"
echo
"Type=Application"
echo
"Comment=Start Proview Demo"
echo
"Exec=xterm -title
\"
Proview Demo Console
\"
-e 'export pwra_db=
$aroot
/db;source
\$
pwra_db/pwr_setup.sh;source
\$
pwra_db/pwra_env.sh set project pwrdemo""
$ver
"";export PWR_BUS_ID=999;pwr_rtmon'"
echo
"Exec=xterm -title
\"
Proview Demo Console
\"
-e '
source /etc/pwrp_profile;
export pwra_db=
$aroot
/db;source
\$
pwra_db/pwr_setup.sh;source
\$
pwra_db/pwra_env.sh set project pwrdemo""
$ver
"";export PWR_BUS_ID=999;pwr_rtmon'"
echo
"Icon=
$aroot
/db/proview_icon.png"
echo
"Categories=GNOME;GTK;Application;"
}
>
$pkgroot
/usr/pwrp/pwrdemo
$ver
/cnf/proviewdemo
$ver
.desktop
...
...
src/wbl/pwrb/src/pwrb_c_plcthread.wb_load
View file @
9402d6a0
...
...
@@ -57,6 +57,16 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Plc thread options.
! Specification of the action when the execution time exceeds
! the scantime.
!*/
Object Options $Attribute 36
Body SysBody
Attr TypeRef = "pwrb:Type-ThreadOptionsMask"
EndBody
EndObject
!/**
! Scan time for the plc thread.
!*/
Object ScanTime $Attribute 3
...
...
src/wbl/pwrb/src/pwrb_td_threadoptionsmask.wb_load
0 → 100644
View file @
9402d6a0
!
! Proview $Id$
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
! pwrb_td_threadoptionsmask.wb_load -- Defines the enum type ThreadOptionsMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Mask for thread options.
!*/
Object ThreadOptionsMask $TypeDef 53
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
Attr PgmName = "ThreadOptionsMask"
EndBody
!/**
! When the execution time exeeds the scantime
! the next scan is always executed.
!*/
Object OverExecScanAlways $Bit
Body SysBody
Attr PgmName = "OverExecScanAlways"
Attr Text = "OverExecScanAlways"
Attr Value = 1
EndBody
EndObject
!/**
! When the execution time exeeds the scantime ten times in
! a row, one scan is skipped.
!*/
Object OverExecScanSingle $Bit
Body SysBody
Attr PgmName = "OverExecScanSingle"
Attr Text = "OverExecScanSingle"
Attr Value = 2
EndBody
EndObject
EndObject
EndSObject
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