Thursday, March 6, 2008

Re: [oopic] ocounter2h

On Mar 5, 2008, at 10:00 PM, ooPIC Tech Support wrote:
> I didn't think so, but I can check. Can you post a code sample?
>


Sure, here it is. I've done it with and without the delay, doesn't
seem to matter. The output is a conditioned hall-effect sensor, at
about -0.5VDC and 5VDC.

The A2D and motor run just fine. BTW, this is on an OOBOT-40
controller.
--kn

Dim LCD As New oLCDSE
Dim A2D As New oA2D
Dim A As New oDCMotor2
Dim T As New oCounter2H
Dim Ynm1 As New oWord
Dim speed As New oWord

Sub Main()
' set up lcd and A2D
LCD.IOLine = 8
LCD.Operate = cvTrue
LCD.Clear
A2D.IOLine = 1
A2D.Operate = cvTrue

' set up motor A.
A.IOLineP = 18 ' PWM1 to U3 enable 1.
A.IOLine1 = 24 ' U3 In1.
A.IOLine2 = 25 ' U3 In2.
A.Operate = 1
A.Brake = cvOff

' set up timer
T.Operate = 1
T.PreScale = 0
T.Operate = cvTrue

Do
LCD.Locate(0,0)
' LCD.String = "Pot = " + Str$(A2D.Value) + " "
A = A2D.Value - 127

LCD.String = Str$(T.Count) + " - " + Str$(Ynm2)
speed = T.Count - Ynm1
Ynm1 = T.Count

LCD.Locate(1,0)
LCD.String = "Speed = " + Str$(speed)

' ooPIC.Delay = 2
Loop
End Sub
--
Kevin Nickels <Kevin.Nickels@sbcglobal.net>


[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