Monday, March 17, 2008

[oopic] Discussion on programming techniques to allow oDio1 and SCP control

After some searching without much success, I thought I would post this
for some discussion. During the last few days I have been learning about
SCP via Visual Basic 6 and I have it working like a charm. Now I am
brain storming on what would be the proper way of programming the OOPic
2.x+ to allow for both local and SCP control of IO lines, objects,
events, etc.

For my present application, I currently have an OOPic in operation that
monitors many oDio1 inputs and controls many oDio1 outputs based on the
program's logic. For example, some of the oDio1 inputs are momentary
contact switches to start or stop a process (electric motors) and some
of the oDio1 outputs then tell those motors to start or stop.

I have learned that changing an oDio1's input value does not work
because the OOPic is constantly updating its value based on the physical
hardware connected to that input. An oDio1's output value can be changed
if the program or a VC is not constantly updating the output value. So
currently I am using a variable as a "buffer". Below is a short OOPic
program example. I would like to hear of ways of doing this
differently/better.

ooPIC.Snode = 1
Dim In As New oDIO1 'address=41
Dim LED As New oDIO1 'address=42
Dim InStatus As New oBit 'address=127

Sub main()
In.IOLine=20
In.Direction=cvInput
LED.IOLine=21
LED.Direction=cvOutput
InStatus=In

'confirm LED IO lines/polarity is corrent
LED=1
ooPIC.Delay=500
LED=0
ooPIC.Delay=50
Do
If LED <> InStatus Then LED=InStatus
If In=1 Then
Wait Until In=0
InStatus.Invert
End If
Loop
End Sub
Here is the complete SCP string to change the value of InStatus to 1
whos value then gets copied to LED.
\1V127J1N\X

And the the complete SCP string to change the value of InStatus to 0
\1V127J0N\X

[Non-text portions of this message have been removed]


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments:

Post a Comment