PDA

View Full Version : Coding Question ???


Chordline
12-10-04, 11:09 AM
Okay, I am learning ISOMAX. I have been reading through the manual. Do I understand this correctly?! You can have multiple codes called " Machines " on your ISOPOD? So are they all running at once? So say we make a code called Servos, Then one called sensors, and one called nav, If the sensors get an input like a wall being in front, it can switch over to nav and decide what to do, then goto servos to tell them what to do ? Can you use the same variable through out like servo one position being a variable, and any of the three " machines " change or modify it ? This is interesting. Thanks for the input..:)

DennisD
12-10-04, 01:49 PM
As one learner to another, the short answer to your question is, "Yes." You can install multiple state machines in a machine chain, and schedule the chain to run at a periodic rate. As I understand it, each time the machine chain runs, it iterates over all the state machines, evaluating the conditions of all the transitions for the machine's current state until it finds one that evaluates to true (or until it has evaluated all the conditions for the current state of that machine). If a condition evaluates to true, the action for that state is executed, then the state of the machine is set to a new value specified by the transition. Then the next machine in the chain is evaluated in the same way. So each machine gets a lick at the CPU each time the machine chain runs.

So you can indeed have one or more machines that update variables based on sensors, then some machines that make decisions based on those variables' values, then some machines that apply those values to the outputs. I am using this to create a "subsumption" architecture for a robot I'm building. My machine chain looks something like this:

MACHINE-CHAIN SUBSUMPTION
READ-SENSORS ( read encoders, sonars, etc. )
UPDATE-POSITION ( determine where I am )
SELECT-TARGET ( decide where I want to go )
LOCATE-TARGET ( determine how to get there )
GO-TOWARD-TARGET ( set desired velocity, acceleration, etc. )
AVOID-OBSTACLES ( override velocity to slow down & turn if sonars/IR detect obstacle ahead )
RECOVER-FROM-COLLISION ( override velocity to back up & turn if bump sensors are hit )
APPLY-OUTPUTS ( copy desired velocity to PWM outputs )
END-MACHINE-CHAIN

I just order the state machines in order from lowest priority to highest priority, and each one sets the output variables to the values it wants. If some condition for a higher-priority machine becomes true, it overrides the output variables set by a lower-priority machine. The last machine in the chain actually writes the values from the output variables to the motors.

Hope this helps,
Dennis

RMDumse
12-10-04, 04:52 PM
Yes, Dennis has given you a good response.

You can write code as either machines or threads.

The requirement is they don't trap the program counter, meaning they don't do backwards branches like do-loops or begin-untils etc. If you follow this paradigm, then the threads and machines can be assembled into a chain. The chains can be set to run periodically.

(If you don't do backwards branches, its hard to write enough code in line to take such a fast processor much time.)

The end effect is you can string many machines or threads together, and they will cooperate. You will experience the benefits of multitasking without the complex overhead.

You can communicate between machines with variables. Or you can use messages (which is probably more complex than necessary). Or you can sense states, where one machine senses if the other machine is ready, by being in a particular state. And finally, you can have master-slave machines where one master machine just decides it's going to switch another slave machine to a state (because its boss!).



Here's a quick example to illustrate. Here's a thread that can pulse an SRF04 sonar and take its reading.

LOOPINDEX PCNT
DECIMAL
1 PCNT START
10 PCNT END
EEWORD

HEX
: PULSE
PCNT COUNT
IF
PCNT RESET
D D47 ! ( TMRC0 HIGH
0 D4D ! ( ZERO TMRC1 CNTR REG. AND WASTE 10uS
5 D47 ! ( TMRC0 LOW
0080 D4F ! ( SET FOR FALLING EDGE CAPTURE
7A80 D4E ! ( IP/32 TMRC1 INPUT
THEN
; EEWORD

Bascially, this thread pulses the sonar once every 10 times called.

It can be installed in the periodically run machine chain with other machines.

MACHINE-CHAIN ALL
( ....
( ....
PULSE
( ....
END-MACHINE-CHAIN EEWORD

And any time one of the other machines wants to know the range to the object infront of the sonar, it just does this:

D4A @ AA /

which reads the result from the timer, and scales it into inches. On the stack is the result in inches.

(This thread could have also been written as a MACHINE, but is simple enough, it isn't necessary.)

Chordline
12-10-04, 06:13 PM
Thats Great. I have alot of ideas if i figure this right.. I appreciate the input. X-mas is very close. Ill have to ask Santa for my IsoPod.. LOL I really like the ideas you have given me. Thanks. Keep me posted will you. I would like code if you guys are upto it. It will help me understand Syntax.

ED

RMDumse
12-10-04, 10:25 PM
Have you been to the DOWNLOADs page? There are quite a few coding examples there.

Chordline
12-12-04, 08:48 PM
You betcha. I have enjoyed thumbing through it very much. i was hoping to get a completed program so i can see how the machines are set up, and how servo control works with sensors and nav data. (kinda of a complete program to pick apart as i learn) I appreciate all the input from you guys. I am looking forward to learning Fourth. I will keep you posted as I progress. I will need alot of help im sure.


I have been using the OOPIC-R upto now, and it uses Basic. I learned that in high school ( Gulp) back in the early eighties. It was good to reuse it again. As forth i have never learned, I am somewhat following the flow through a single Machine. I understand about forward and backward programing. For Next loops eat up the processor. As do Loop statements. I would continue with the OOPIC, except i have reached the end of its abilities and have not even begun to touch some of my more advanced projects yet. Thanks to all who take the time to read and post their ideas...

ED

Chordline
12-13-04, 07:23 AM
Okay I have got another servo question for you guys out there. On the OOPic-r The servo Power can be provided via jumpers to an independant power source, and the PWM comes from the oopic to drive the servos. When connectiong servos to the ISOPOD is their a problem with this ? Or do you have to provide regulated power and PWM from the ISOPOD? I currently run my servos from a seperate power source and only hook them to the output for the PWM. Below you will see the code i used to program the oopic. Its written in basic, and this is the non-compiled portion. I will try to paste a picture of the compiler here also. This will hopefully let you guys know what im used to. (But still looking forward to Forth)

You will notice at the end of the code a section called "DIPTEST" that was added because i got tired of down loading new programs. Its basically a BCD Switch, and by setting it, i could rotate programs. ( My Buddy did it first) Hence Viper 37 credits at the top. I hope to hear from you guys soon.

ED


' The WengBot 2 Program
' Built and programed by
' Viper 37 May 17 2004

Dim srf08 as new oI2C 'Sonar
Dim Compass as new oI2C 'Compass
Dim LCD as new oLCDSE 'LCD
Dim Ir as new oIRRange 'Infared
Dim LBump as new Odio1 'Left Bump
Dim RBump as new Odio1 'Right Bump
Dim Cal as new oDio1 'Compass Calibrate
Dim LServo as new OServo 'Left Servo
Dim RServo as new OServo 'Right Servo
Dim PServo as new OServo 'Sonar Panning Servo
Dim Dip1 As New oDio1 'Make 1 bit object. for command encoder
Dim Dip2 as New oDio1 'Make 1 bit object. for command encoder
Dim Dip3 As New oDio1 'Make 1 bit object. for command encoder
Dim Dip4 as New oDio1 'Make 1 bit object. for Command encoder
Dim ChassyLED1 as New oDio1 'left LED on Chassy
Dim ChassyLED2 as New oDio1 'Right LED on Chassy
Dim RedLed as new oDio1 'Red LED light
Dim GreenLED as new oDio1 'Green LED light
Dim DropL As New oDio1 'Make 1 bit object. Left IR Sensor
Dim DropR As New oDio1 'Make 1 bit object. Right IR Sensor
Dim Light as Byte 'Light from Sonar
Dim Range1 as new oByte 'Range1 From Sonar
Dim Range2 as new oByte 'Range2 From Sonar
Dim A as byte 'Loop varable
Dim B as byte 'Loop varable
Dim C as byte 'Loop varable
Dim E as byte 'Sonar panning varable
Dim EncodeA as byte 'Encoder binary 1 place holder
Dim EncodeB as byte 'Encoder binary 2 place holder
Dim EncodeC as byte 'Encoder binary 4 place holder
Dim EncodeD as byte 'Encoder binary 8 place holder
Dim Bearing as new oword 'Varable for compass to load into
Dim Heading as new oword 'Compass Heading
Dim Desired as word 'Desired Heading to follow
Dim FollowVariable as Byte 'distance error varable
Dim TouchA As New oEvent 'Make an Event. Left touch interrupt
Dim TouchB As New oEvent 'Make an Event. Right touch interrupt
Dim WireA As New oGate 'Make an OR gate. Left touch interrupt
Dim WireB As New oGate 'Make an OR gate. Right touch interrupt
Dim DropA as New oEvent 'Make an Event. Left Dropoff interrupt
Dim DropB as New oEvent 'Make an Event. Right Dropoff interrupt
Dim DWireA as New oGate 'Make an OR gate. Left Dropoff interrupt
Dim DWireB as New oGate 'Make an OR gate. Right Dropoff interupt

'------------------------------------------------------------
Sub Main()
call Setup
LCD.clear
Call LCDweng

WireA.Input1.Link (lbump) 'Left touch event
WireA.Output.Link (touchA.operate)
WireA.operate = cvTrue
WireB.Input1.Link (rbump) 'Right touch event
WireB.Output.Link (touchB.operate)
WireB.operate = cvTrue
DWireA.Input1.Link (DropL) 'Left Dropoff event
DWireA.Output.Link (DropA.operate)
DWireA.operate = cvTrue
DWireB.Input1.Link (DropR) 'Right Dropoff event
DWireB.Output.Link (DropB.operate)
DWireB.operate = cvTrue
Call DropA_code 'look at drop sensor
Call DropB_code 'look at drop sensor
Call DipTest 'See what program to run
Call Compass1
Desired = Bearing 'Get first bearing to follow
do
For A = 1 to 2
Call SonarDet 'Ping sonar 1 time a loop
Call MeasureLight
' Call SonarAvoid 'Old sonar code
' Call Sonar1 'Panning sonar code
' LCD.clear
' LCD.String = "Sonar"+str$(range1)
' lcd.clear
' lcd.string = "light"+str$(light)
For B = 1 to 2
Call IRR 'check IR Range 2 times a loop
For C = 1 to 2
Call NavAid 'Maintain Bearing 4 times a loop
lcd.clear
lcd.string = "Bearing"+str$ (bearing)
Next C
Next B
Next A
loop 'loop forever
end sub 'end of program

sub LcdWENG()
lcd.clear
lcd.value = 254
lcd.value = 134
lcd.string = " THE "
lcd.value = 254
lcd.value = 196
lcd.string = " WENGBOT 2"
oopic.delay = 100
lcd.clear
end sub

Sub SonarDet()
ReadSonar(112)
end sub

Sub ReadSONAR(addr as byte) 'Ping Sonar
Srf08.node = addr
Srf08.Location = 0
Srf08 = 80
oopic.Delay = 7
Srf08.Location = 1
Light = Srf08
Srf08.Width = cv16bit
SRF08.Location = 2 ' Range Register
Range1 = Srf08
SRF08.Width = cv8bit ' 1 byte wide transfer
SRF08 = 70 ' Limit 1st sonar Range to 6m, 140 x 43mm = 6m
srf08.location = 4
Range2 = Srf08
End Sub

Sub MeasureLight()
If Light < 11 then
ChassyLED1 = 1 'left Chassy LED when dark outside
ChassyLED2 = 1
Else
ChassyLED1 = 0
ChassyLED2 = 0
end if
End Sub

Sub SonarAvoid()
if Range1 < 6 then
LCD.clear
lcd.string = "sonar close"
Rservo = 60
Lservo = 0
oopic.delay = 100
Lservo = 60
Desired = Bearing 'Record new bearing
end if

if (Range1 > 6) and (Range1 < 18) then
lcd.clear
lcd.string = "Sonar Far"
Lservo = 60
Rservo = 60
oopic.delay = 50
Rservo = 60
Desired = bearing 'Record new bearing
end if
end sub

Sub Sonar1() '====================

If Range1 < 6 then 'set sonar theashold for near object
LCD.clear
LCD.string = "SONAR NEAR OBJECT"
Lservo = 31 'Stop
Rservo = 31
oopic.delay = 50
Lservo = 0 'Turn robot 90 degrees
Rservo = 60
oopic.delay = 160
Lservo = 60 'Resume
ElseIf (Range1 > 6) and (Range1 < 18) then 'set theashold far object
Select Case E 'deturmin left or right pan at the time
Case 1: 'Pan was looking left
LCD.clear
LCD.string = "SONAR FAR LEFT"
Rservo = 33 'slow right to avoid
Lservo = 60
Rservo = 60 'resume foward
Rservo = 60
Case 0: E = 0 'Pan was looking right
LCD.clear
LCD.string = "SONAR FAR RIGHT"
Rservo = 60 'slow left to avoid
Lservo = 33
Lservo = 60 'resume foward
Rservo = 60
end select
else
Lservo = 60 'continue forward if no object detected
Rservo = 60
end if

If E = 0 then 'flip flop loop for panning
PServo = 36 'Pan slightly right
E = 1 'Set so next sonar loop pan will go left
Elseif E = 1 then
PServo = 24 'Pan slightly left
E = 0 'Set so next sonar loop will go right
End if
End Sub

Sub SonarTest1()
do
call readsonar(112)
lcd.clear
lcd.string = str$(range1)
oopic.delay = 10
loop
end sub

Sub Follow()
Lcd.clear
lcd.string = "FOLLOW"
Do
call ReadSonar(112)
LCD.clear
LCD.string = Str$ (range1)
FollowVariable = range1
select case FollowVariable
Case 21 to 1000
Lservo = 60 'Far away, catch up fast
Rservo = 60
Case 20
Lservo = 39
Rservo = 39
Case 19
Lservo = 38
Rservo = 38
Case 18
Lservo = 37
Rservo = 37
Case 17
Lservo = 36 'Far away, catch up medium
Rservo = 36
Case 16
Lservo = 35
Rservo = 35
Case 15
Lservo = 34
Rservo = 34
Case 14
Lservo = 33
Rservo = 33
Case 13
Lservo = 32
Rservo = 32 'Far away, catch up slow
Case 12
Lservo = 31
Rservo = 31
'----------------Stop
Case 11
Lservo = 30
Rservo = 30
Case 10
Lservo = 29 'too close, back up slow
Rservo = 29
Case 9
Lservo = 28
Rservo = 28
Case 8
Lservo = 27
Rservo = 27 'Too close, back up medium
Case 7
Lservo = 26
Rservo = 26
Case 6
Lservo = 25
Rservo = 25
Case 5
Lservo = 24
Rservo = 24
Case 1 to 4
Lservo = 0 'Too close, back up fast
Rservo = 0
end select
loop 'loop forever
end sub 'end of program

Sub Compass1() '=========================
'Values are in degrees 3599 is 359.9 degrees
compass.location = 2 'address of 2 byte bearing
compass.width = cv16bit 'Compass Data is 2-bytes wide
Bearing = Compass.Value 'Get data
end sub

Sub CompassTest()
LCD.clear
LCD.String = "Compass Test"
do
call compass1
lcd.clear
lcd.string = Str$(bearing)
oopic.delay = 10
loop
end sub

Sub NAVaid()
Call Compass1
If abs (Bearing - Desired) < 100 then 'If heading within dampen-band)
call NavFine
else
call NavCourse
end if
end sub

Sub NavCourse()
if Bearing > Desired then
RedLED = 1
Lservo = 33
Rservo = 60
elseif Bearing < Desired then
Lservo = 60
Rservo = 33
GreenLED = 1
else
Lservo = 60
Rservo = 60
end if
end sub

Sub NavFine()
if Bearing > Desired then
Lservo = 35
Rservo = 60
RedLED = 1
elseif Bearing < Desired then
Lservo = 60
Rservo = 35
GreenLED = 1
else
Lservo = 60
Rservo = 60
end if
end sub

'---------------
Sub NAVtest()
Do
Call Compass1
lcd.clear
lcd.string = str$ (bearing)
lcd.value = 254
lcd.value = 196
lcd.string = str$ (desired)
RedLED = 0
GreenLED = 0
If abs (Bearing - Desired) < 100 then 'If heading within dampen-band)
call NavFine
else
call NavCourse
end if
loop
end sub

Sub Calibrate()
Lcd.clear
lcd.string = "Compass Calibrate"
oopic.delay = 100
lcd.clear
lcd.string = "Point NORTH"
oopic.delay = 400
cal = 0
oopic.delay = 50
cal = 1

lcd.clear
lcd.string = "Point EAST"
oopic.delay = 400
cal = 0
oopic.delay = 50
cal = 1

lcd.clear
lcd.string = "Point SOUTH"
oopic.delay = 400
cal = 0
oopic.delay = 50
cal = 1

lcd.clear
lcd.string = "Point WEST"
oopic.delay = 400
cal = 0
oopic.delay = 50
cal = 1
lcd.clear
lcd.string = "Cal Complete"
oopic.delay = 100
lcd.clear
lcd.string = "You may play"
lcd.value = 254
lcd.value = 196
lcd.string = "with me now"
oopic.delay = 300
end sub

Sub IRtest()
LCD.clear
LCD.string = "IR Test"
do
lcd.clear
lcd.string = Str$(IR.value)
oopic.delay = 10
loop
end sub

Sub IRR()
if (IR < 55) and (IR > 20) then
LCD.clear
Lcd.string = "IR CLOSE"
Lservo = 60 'hard turn toward right
Rservo = 0
oopic.delay = 100
Rservo = 60 'resume forward
Desired = Bearing 'Record new bearing
end if

if (IR > 61) and (IR < 127) then
LCD.clear
LCD.string = "IR FAR"
Lservo = 60
Rservo = 33 'slow turn toward right
oopic.delay = 100
Rservo = 60 'resume
end if
Desired = Bearing 'Record new bearing
end sub

Sub TouchA_CODE() '================================
LCD.clear
LCD.String = "Left Bump"
Rservo = 31 'backing turn pivot to avoid
LServo = 0
LServo = 34 'forward check
Rservo = 34
OOPic.delay = 200
Lservo = 60
Rservo = 60
End sub

Sub TouchB_CODE()'============================
LCD.clear
LCD.string = "RIGHT BUMP"
Rservo = 0 'backing turn pivot to avoid
Lservo = 31
Rservo = 34 'forward check
Lservo = 34
OOPic.delay = 200
Lservo = 60
Rservo = 60
End Sub

Sub DropA_CODE() '=====================
LCD.clear
LCD.String = "Drop Left"
Lservo = 0
Rservo = 0 'emergency backup (sorry servos!)
oopic.delay = 100
Rservo = 31 ' backing pivot away
oopic.delay = 60
Lservo = 60
Rservo = 60
End sub

Sub DropB_CODE() '======================
LCD.clear
LCD.string = "Drop Right"
Lservo = 0
Rservo = 0 'emergency backup (sorry servos!)
oopic.delay = 100
Lservo = 31
oopic.delay = 70
Lservo = 60
Rservo = 60
end sub


Sub Setup()
'----Setup Left Servo---
LServo.Ioline = 31 'Left
Lservo.Center = 28
Lservo.Operate = cvTrue

'----Setup Right Servo---
Rservo.Ioline = 30 'Right
Rservo.Center = 28
Rservo.Operate = cvTrue

'---Setup Panning Servo
PServo.Ioline = 29
PServo.Center = 30
PServo.Operate = cvTrue

'----SETUP SONAR------
SRF08.Node = 112 ' Decimal of Hex address 0xE0 shifted right by 1
SRF08.Mode = cv10bit ' I2C mode is 10-Bit Addressing.
SRF08.NoInc = 1 ' Don't increment

'---SETUP COMPASS CALIBRATE--
Cal.IoLine = 14
Cal.Direction = cvOutput
Cal = 1

'--SETUP COMPASS--
Compass.Node = 96
Compass.Mode = cv10bit
Compass.NoInc = 1

'---SETUP LCD------
lcd.ioline = 16
lcd.clear

'----SETUP IR RANGERS------
IR.Ioline = 4
IR.Center = 7
IR.Operate = cvtrue
' 30 or less is nothing there
' 128 is max range

'---SETUP BUMP DETECTS----
Lbump.IoLine = 12
Lbump.Direction = cvInput
Rbump.IoLine = 11
Rbump.Direction = cvInput

'--SETUP DROP SENSORS--
DropL.IOLine = 8
DropL.Direction = cvInput
DropR.IOLine = 9
DropR.Direction = cvInput

'--SETUP ENCODER--
Dip1.Ioline = 17 'Binary 1 place holder
Dip1.Direction = cvInput
Dip2.IOLine = 18
Dip2.Direction = cvInput 'Binary 2 place holder
Dip3.Ioline = 24
Dip3.Direction = cvInput 'Binary 4 place holder
Dip4.IoLine = 25
Dip4.Direction = cvInput 'Binary 8 place holder

'--SETUP BOARD MOUNTED LED's---
RedLED.IoLine = 7
RedLed.Direction = cvOutput
GreenLED.IoLine = 5
GreenLED.Direction = cvOutput

'--SETUP CHASSY LED's-----------
ChassyLED1.IoLine = 15
ChassyLED1.Direction = cvOutput
ChassyLED2.IoLine = 10
ChassyLED2.Direction = cvOutput
ChassyLED1 = 1
ChassyLED2 = 1
oopic.delay = 30
CHassyLED1 = 0
ChassyLED2 = 0
oopic.delay = 30
ChassyLED1 = 1
ChassyLED2 = 1
oopic.delay = 30
ChassyLED1 = 0
CHassyLED2 = 0
end sub

Sub DipTest() '===========================
If Dip1.value = cvpressed then
EncodeA = 1
else
EncodeA = 0
end if
If Dip2.value = cvpressed then
EncodeB = 2
else
EncodeB = 0
end if
If Dip3.value = cvpressed then
EncodeC = 4
else
EncodeC = 0
end if
If Dip4.value = cvpressed then
EncodeD = 8
else
EncodeD = 0
end if

select case EncodeA+EncodeB+EncodeC+EncodeD
Case 1: LCD.clear '----------------
LCD.String = "Encoder = 1"
OOPic.delay = 50
LCD.clear
LCD.string = "Calibrate compass"
OOPic.delay = 200
call Calibrate
Case 2: LCD.clear '---------------
LCD.String = "Encoder = 2"
OOPic.delay = 50
LCD.clear
LCD.string = "Follow"
OOPic.delay = 100
Call Follow
Case 3: LCD.clear '--------------
LCD.String = "Encoder = 3"
OOPic.delay = 50
LCD.clear
LCD.String = "Sonar Test"
OOPic.delay = 100
Call sonartest1
Case 4: LCD.clear '-------------
LCD.String = "Encoder = 4"
OOPic.delay = 50
LCD.clear
LCD.String = "Compass Test"
OOPic.delay = 100
Call CompassTest
Case 5: LCD.clear '-------------
LCD.string = "Encoder = 5"
OOPic.delay = 50
Lcd.clear
lcd.string = "Nav Test"
oopic.delay = 100
Call Compass1
Desired = Bearing 'Get first bearing to follow
call NavTest
Case 6: LCD.clear '------------
LCD.string = "Encoder = 6"
OOPic.delay = 50
Case 7: LCD.clear '-----------
LCD.string = "Encoder = 7"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case 8: LCD.clear '-----------
LCD.string = "Encoder = 8"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case 9: LCD.clear '-----------
LCD.string = "Encoder = 9"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case10: LCD.clear '-----------
LCD.string = "Encoder = 10"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case 11: LCD.clear '-----------
LCD.string = "Encoder = 11"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case 12: LCD.clear '-----------
LCD.string = "Encoder = 12"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case 13: LCD.clear '-----------
LCD.string = "Encoder = 13"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case 14: LCD.clear '-----------
LCD.string = "Encoder = 14"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200
Case 15: LCD.clear '-----------
LCD.string = "Encoder = 15"
OOPic.delay = 50
Lcd.clear
lcd.string = "No Program"
oopic.delay = 200

Case else
LCD.clear '------------------
LCD.String = "Encoder = 0"
oopic.delay = 50
LCD.clear
LCD.String = "Roam Mode"
oopic.delay = 100
'call Roam
end select
end sub:D :D

RMDumse
12-15-04, 03:30 PM
Originally posted by Chordline
On the OOPic-r The servo Power can be provided via jumpers to an independant power source, and the PWM comes from the oopic to drive the servos. When connectiong servos to the ISOPOD is their a problem with this ? Or do you have to provide regulated power and PWM from the ISOPOD?

Need to discuss a little history first. The V1 IsoPod(TM) was 3.3" long and had 12 positions for servos. These 12 positions had a row for PWM signals (PWMA0-5 and PWMB0-5) a row for +V, and a row for GND. That +V signal could be jumpered to +5 for the board (if only a couple low current servos were used), but really was better supplied externally. So in this sense it was just as you describe for the OOPic-r.

As we gained more experience, we could see there were basically two sets of RC Servo users; 1) ones who had two RC servos, or 2) ones that had 18 RC Servos. You can see an IsoPod(TM) that could do 12 wasn't that great a solution. Particularly because if we brought out all the signals that could have been RC Servo drivers, there'd have been 26. So we switched to V2 IsoPod(TM) and made the board shorter (3.0" long) and took off the direct RC servo connections from the board.

Instead, we made an RC Servo adapter board. An IsoPod(TM) V2 with the adapter board could directly connect up to 26 RC Servos with the three signals; PWM signal, power, gnd.

I currently run my servos from a seperate power source and only hook them to the output for the PWM.

It's the better way. The motors in the servos are very noisy, and likely to spike and reset the processor, if not carefully filtered, or better yet, on a separate battery supply.

You can run the PWM signal and GND to your RC Servo connectors and supply the +V from the other battery, in probably the same way as you did with the OOPic. It can be done at the connector itself if you go without the adapter, or if you use the adapter, it has provisions for screw terminals for supplying the separate battery to the board, and that is distributed to the +V rails.

Below you will see the code i used to program the oopic. Its written in basic, and this is the non-compiled portion. I will try to paste a picture of the compiler here also. This will hopefully let you guys know what im used to. (But still looking forward to Forth)

That's quite a large program.

Chordline
12-16-04, 05:27 PM
So i need to buy another board for running servos then. Ok. The program is actually a couple of programs in one. I have 4 different modes. It depenant on the setting of the BCD switch on power up or reset. I am fascinated by coding and what it can do for the hardware interfacing. The same machine can have many functions. Only limited by the imagination and coding of the builder. I will hopefully be getting the Forth book soon. I will study up on it. I have already downloaded the compiler program. ( i believe) and will begin expiermenting with it soon after i get my Isopod. (and servo board)

I s there somewhere that shows the pin-out of the IsoPodX ? The manual (as far as i have read thru) doesnt show the i/o #s. I appreciate your guys time and help.

ED

RMDumse
12-16-04, 06:50 PM
Originally posted by Chordline
So i need to buy another board for running servos then. Ok.

No, sorry if I didn't get the point across. You don't have to buy another board. We do offer a board to make it easy, but you can merge the signals on an external connector very easily if you don't want to use our little adapter board.

I will hopefully be getting the Forth book soon.

We now have links to the book on-line.

I have already downloaded the compiler program. ( i believe) and will begin expiermenting with it soon after i get my Isopod. (and servo board)

Well, probably not the compiler. There is no compiler, per sa. You might have gotten the communications package, that lets the PC talk to the board. The language is an interpreting compiler, so any compilation actually takes place on board.

Being interactive with the board itself is something wonderful to experience, if you haven't before. To be able to ask the board a question even while the program is running is very enabling.

Is there somewhere that shows the pin-out of the IsoPodX ? The manual (as far as i have read thru) doesnt show the i/o #s. I appreciate your guys time and help.

Look at the silkscreen and schematic. It's all there.

http://www.newmicros.com/store/product_schematics_pdf/IsoPodX.pdf

BTW, this board does have the RC Servo patterns built in. So does the ServoPod(TM) and a few others.

nmitech
12-17-04, 08:52 AM
Chordline, the I/O's connectors & Jumpers are shown on page 79-85 in the IsoPodX manual,
http://www.newmicros.com/store/product_manual/IsoPodX.pdf