That was a fast update!
Yes thanks for the update!
I installed both of them and uninstalled the older two beta versions.
Side note, probably for the very few who do want to try C programming. I still had to manually update my path variable to get the compiler pieces to work. I added:
;C:\Program Files\BasicMicro\BasicAtom-Pro IDE\h8300-coff\lib\gcc-lib\h8300-coff\3.2-GNUH8_v0301;C:\Program Files\BasicMicro\BasicAtom-Pro IDE\h8300-coff\h8300-coff\bin
To my path environment variable through the system control panelβ¦
As for the C library - something to think about
Kurt
I just removed both old IDEs and installed the new ones. The first thing I tried was to add in my code for the PING sensor and build it. It still compiles fine but WILL NOT LINK. I have the same problem as with the 5.3.0.1 IDE.
I even removed the folders the IDE was installed in to be sure it was completely removed.
Did something get left behind on drive C: when I removed the IDE?
Did an old registry key get left behind?
One complaint about the new Atom PRO IDE is that it does not let me choose where to install it. It just installs to drive C: and I install all my apps to drive E:. I would very much like to see this fixed.
8-Dale
Oops, I see I forgot to add the custom install option for the AtomPro installer. Iβll update it in a minute.
The new IDEs use new registry base keys so there shouldnβt be any conflict there. When running the installers to be able to install to a directory other than the default you must select the custom install option not the complete option.
I donβt know why it wonβt link for you. Can you give an example program that causes this and a copy of the output window text?
Great! Thanks.
I always use the custom installation option for software installs when it is available. I hate putting stuff on drive C: which only has Windows XP, plus whatever software installations force there, on my system.
I donβt know what is wrong either. I really want this to work so I can use the sensors and program my robots the way I want to. I really DO like the Atom chips.
Here is the complete current software for W.A.L.T.E.R. I have just put the PING code back in, but not added any calls to it yet.
[code]β**************************************************************************************
β
β Robot Configuration
β
β SSC-32 Configuration
β
SSC_OUT con p15 β SSC-32 Command Pin
SSC_IN con p14 β SSC-32 Input Pin (RESERVED)
SSC_OFFS con 1500 β SSC-32 Command Offset
β
β I2C Configuration
β
I2C_SDA con p12 β I2C Data
I2C_SCL con p13 β I2C Clock
β I2C Read?Write Mode
Mode16 con 16
Mode8 con 8
β
β Sound Configuration
β
speaker con p9 β Speaker I/O pin
dur con 50000 β Note Duration
dur2 con 200000
note1 con 100
note2 con 150
note3 con 200
note4 con 350
note5 con 600
note6 con 700
note7 con 750
note8 con 800
note9 con 850
note10 con 900
note11 con 950
note12 con 1000
note13 con 1100
note14 con 1150
note15 con 1200
note16 con 1250
rude1 con 75
rude2 con 125
rude3 con 225
rude4 con 450
β
β Motor Configuration
β
leftmch con 0 β Left Motor I/O pin assignment
lefta con 50 β Left Motor Speed Adjustment
leftoffs con 20 β Left Motor Stop
rightmch con 1 β Right Motor I/O pin assignment
righta con 0 β Right Motor Speed Adjustment
rightoffs con 30 β Right Motor Stop
β
β Servo Control (SERVO command)
β
minturn con 1 β Minimum turn Repetitions (approximately 4 degrees per repetition)
maxturn con 11 β Maximum turn Repetitions (approximately 4 degrees per repetition)
turninc con 2 β Turn increment (turnreps)
turndec con 3 β Turn decrement (turnreps)
stdturn con 45 β Standard Turn in Degrees
rampinc con 2 β Number of forward moves to ramp speed up a bit
rampup con 50 β Speed increase increment
rampdown con 100 β Speed decrease increment
maxspeed con 700 β Maximum Speed limit on currspeed
minspeed con 50 β Minimum Speed limit on currspeed
backupreps con 5 β Backup Repetitions
backspeed con 150 β Backup (Reverse) speed
backtime con 150 β Backup time in mS
normspeed con 700 β Normal Speed (currspeed)
turnspeed con 200 β Turning speed
turntime con 37 β Amount of time to turn in mS.
movetime con 100 β Length of a forward move in mS
maxmoves con 10 β Number of successful forward moves to exit scanning mode
β
β Compass Configuration
β
COMPASS Con 0xC0 β Compass I2C Address
CmdReg Con 0 β Sonar Command register
BearingReg Con 2 β Sonar 1st Range register
β
β IRPD Configuration
β
rights con p4 β Change pin number to pin you are using for your right led (Voilet wire)
lefts con p5 β Change pin number to pin you are using for your left led (Blue wire)
sensor var in6 β Change pin number to pin you are using for your sensor (Yellow wire)
β For obstacle detection checks, to make the code easier to understand
IRPD_Left con 1
IRPD_Right con 2
β
β IR Ranger Configuration
β
IR_Max con 3 β How many IR Rangers we have
IR_Threshld_Dist con 30 β Distance Threshold in cm for closeness checks
IR_Threshld_Frnt con 30 β Front Detection threshold in cm
IR_Threshld_Tur con 40 β Detection threshold for Pan/Tilt Turret IR Ranger in cm
β
β IR Sensor Numbers
β
IR_LF con 0 β Left Front
IR_RF con 1 β Right Front
IR_TU con 2 β Pan/Tilt Turret
β Future expansion
IR_LW con 3 β Wheel Left
IR_RW con 4 β Wheel Right
β
β Bits for IR_Status checking
β
IR_LeftFront con 1
IR_RightFront con 2
IR_BothFront con 3
IR_Turret con 4
β For future expansion
IR_LeftWheel con 8 β Left Side (across wheel)
IR_RightWheel con 16 β Right Side (across wheel)
IR_BothWheels con 24 β Both Sides (across wheels)
β
'---- Table Setup for IR Ranging Routine ] ----------------------------------------------------------
β
scantable bytetable 80,80,80,80,80,80,80,80,80,78, |
76,74,72,70,68,66,64,62,60,59, |
58,57,55,53,52,51,50,49,48,47, |
45,43,42,41,40,39,38,37,35,33, |
32,31,30,30,29,29,28,28,27,27, |
26,26,26,25,25,25,24,24,24,23, |
23,22,22,21,21,20,20,20,19,19, |
18,18,18,17,17,16,16,16,15,15, |
15,14,14,13,13,13,12,12,11,11, |
11,10,10,10,10,10,10,10,10,10
β
β PING Ultrasonic Sonar Ranger
β
PING_Max con 1 β Number of PING sensors we have
PING_Base con p4 β PING Ultrasonic Ranger I/O pin
PING_Trigger con 5 β Trigger pulse length in uS (Must be 10 for Atom PRO)
PING_Threshld con 20 β PING detection threshold
β
β Pan/Tilt Turret Configuration
β
panch con 2 β Pan Servo Pin
panhome con 30
minpan con -600
maxpan con 650
tiltch con 3 β Tilt Servo Pin
tilthome con -60
mintilt con 450
maxtilt con -950
scanposinc con 10 β Turret Scan increment in degrees
β
β End Robot Configuration
β
β
β Begin Variables
β
β
β Compass
β
Bearing Var Word β 16 bit variable for the Compass Bearing
β
β IRPD
β
templ var bit β Left sensor status
tempr var bit β Right sensor status
lastdet var nib β Last detection status
IRPD_Status var nib β 0 = Nothing detected, 1 = Left Side Hit, 2 = Right Side Hit, 3 = Center Hit
movecnt var byte β Counts number of successful forward movements
leftms var sword β Left motor current speed
rightms var sword β Right motor current speed
turncnt var byte β Counts how many times the robot has turned after detecting an obstacle
turnreps var byte β Number of turn repetitions to do per turn
savereps var word
currspeed var word β Current Speed
savespeed var word
β
β PING Ultrasonic Sonar Ranger
β
PING_Detected var bit(4) β 1 = Detected, 0 = Nothing detected
PING_Distance var word(4) β PING object detection distance
PING_Threshold var word(4)
PING_Echo var word β PING echo duration
PING_Scale var long β Divisor for distance units conversion
β
β IR Rangers
β
IR_Distance var word(4) β Distance object was detected at
IR_Detected var bit(4) β Was object detected? 0 = No, 1 = Yes
IR_Threshold var word(4) β Detection threshold for each IR Ranger
IR_Status var word β IR Detection status - 1 = Left Front, 2 = Right Front, 3 = BOTH Front, 4 = Turret IR
β Expansion: 8 = Left Side (across wheel), 16 = Right Side (across wheel), 24 = BOTH
β Sides (across wheels).
distance var byte β Shortest distance to any obstacle from any IR sensor
scanrange var word β A/D result variable
scanpath var sword β The bearing from the robotβs current forward facing direction of a clear path
scandir var word β Scan direction, 1 = to the right, -1 = to the left
floating var long β Floating point math result storage
index var byte β Index into the IR Arrays
tfloat var float
power2 var long
too_close var bit β 1 = Too close to obstacle, 0 = Can get closer
β
β Pan Tilt Turret
β
currpan var sword
currtilt var sword
β
β Pan/Tilt Turrent Scanning
β
scanpos var sword
pathclear var bit β 1 = Path clear, 0 = obstructed
β
β Control for serial output
β
sendoutput var bit
β
β Controls Noise Making
β
makenoise var bit β 1 = make sounds, 0 = no sound (stealth mode)
β
β General looping counters and result variables
β
loop var word
loop2 var word
β
β End Variables
β
'=========================================================================================================
β Start of Mainline
'=========================================================================================================
β
β Initialize
β
movecnt = 0
turncnt = 0
turnreps = minturn
currspeed = minspeed
β Initialize IR Sensor Arrays
for index = 0 to (IR_Max - 1)
IR_Distance(index) = 0
IR_Detected(index) = 0
IR_Threshold(index) = 0
next
IR_Threshold(IR_LF) = IR_Threshld_Frnt
IR_Threshold(IR_RF) = IR_Threshld_Frnt
IR_Threshold(IR_TU) = IR_Threshld_Tur
sendoutput = 1 β Turns on(1)/off(0) serial output to console (serout)
makenoise = 1 β Robot can now go into stealth (quiet) mode on its own
β
β End of Initalization
β
β Tell everyone Iβm here and ready.
sound speaker, [dur\note1, dur\note2, dur\note3, dur\note4, dur\note5, dur\note6, dur\note7, dur\note8, dur\note9, dur\note8, dur\note7, dur\note6, dur\note5, dur\note4, dur\note3, dur\note2, dur\note1]
β Home the Pan/Tilt Turret
gosub Home_Turret
if sendoutput then
serout S_OUT, I8N1_9600, βW.A.L.T.E.R. is now activeβ, 13]
endif
gosub Stop_Motors
pause 2000
'*************************************** TESTING CODE *****************************************************
'while 1
β pause 2000
'wend
'*************************************** TESTING CODE *****************************************************
β
β Main Loop
β
while 1 β Loop forever or until reset/powered off
if sendoutput then
serout S_OUT, I8N1_9600, βTop of main loopβ, 13]
endif
gosub Home_Turret
' Move forward until an obstacle is detected
gosub Move_Forward
if sendoutput then
serout S_OUT, I8N1_9600, "MAIN 1: IR_Status = ", DEC IR_Status, ", Turret Detection = ", DEC IR_Detected(IR_TU), 13]
endif
gosub Read_IR_Rangers
' Handle obstacle detection
branch IR_Status, [New_Cycle, IR_Left, IR_Right, IR_Corner, IR_Front]
goto New_Cycle
IR_Front:
if sendoutput then
serout S_OUT, I8N1_9600, βDetection on FRONT IRβ, 13]
endif
gosub Scan_Turret
if sendoutput then
serout S_OUT, I8N1_9600, "MAIN 2, after Scan_Turret: IR_Status = ", DEC IR_Status, ", pathclear = ", DEC pathclear, ", scandir = ", SDEC scandir, ", scanpath = ", DEC scanpath, 13]
endif
if pathclear then
gosub Backup
gosub Rotate_To_Bearing
endif
goto New_Cycle
IR_Left:
if sendoutput then
serout S_OUT, I8N1_9600, βDetection on LEFT IRβ, 13]
endif
gosub Backup
' Do a 45 degree right turn
scanpath = stdturn
scandir = 1
gosub Rotate_To_Bearing
goto New_Cycle
IR_Right:
β Drop Through
IR_Corner:
if sendoutput then
serout S_OUT, I8N1_9600, βDetection in a CORNERβ, 13]
endif
gosub Backup
' Do a 30 degree left turn
scanpath = stdturn
scandir = 2
gosub Rotate_To_Bearing
' Drop Through
New_Cycle:
wend
β
β End Main Loop
β
'*************************************************************************************************************
β Motion Routines
'*************************************************************************************************************
Move_Forward:
movecnt = 0
do
gosub Check_Range ' Check range to any obstacles
if too_close OR IRPD_Status then
currspeed = minspeed
gosub Stop_Motors ' All stop if too close
if IRPD_Status then
scanpath = 180
if IRPD_Status & IRPD_Left then
scandir = 1 ' Turn to the right
elseif IRPD_Status & IRPD_Right
scandir = 2 ' Turn to the left
else
scanpath = 0 ' Do nothing flag
endif
if sendoutput then
serout S_OUT, I8N1_9600, "Move_Forward 1: IR_Status = ", DEC IR_Status, ", IRPD_Status = ", DEC IRPD_Status, ", scandir = ", DEC scandir, ", scanpath = ", SDEC scanpath, 13]
endif
if scanpath > 0 then ' Turn about and stare down the obstacle
gosub Rotate_To_Bearing
' Make a rude noise at the obstacle
sound speaker, [dur2\rude1, dur2\rude2, dur2\rude3, dur2\rude4, dur2\rude3, dur2\rude2, dur2\rude1, dur2\rude1, dur2\rude2, dur2\rude3, dur2\rude4, dur2\rude3, dur2\rude2, dur2\rude1]
endif
endif
else
if sendoutput then
serout S_OUT, I8N1_9600, "Move_Forward 2: Currspeed = ", DEC currspeed, 13]
endif
leftms = SSC_OFFS - (currspeed + lefta) ' Set speed of the left motor
rightms = SSC_OFFS + currspeed + righta ' Set speed of the right motor
' Get both motors going at currspeed
serout SSC_OUT, I8N1_9600, "#", DEC leftmch, "P", DEC leftms, "#", DEC rightmch, "P", DEC rightms, 13]
if sendoutput then
serout S_OUT, I8N1_9600, "Move_Forward 3: Right speed = ", DEC rightms, ", Left speed = ", DEC leftms, 13]
endif
pause movetime
currspeed = (currspeed + rampup) max maxspeed ' Speed up a little each time we successfully move forward
movecnt = movecnt + 1
endif
while (IR_Status = 0) AND (movecnt < maxmoves)
return
Backup:
loop2 = 0
serout SSC_OUT, I8N1_9600, "#", DEC leftmch, "P", DEC (SSC_OFFS + backspeed), "#", DEC rightmch, "P", DEC (SSC_OFFS - backspeed), 13]
do
gosub Read_IRPD
if sendoutput then
serout S_OUT, I8N1_9600, "Backing up: IRPD_Status = ", DEC IRPD_Status, ", templ = ", DEC templ, ", tempr = ", DEC tempr, ", loop2 = ", DEC loop2, 13]
endif
if (IRPD_Status > 0) then
loop2 = backupreps + 1 ' Force exit from loop
else
loop2 = loop2 + 1
pause backtime
if makenoise then
sound speaker, [dur2\note8] ' Backup alarm
endif
endif
while loop2 < backupreps
gosub Stop_Motors
return
β Stop both motors
Stop_Motors:
serout SSC_OUT, I8N1_9600, β#β, DEC leftmch, βPβ, DEC (SSC_OFFS + leftoffs), β#β, DEC rightmch, βPβ, DEC (SSC_OFFS + rightoffs), 13]
if sendoutput then
serout S_OUT, I8N1_9600, "Motors are Stopped", 13]
endif
return
'*************************************************************************************************************
β Sensor Routines
'*************************************************************************************************************
β Read up to three IR Ranging sensors - based on code written by Nathan Scherdin
β and Chuck Hellebuyck in their Range.Bas module. This routine can read any
β number of IR Rangers without modification, controlled by the constant IR_Max.
Read_IR_Rangers:
IR_Status = 0
for index = 0 to IR_Max - 1
IR_Detected(index) = 0
' Read the sensor value
if index = IR_LF then ' Left Wheel
adin AX0, 2, AD_RON, scanrange
elseif index = IR_RF ' Right Wheel
adin AX2, 2, AD_RON, scanrange
elseif index = IR_TU ' Front Pan/Tilt Turret
adin AX3, 2, AD_RON, scanrange
else
exception Invalid_Sensor
endif
tfloat = TOFLOAT scanrange / 5.12 ' Limit value to < 200 values
IR_Distance(index) = scantable(TOINT tfloat) ' Convert A/D to measurement
if sendoutput then
serout S_OUT, I8N1_9600, "Read_IR_Rangers: index = ", DEC index, ", IR_Status = ", DEC IR_Status, ", Threshold = ", DEC IR_Threshold(index), ", Distance = ", DEC IR_Distance(index), " cm, Detected = ", DEC IR_Detected(index), 13]
endif
if (scanrange > 512) OR (IR_Distance(index) < IR_Threshold(index)) then
IR_Detected(index) = 1
' Add bit value for the current sensor to IR_Status
' Bit 0 = 1, Sensor 0 Detect 0 0 0 0 0 0 0 1 Left Wheel
' Bit 1 = 1, Sensor 1 Detect 0 0 0 0 0 0 1 0 Right Wheel
' Bit 2 = 1, Sensor 2 Detect 0 0 0 0 0 1 0 0 Turret
' Bit 3 = 1, Sensor 3 Detect 0 0 0 0 1 0 0 0 Left Front
' Bit 4 = 1, Sensor 4 Detect 0 0 0 1 0 0 0 0 Right Front
gosub Power_Of_2 ' Calculate bit value for sensor index
IR_Status = IR_Status + power2 ' Add the correct bit value to the IR Status
if makenoise then
if index = IR_LF then ' Front Left Side
sound speaker, [dur\note5,dur\note6,dur\note7,dur\note8]
elseif index = IR_RF ' Front Right Side
sound speaker, [dur\note8,dur\note7,dur\note6,dur\note5]
elseif index = IR_TU ' Turret
sound speaker, [dur\note9,dur\note10,dur\note11,dur\note12]
endif
endif
endif
next
Invalid_Sensor:
return
Read_IRPD:
β Loop modifications suggested by Jim Frye of Lynxmotion (http://www.lynxmotion.com)
β
β Check the Left IR Emitter
for loop = 1 to 4
high lefts
pause 1
low lefts
pause 1
next
high lefts
pause 1
templ = sensor
low lefts
pause 1
' Check the Right IR Emitter
for loop = 1 to 4
high rights
pause 1
low rights
pause 1
next
high rights
pause 1
tempr = sensor
low rights
pause 1
' Set Obstacle Detection Flag
IRPD_Status = 0
if templ = 0 then
IRPD_Status = IRPD_Status + 1
if makenoise then
sound speaker, [dur\note1, dur\note2, dur\note3, dur\note4]
endif
endif
if tempr = 0 then
IRPD_Status = IRPD_Status + 2
if makenoise then
sound speaker, [dur\note4, dur\note3, dur\note2, dur\note1]
endif
endif
return
β Check the Ultrasonic Sonar Ranger on the Pan/Tilt Turret
Read_PING:
index = 0
' Start the PING detection cycle
low PING_Base
' Send the PING sensor pulse
β pulsout PING_Base, PING_Trigger
' Read the pulse echo return time
pulsin PING_Base, 1, PING_Echo
' Create the divisor for cm distance conversion
PING_Scale.highword = 0
PING_Scale.lowword = 2251 ' 0.03434 * 65535 cm conversion factor
PING_Distance(index) = (PING_Echo */ PING_Scale) / 2
if makenoise AND (PING_Distance(index) <= PING_Threshold(index)) then
PING_Detected(index) = 1
sound speaker, [dur\note13, dur\note14, dur\note15, dur\note16]
endif
return
Read_Compass:
i2cin I2C_SDA, I2C_SCL, COMPASS, BearingReg, [Bearing.HighByte, Bearing.LowByte]
if sendoutput then
serout S_OUT, I8N1_9600, "Compass Bearing ", DEC Bearing/10, " Degrees", 13] ' Use terminal window
endif
return
'*************************************************************************************************************
β Rotation Routines
'*************************************************************************************************************
β Rotate to a bearing.
β
β Currently this is only used to turn to the relative bearing of a clear path
β found by the Scan_Turret routine. The turn is not currently very precise, due
β to the inability to turn to exact headings and inaccurate wheel control.
β
β This routine will be modified as new hardware is added to the robot to provide
β more exact bearing information and the ability to move better and in different ways.
β
β NOTE: scandir and scanpath must be set before calling this routine.
Rotate_To_Bearing:
if sendoutput then
serout S_OUT, I8N1_9600, "Rotate_To_Bearing: scanpath = ", SDEC scanpath, ", scandir = ", SDEC scandir, " turnreps = ", DEC turnreps, 13]
endif
if scanpath > 0 then ' Do not do anything if no scan left or right
savereps = turnreps ' Save the value of turnreps
turnreps = (scanpath / 5) ' Calculate turn based on 5 degrees minimum turn
if sendoutput then
serout S_OUT, I8N1_9600, "Rotate_To_Bearing: calculated turnreps = ", DEC turnreps, ", scanpath = ", SDEC scanpath, ", scandir = ", SDEC scandir, 13]
endif
if scandir = 2 then
' Rotate Left
serout SSC_OUT, I8N1_9600, "#", DEC leftmch, "P", DEC (SSC_OFFS + turnspeed + lefta), "#", DEC rightmch, "P", DEC (SSC_OFFS + turnspeed + righta), 13]
elseif scandir = 1
' Rotate Right
serout SSC_OUT, I8N1_9600, "#", DEC leftmch, "P", DEC (SSC_OFFS - (turnspeed + lefta)), "#", DEC rightmch, "P", DEC (SSC_OFFS - (turnspeed + righta)), 13]
endif
pause turnreps * turntime ' Rotate for turnreps units of turntime
gosub Stop_Motors
turnreps = savereps ' Restore the value of turnreps
endif
return
'*************************************************************************************************************
β Pan/Tilt Turret Routines
'*************************************************************************************************************
Home_Turret:
serout SSC_OUT, I8N1_9600, β#β, DEC panch, βPβ, DEC (panhome + SSC_OFFS), β#β, DEC tiltch, βPβ, DEC (tilthome + SSC_OFFS), 13]
return
β Scan using the Pan/Tilt Turret
β If no clear path is found in the primary direction, then the opposite direction will be scanned
Scan_Turret:
if IR_Detected(IR_RF) then
scandir = 2 β Scan to the left
else
scandir = 1 β Default to scanning to the right
endif
gosub Stop_Motors
if sendoutput then
serout S_OUT, I8N1_9600, "Scan_Turret 1: IR_Status = ", DEC IR_Status, ", scandir = ", DEC scandir, ", scanpos = ", SDEC scanpos, 13]
endif
gosub Scan_With_Turret
if sendoutput then
serout S_OUT, I8N1_9600, "Scan_Turret 2: IR_Status = ", DEC IR_Status, ", scandir = ", DEC scandir, ", scanpos = ", SDEC scanpos, 13]
endif
if (pathclear = 0) OR (scanpos >= 60) OR (scanpos = 0) then
' Switch scan and try the opposite direction
if scandir = 1 then
scandir = 2
else
scandir = 1
endif
if sendoutput then
serout S_OUT, I8N1_9600, "Scan_Turret 3: scandir = ", DEC scandir, ", scanpos = ", SDEC scanpos, 13]
endif
gosub Scan_With_Turret
endif
scanpath = scanpos ' Save the relative bearing of the path found
End_Scan:
return
β Do the actual scan with the Pan/Tilt Turret
Scan_With_Turret:
pathclear = 0
scanpos = scanposinc
gosub Home_Turret
do
if scandir = 1 then
currpan = SSC_OFFS + (scanpos * 10)
elseif scandir = 2
currpan = SSC_OFFS - (scanpos * 10)
endif
if sendoutput then
serout S_OUT, I8N1_9600, "Scan_With_Turret 1: scanpos = ", DEC scanpos, ", scandir = ", DEC scandir, ", currpan = ", SDEC currpan, 13]
endif
' Position the Pan/Tilt Turret
serout SSC_OUT, I8N1_9600, "#", DEC panch, "P", DEC currpan, 13]
' Check to see if the path is clear and set the flag
gosub Read_IR_Rangers
if IR_Detected(IR_TU) = 0 then
pathclear = 1
else
scanpos = scanpos + scanposinc
endif
if sendoutput then
serout S_OUT, I8N1_9600, "Scan_With_Turret 2: scanpos = ", DEC scanpos, ", currpan = ", SDEC currpan, ", pathclear = ", DEC pathclear, ", Detected = ", DEC IR_Detected(2), ", Distance = ", DEC IR_Distance(2), 13]
endif
while (scanpos < 70) AND (pathclear = 0)
return
'*************************************************************************************************************
β Check Routines
'*************************************************************************************************************
β Check the range to any obstacle from any ranging sensor.
β Return the distance and closeness flag
Check_Range:
gosub Read_IR_Rangers
gosub Read_IRPD
' Get the shortest distance from an obstacle to any sensor
distance = IR_Distance(IR_LF) max IR_Distance(IR_RF)
distance = distance max IR_Distance(IR_TU)
' See if we are too close to an obstacle on any side
too_close = (distance < IR_Threshld_Dist)
if sendoutput then
serout S_OUT, I8N1_9600, "Check_Range: distance = ", DEC distance, ", too_close = ", DEC too_close, 13]
endif
return
Check_Turns:
turncnt = turncnt + 1
if sendoutput then
serout S_OUT, I8N1_9600, "Check_Turns 1: turncnt = ", DEC turncnt, ", turnreps = ", DEC turnreps, 13]
endif
if turncnt > 1 then
' Increase turn size a bit
turnreps = (turnreps + turninc) max maxturn
turncnt = 0
endif
if sendoutput then
serout S_OUT, I8N1_9600, "Check_Turns 2: turncnt = ", DEC turncnt, ", turnreps = ", DEC turnreps, 13]
endif
return
'*************************************************************************************************************
β I2C Routines
'*************************************************************************************************************
'*************************************************************************************************************
β Utility Routines
'*************************************************************************************************************
β Calculate the correct power of 2 for a bit index
β Parameter: index. Returns: power2 with the correct power of 2
Power_Of_2:
power2 = 1
if index > 0 then
for loop = 1 to index
power2 = power2 * 2
next
endif
return
end[/code]
I have programmed some very fun behaviors for W.A.L.T.E.R. The IDE seems to only allow me to copy a single line at a time from the output window.
It would be very helpful to be able to copy the entire contents of the output window to the clip board, especially for cases like this.
8-Dale
Fixed the linking issue. It was a forward reference in the pulsout command that only showed up in very large programs. Iβve updated the installer. Same link.
Wonderful! I will go redownload and install immediately! Thanks much for the quick update for this.
UPDATE: I just successfully compiled, linked, and programmed my software (with the PING code that uses pulsout) and it worked flawlessly.
8-Dale
Whooohooo!
Update:
All my problems remain. I understand that I was not able to communicate my issues in a timely manor but the flow control feature still refuses to work. The program will send all data in one pass. It works with the stamp but not with the atom.
The below line does not work when there are 3 or more of them: (Example: if there are 4 lines of phrases, only two get executed bacause only two were able to fit in the speakjets buffer)
SEROUT TX\RDY, N9600, [HE,EH_,LE,OWWW,PA2]
This line of code works with no problem regardless the number of data lines with phrases to send when using the maual delay:
SEROUT TX\RDY, N9600, 100, [HE,EH_,LE,OWWW,PA2]
Yes, I didnβt do anything with flow control in the serial commands which would be why whatever the problem is still remains. Iβll take a look at the code to see if i can spot anything obviously wrong but example programs would be best for this. Also describing in more detail what is conencted to what. Iβm not sure what you mean by β3 or more of themβ. Do you mean three or more peices of data(eg [data1,data2,data3]) or do you mean three or more serout line.
Ok here is the code below in itβs complete form. I had to add the manual flow delay to make all phrases sent to the SpeakJet get spoken.
**Here is the problem: **
Without flow control, the program runs through all lines of phrases [the data contained in the brackets]. depending on the amount of data sent per line, only 1 to two words get spoken because the SpeakJets buffer can only hold a max of one or two words before becoming full. When the buffer becomes full, the program continues to try and send more data even when the speakjet is not ready, it is still trying to execute the first two words in the buffer. When the speakjet has finally finished saying what it could, the program is done.
My only connections are two pins from my board, the RCX (data pin) and D2 (flow control pin) When the buffer becomes half full, my boards D2 pin goes HIGH indicating no more data can be sent at this time. This D2 pin is connected to the BAP28βs pin 6 (Ready pin). The RCX pin is connected to the BAP28βs pin #4 (the data pin).
Data is getting sent because the speakjet is speaking words, however, flow controll seems to be an issue.
PA0 CON 0 ; pauses
PA1 CON 1
PA2 CON 2
PA3 CON 3
PA4 CON 4
PA5 CON 5
PA6 CON 6
Fast CON 7
Slow CON 8
Stress CON 14
Relax CON 15
_Wait CON 16 ; note underscore
Soft CON 18
Volume CON 20
Speed CON 21
Pitch CON 22
Bend CON 23
PortCtr CON 24
Port CON 25
Repeat_ CON 26
CallPhr CON 28
GotoPhr CON 29
Delay CON 30
Reset CON 31
IY CON 128
IH CON 129
EY CON 130
EH_ CON 131
AY CON 132
AX CON 133
UX CON 134
OH CON 135
AW CON 136
OW CON 137
UH CON 138
UW CON 139
MM CON 140
NE CON 141
NO CON 142
NGE CON 143
NGO CON 144
LE CON 145
LO CON 146
WW CON 147
RR CON 148
IYRR CON 149
EYRR CON 150
AXRR CON 151
AWRR CON 152
OWRR CON 153
EYIY CON 154
OHIY CON 155
OWIY CON 156
OHIH CON 157
IYEH CON 158
EHLL CON 159
IYUW CON 160
AXUW CON 161
IHWW CON 162
AYWW CON 163
OWWW CON 164
JH CON 165
VV CON 166
ZZ CON 167
ZH CON 168
DH_ CON 169
BE CON 170
BO CON 171
EB CON 172
OB CON 173
DE CON 174
_DO CON 175 ; note underscore
ED CON 176
OD CON 177
GE CON 178
GO CON 179
EG CON 180
OG CON 181
CH_ CON 182
HE CON 183
HO CON 184
WH CON 185
FF CON 186
SE CON 187
SO CON 188
SH CON 189
TH CON 190
TT CON 191
TU CON 192
TS CON 193
KE CON 194
KO CON 195
EK CON 196
OK CON 197
PE CON 198
PO CON 199
RO CON 200
R1 CON 201
R2 CON 202
R3 CON 203
R4 CON 204
R5 CON 205
R6 CON 206
R7 CON 207
R8 CON 208
R9 CON 209
A0 CON 210
A1 CON 211
A2 CON 212
A3 CON 213
A4 CON 214
A5 CON 215
A6 CON 216
A7 CON 217
A8 CON 218
A9 CON 219
_B0 CON 220 ; note underscore
_B1 CON 221
_B2 CON 222
_B3 CON 223
_B4 CON 224
_B5 CON 225
_B6 CON 226
_B7 CON 227
_B8 CON 228
_B9 CON 229
C0 CON 230
C1 CON 231
C2 CON 232
C3 CON 233
C4 CON 234
C5 CON 235
C6 CON 236
C7 CON 237
C8 CON 238
C9 CON 239
D0 CON 240 ; DTMF tones
D1 CON 241
D2 CON 242
D3 CON 243
D4 CON 244
D5 CON 245
D6 CON 246
D7 CON 247
D8 CON 248
D9 CON 249
D10 CON 250
D11 CON 251
M0 CON 252 ; sonar pin
M1 CON 253 ; pistol shot
M2 CON 254 ; WOW
EOS CON 255
TX CON P4
RDY CON P6
input P6
;------------------------------ SpeakJet Setup ]-------------------------------------
SEROUT tx,N9600, "\0RX"] ;CLEAR BUFFER
SEROUT TX\RDY,N9600, [020,127]; set volume to max
SEROUT tx,N9600, [PITCH,66,BEND,5]
;------------------------- Prases ]--------------------------------------------------
;100 afetr baud is the interval timed flow control
ph1:
;My name is Vecter
SEROUT TX\RDY, N9600, [MM,OHIH,PA1,NE,EYIY,MM,PA2,IH,IH,SE,SE,PA2,VV,VV,EH_,KO,TT,RR,RR,PA2] ;100 is the interval timed flow control
ph2:
;VERSION 1.0
SEROUT TX\RDY, N9600, [VV,AXRR,SH,SH,EY,NE,PA5,WW,WW,UX,NE,PO,OWIY,NE,TT,TT,PA5,OWWW,PA2,PA2,PA2,PA2]
ph3:
;Object Detected
SEROUT TX\RDY, N9600, [OH,BE,JH,EY,KO,TT,PA2,DE,IY,TT,EH_,EK,TT,EH_,ED,PA2]
ph4:
;Completed
SEROUT TX\RDY, N9600, [KO,MM,PO,LE,IY,TT,EH_,ED,PA2]
ph5:
;Hello
SEROUT TX\RDY, N9600, [HE,EH_,LE,OWWW,PA2]
ph6:
;BATTERY LOW
SEROUT TX\RDY, N9600, [OB,AY,TT,AXRR,IY,PA2,LE,LE,LE,OW,OW,OWWW,PA2]
ph7:
;Initializing
SEROUT TX\RDY, N9600, [FAST,IH,NE,IH,SH,SH,UX,LE,OHIH,ZZ,ZZ,NGE,PA2]
ph8:
;LEFT SIDE
SEROUT TX\RDY, N9600, [PA1,LE,EY,FF,FF,TU,PA6,SE,OHIH,DE,PA2]
high p4
END
I also redownloaded and installed the new Atom PRO IDE, which now has the custom install option. Thanks!
However, now I canβt get the IDE to find the Atom PRO. The Basic ATOM IDE finds the Basic Atom just fine, but the Atom PRO IDE does not find the Atom PRO. I donβt have any reason to suspect the Atom PRO is bad at present, since I havenβt even worked with it for several weeks and it was fine the last time I did.
I am using the same standard serial port for both connections, so also donβt suspect any com port settings are wrong (works with the Basic ATOM and IDE just fine).
Any ideas what might be wrong?
8-Dale
Try increasing the reset hold time from 10 to 25. This is a known fix for the Pro only. Let me knowβ¦
The Reset Hold Time now defaults to 25. That however may break some peoples communications. For those people I suggest you lower it back down around 5(where it was in the old version). We had a lot of tech calls on this before which is why I changed it to 25. Hoepfull few people will have problems because of this.
I tried decreasing the reset hold time back down to 5 and then bumped it up to 10 in small increments and a bit higher. No luck, so maybe my chip took a static charge and decided to die. Itβs been one of those weeksβ¦
8-Dale
Thats a possibility. I didnβt changing anything else in the loader other than to default to 25 for ResetHold and added the Pro40+ to the supported chips. Did anything else change on your system since the last time you used it?
As far as hardware, nothing has changed on my system in months. So, I am thinking the Atom PRO just took a static charge and died. Like I said, itβs been one of those weeks for meβ¦ I seem to have fried at least part of a Sabertooth 2x5 also.
8-Dale
Geez Dale! Get an ESD strap and plug yourself in!
I was not working with the Atom PRO when it apparently died. It has just been laying around doing nothing on my computer desk for a few weeks now so anything could have happened.
8-Dale
Well the moment you touched it, it might have happened then.