'Thor_8-2.bas 40x2 Firmware v3 'Thor_7-2.bas 40x2 Firmware v3 #picaxe 40x2 #slot 2 #no_data #no_table #define keybip 'for GetCmnd DISCONNECT SETFREQ m16 'SERTXD 16MHz 19200 'pulsout 4MHz 10us units 'pulsout 16MHz 2.5us units '#2 Memory used = 1687 bytes out of 4096 '================================================== #rem Rootcmnd "v" SELECT cmnd CASE "1","b" GOSUB bip CASE "2","e" GOSUB whee CASE "3","o" GOSUB whoa CASE "4","v" GOSUB beep100 CASE "5","s" GOSUB sshhh ELSE cmnd ="t" GOSUB tsh Rootcmnd else CASE "?","a" GOSUB PrintActs f_page0 =1 :GOSUB PrintActs :f_page0 =0 CASE "1" to "8" GOSUB PrintAct :f_page0 =0 CASE "b" GOSUB PrintBeHaves CASE "p" GOSUB PrintPose CASE "d" GOSUB DumpActs CASE "#" GOSUB DumpASCIIacts CASE "T" GOSUB PrintTipSensor CASE "U" RootCmnd ="?" : GOTO Run1 CASE "W" RootCmnd ="?" : GOTO Run1 '2023-01-03 CASE "F" RootCmnd ="?" : GOTO Run1 '2023-01-03 CASE "G" GOSUB PrintGroundSensors CASE "h" GOTO PrintHelp 'then redirected to #3 - not enough room here CASE "S" GOSUB Save_Behaviour ' bS CASE "0" GOSUB LoadBehaviour '"b0" and "0" from Prog0init CASE "I" GOSUB initEEPROM ' bI CASE "E" GOTO START CASE "!" GOSUB PrintReactions '2023-01-10 CASE "M" GOSUB PrintMind '2023-01-10 ELSE GOSUB sshhh #endrem '================================================== Pins: '================================================== SYMBOL servoLA =A.1 SYMBOL servoLH =A.0 SYMBOL servoRA =D.3 SYMBOL servoRH =D.2 SYMBOL whiskerLLED =A.6 SYMBOL whiskerRLED =A.7 SYMBOL whiskerL =A.5 'READADC needs port.pin not a symbol SYMBOL whiskerR =D.0 'READADC needs port.pin not a symbol SYMBOL EyeLLED =C.1 SYMBOL EyeRLED =C.2 SYMBOL feelerLLED =D.7 SYMBOL Lfeeler =pinD.6 'READADC needs port.pin not a symbol SYMBOL Rfeeler =pinD.5 'READADC needs port.pin not a symbol SYMBOL feelerRLED =D.4 SYMBOL pingpin =C.0 SYMBOL voiceLED =C.5 SYMBOL voice =C.5 SYMBOL senseLtoe =pinA.2 SYMBOL senseRtoe =pinD.1 'SYMBOL senseLtoe =A.2 'SYMBOL senseRtoe =D.1 SYMBOL inIR =A.3 SYMBOL inIRpin =pinA.3 'SYMBOL O_LCD =A.4 'bus B.7 - B.0 '================================================== VarsCons: '========================== SYMBOL Esc =27 'Escape key SYMBOL quote2 =34 'double quote mark 'built in variables 'bptr = RAM pointer 'ptr - scratchpad pointer 'hserptr - pointer to scratchpad location of last byte received by hardware UART 'X2 parts - bit0-31 b0-55 w0-27 +56 - 255 Peek/Poke 'W0 'SYMBOL sense0 =b0 SYMBOL temp0 =b0 SYMBOL f8_behaves =b1 'used in programs 0123 w=write r=read !=wr SYMBOL f_b_react =bit8 'wrr- 1=reacts on SYMBOL f_b_autosense =bit9 'w!r- 1= auto test sensors, "b$a" 'SYMBOL f_b_autoUp =bit10 'wrr- tested in Qfell, default=1 "bu" Baldur SYMBOL f_b_Uon =bit11 'w!R- Ultrasonic sense ON SYMBOL f_b_F =bit12 '-!-- Forward - set by Fd/Bk etc SYMBOL f_Bmodified =bit13 'w!-- behaviour settings modified 'SYMBOL f_tF =bit14 '-!-- last turn on spot Baldur SYMBOL f_MoveAborted =bit15 '-!-- 'W1 SYMBOL f8_Cmnder0 =b2 SYMBOL f_warm =bit16 '!--- SYMBOL f_play =bit17 '!--- SYMBOL f_record =bit18 '!--- SYMBOL f_recordC =bit19 '!--- SYMBOL f_waitcmnd =bit20 '!--- just wait for an IRkey or Serin SYMBOL f_IRcmnd =bit21 '!r-- 1=>IRcmnd 0=>Serial/Play cmnd SYMBOL f_page0 =bit22 'w-!- 1=Acts/Slots 01-07, 0(default) =1-8 SYMBOL f_Rfwd =bit23 '-!-- SYMBOL f8_doServos =b3 'ww-- SYMBOL f_RAdo =bit24 '-!-! do servo SYMBOL f_RHdo =bit25 '-!-! do servo SYMBOL f_LAdo =bit26 '-!-! do servo SYMBOL f_LHdo =bit27 '-!-! do servo SYMBOL f_RApulse =bit28 'r!-r pulse servos SYMBOL f_RHpulse =bit29 'r!-r pulse servos SYMBOL f_LApulse =bit30 'r!-r pulse servos SYMBOL f_LHpulse =bit31 'r!-r pulse servos 'W2 SYMBOL W2pulse =w2 SYMBOL W2pulselo =b4 SYMBOL W2pulsehi =b5 SYMBOL W2temp =w2 'Interpage jumps for hserptr SYMBOL W2templo =b4 SYMBOL W2temphi =b5 SYMBOL W2temp0 =b4 SYMBOL W2temp1 =b5 'W3 SYMBOL cmnd =b6 SYMBOL RootCmnd =b7 'SYMBOL servonum =b7 'SETUP 'W4 SYMBOL RHC =b8 'Right Hip Centre for current posture SYMBOL LHC =b9 'Left Hip Centre for current posture 'W5 SYMBOL RAC =b10 'Right Ankle Centre for current posture SYMBOL LAC =b11 'Left Ankle Centre for current posture 'W6 SYMBOL RHat =b12 'Servo Right Hip At SYMBOL RHto =b13 'Servo Right Hip To 'W7 SYMBOL LHat =b14 'Servo Left Hip At SYMBOL LHto =b15 'Servo Left Hip To 'W8 SYMBOL RAat =b16 'Servo Right Ankle At SYMBOL RAto =b17 'Servo Right Ankle To 'W9 SYMBOL LAat =b18 'Servo Left Ankle At SYMBOL LAto =b19 'Servo Left Ankle To 'W10 SYMBOL Sspeed =b20 '1-9 SYMBOL Sframe =b21 'Servo frame pause in ms 'W11 SYMBOL FL =b22 'Foot Lift UpDown movement min 25 SYMBOL FP =b23 'Foot Pace ForwardBack movement +- 9 - 23 'W12 SYMBOL FT =b24 'Foot Turn SYMBOL FLcmnd =b25 'Foot Lift UpDown movement 0-9 'W13 SYMBOL FPcmnd =b26 'Foot Pace ForwardBack movement 0-9 SYMBOL FTcmnd =b27 'Foot Turn movement 0-9 'W14 SYMBOL Scmnd =b28 'Speed 1-9 SYMBOL IRcmnd =b29 'W15 SYMBOL Actptr =b30 SYMBOL ActEnd =b31 'W16 SYMBOL slot =b32 SYMBOL hframes =b33 'halt frames 'W17 SYMBOL kickcmnd =b34 ' SYMBOL Speedmax =b35 '1-9 'W18 'SYMBOL FUScmnd =b36 'Foot Up In = 9 -FUI *FL /9 Baldur SYMBOL ReactAt =b37 'React Table pointer 'W19 SYMBOL yawn =b38 SYMBOL standOnLR =b39 '%LR 1=down moving test toes if if <>%11 'W20 SYMBOL topple =b40 SYMBOL usdist =b41 'prog2 'W21 'SYMBOL Bo =b42 'lean back offset for backwards Baldur SYMBOL TOF =b43 'Toes Offset Front 1-9 'W22 SYMBOL W22random =w22 'b44,b45 SYMBOL W22random0 =b44 'W23 SYMBOL DoAt =b46 'Pointer in Do SYMBOL InDo =b47 'flag for In a Do 'W24 SYMBOL mindAt =b48 ' SYMBOL mindSub =b49 ' 'W25 SYMBOL RHcmnd =b50 'controls Hip Centres for RideHeight 0-9 in 2-NewBehave: SYMBOL RHcmndold =b51 'last Ride height cmnd 'Thor 'W26 'W27 SYMBOL W27temp =w27 'prog1 SYMBOL W27temp0 =b54 'prog1 SYMBOL W27temp1 =b55 'prog1 'SYMBOL temp54 =b54 ' 'SYMBOL temp55 =b55 'prog1 '--------- 'Variables - Storage - peek and poke '------------------- '200 56 to 255 ($38 to $FF) SYMBOL RAM_temp0 =56 'first non variable RAM location 'SYMBOL RAM_P1_f8_flags =57 'Prog1 flags 'turned Left bit 0 '1=last turned Left, 0=Right ''SYMBOL RAM_holedetectR =58 ' ''SYMBOL RAM_holedetectL =59 ' SYMBOL RAM_obstaclesR =60 'map SYMBOL RAM_obstaclesL =61 'map SYMBOL RAM_lightR =62 'whisker ambient light level Right SYMBOL RAM_lightL =63 'whisker ambient light level Left SYMBOL RAM_UStoonear =64 SYMBOL RAM_USawareAt =65 SYMBOL RAM_USunits_cm_ =66 SYMBOL RAM_USlast =67 SYMBOL RAM_WhiskerR =68 SYMBOL RAM_WhiskerL =69 SYMBOL RAM_WhiskerRlit =70 SYMBOL RAM_WhiskerLlit =71 SYMBOL RAM_FeelerR =72 SYMBOL RAM_FeelerL =73 SYMBOL RAM_FeelerRlit =74 SYMBOL RAM_FeelerLlit =75 SYMBOL RAM_Wthresh =76 SYMBOL RAM_Fthresh =77 'SYMBOL RAM_Sspeed =78 'SYMBOL RAM_randvarLo =68 'SYMBOL RAM_randvarHi =69 'SYMBOL RAM_randseedlo =70 'SYMBOL RAM_randseedhi =71 SYMBOL EEPROM_LHC =255 'logical value SYMBOL EEPROM_LAC =254 'logical value SYMBOL EEPROM_RHC =253 'logical value SYMBOL EEPROM_RAC =252 'logical value SYMBOL EEPROM_TOF =251 'Toes Offset Front 1-9 SYMBOL EEPROM_FLcmnd =250 'Foot Lift movement 1-9 SYMBOL EEPROM_FPcmnd =249 'Pace ForwardBack movement 1-9 SYMBOL EEPROM_FTcmnd =248 'Foot Turn movement 1-9 SYMBOL EEPROM_Speeds =247 'HiNib=speedmax(9), LoNib=speed(1) SYMBOL EEPROM_RHcmnd =246 'RideHeight 1-9, (Baldur FUScmnd) '245 Bo 'Back lean back Baldur SYMBOL EEPROM_kickcmnd =244 SYMBOL EEPROM_f8_behaves =243 SYMBOL EEPROM_Wthresh =242 SYMBOL EEPROM_Fthresh =241 SYMBOL EEPROM_USawarenear =240 'start of last 16 byte slot SYMBOL EEPROM_ActsEnd =239 'end of slot 06 '================================================== 'SERVOS - ACTUAL values from PotSetRanges - values are in 10us units 'GWS S03 [39.5 x 20.0 x 35.6 42g] 0.23sec 3.4@4.8v 4@6v '================================================== SYMBOL SRHmin =126 '0 Right Hip Max foot up, full body down SYMBOL SRHmid =168 '42 Right Hip Stand feet flat SYMBOL SRHmax =210 '86 Right Hip Max foot down leg stop SYMBOL SRAmax =231 'Right Ankle Max out servo stop SYMBOL SRAF =224 'Toes Forward 'SYMBOL SRAFWmax =175 '+33 back toe hits other foot SYMBOL SRAFWmid =162 '+20 SYMBOL SRAFWmin =147 '+5 TOS=5 SYMBOL SRAmid =142 'Right Ankle Mid ahead - walk range +-20 TOS=5 SYMBOL SRABWmin =138 '-5 TOS=5 SYMBOL SRABWmid =112 '-20 'SYMBOL SRABWmax =101 '-41 front toe hits other foot SYMBOL SRAB =61 'Toes Back SYMBOL SRAmin =55 'Right Ankle Min in servo stop SYMBOL SLHmax =197 '0 Left Hip Max foot up, full body down 67 SYMBOL SLHmid =152 '45 Left Hip Stand feet flat 125 SYMBOL SLHmin =104 '93 Left Hip Max foot down leg stop 157 SYMBOL SLAmin =58 'Left Ankle Min out servo stop SYMBOL SLAF =67 'Toes Forward 'SYMBOL SLAFWmax =111 '-33 back toe hits other foot SYMBOL SLAFWmid =124 '-20 SYMBOL SLAFWmin =139 '-5 TOS=5 SYMBOL SLAmid =144 'Left Ankle Mid ahead - walk range +-20 TOS=5 SYMBOL SLABWmin =149 '+5 TOS=5 SYMBOL SLABWmid =164 '+20 'SYMBOL SLABWmax =178 '+33 front toe hits other foot SYMBOL SLAB =231 'Toes Back SYMBOL SLAmax =238 'Left Ankle Max in servo stop 'Left toes forward is -ve 'Left leg out is -ve 'Right toes forward is +ve 'Right leg out is +ve '================================================== 'LOGICAL 'toes forward is +ve 'leg out is +ve SYMBOL RAmax =SRAmax '231 -55 =176 SYMBOL RAFWmid =SRAFWmid '162 SYMBOL RAFWmin =SRAFWmin SYMBOL RAmid =SRAmid '142 SYMBOL RABWmin =SRABWmin SYMBOL RABWmid =SRABWmid '112 SYMBOL RAmin =SRAmin '55 SYMBOL RHmin =SRHmin '126 -211 =85 'foot up SYMBOL RHmid =SRHmid '168 SYMBOL RHmax =SRHmax '213 'foot down 'note max min reversals for left SYMBOL LAmax =255 -SLAmin '255 -58 =197 197 -17 =180 SYMBOL LAFWmid =255 -SLAFWmid '255 -124 =131 SYMBOL LAFWmin =255 -SLAFWmin SYMBOL LAmid =255 -SLAmid '255 -144 =111 SYMBOL LABWmin =255 -SLABWmin SYMBOL LABWmid =255 -SLABWmid '255 -164 =91 SYMBOL LAmin =255 -SLAmax '255 -238 =17 SYMBOL LHmin =255 -SLHmax '58 - 152 =94 'foot up SYMBOL LHmid =255 -SLHmid '103 SYMBOL LHmax =255 -SLHmin '152 'foot down '--------------- 'for servo numbering in CaseAdjust: SYMBOL RA =0 SYMBOL RH =1 SYMBOL LA =2 SYMBOL LH =3 '-------------------------------------------------------------- '================================================================= ' INITIALISATION '================================================================= Init: hserptr =W2temp 'get back pointer SERTXD("{2",RootCmnd,cmnd,",") '==================================================== ' COMMANDER '==================================================== SELECT RootCmnd 'CaseVoice: CASE "v" SELECT cmnd CASE "1","b" GOSUB bip CASE "2","e" GOSUB whee CASE "3","o" GOSUB whoa CASE "4","v" GOSUB beep100 CASE "5","s" GOSUB sshhh ELSE cmnd ="t" GOSUB tsh ENDSELECT ELSE SELECT cmnd CASE "?" GOSUB PrintActs f_page0 =1 :GOSUB PrintActs :f_page0 =0 CASE "^","a" GOSUB PrintSubs CASE "1" to "8" GOSUB PrintAct :f_page0 =0 CASE "b" GOSUB PrintBeHaves CASE "p" GOSUB PrintPose CASE "d" GOSUB DumpActs CASE "#" GOSUB DumpASCIIacts 'CASE "T" GOSUB PrintTipSensor CASE "U" RootCmnd ="?" : GOTO Run1 CASE "W" RootCmnd ="?" : GOTO Run1 '2023-01-03 CASE "F" RootCmnd ="?" : GOTO Run1 '2023-01-03 CASE "G" GOSUB PrintGroundSensors CASE "h" GOTO Run3 CASE "S" GOSUB Save_Behaviour ' bS CASE "0" GOSUB LoadBehaviour '"b0" and "0" from Prog0init CASE "I" GOSUB initEEPROM ' bI CASE "E" GOTO START CASE "!" GOSUB PrintReactions '2023-01-10 CASE "M" GOSUB PrintMind '2023-01-10 ELSE GOSUB sshhh ENDSELECT ENDSELECT Run0: W2temp =hserptr 'Preserve pointer RUN 0 Run1: W2pulse =hserptr 'Preserve pointer RUN 1 Run3: W2pulse =hserptr 'Preserve pointer RUN 3 '==================================================== START: 'cmnd ="E" IF hserinflag =1 THEN :W2pulse =hserptr :RUN 0 :ENDIF 'The way back PWMOUT EyeLLED,255,1000 'active high Dutycycle for obeying PWMOUT EyeRLED,255,200 'active high Dutycycle for obeying pause 2000 PWMOUT EyeRLED,255,50 'active high Dutycycle for obeying pause 2000 'HIGH whiskerRLED 'HIGH whiskerLLED 'HIGH feelerRLED 'HIGH feelerLLED GOTO START '==================================================== ' HMI '==================================================== ' SOUND voice,(sound,time) time=~2.5ms @16MHz bip: SOUND voice,(80,7) RETURN '----------------------- beep100: ' SETFREQ m4 SOUND voice,(100,100) RETURN '----------------------- tsh: 'because that is what it sounds like SOUND voice,(240,10) '(255,10ms) @32MHz RETURN '----------------------- tshh: 'because that is what it sounds like SOUND voice,(240,20) '(255,10ms) @32MHz RETURN '----------------------- sshhh: 'because that is what it sounds like 'beep255: SOUND voice,(240,80) '(255,10ms) @32MHz RETURN '----------------------- whee: 'make rising sound FOR temp0 =50 TO 127 STEP 5 SOUND voice,(temp0,8) NEXT temp0 RETURN '----------------------- whoa: 'make falling sound FOR temp0 =127 TO 50 STEP -10 SOUND voice,(temp0,15) NEXT temp0 RETURN '==================================================== PrintSubs: SERTXD(CR,CR,"Subroutines ^,a",CR) SERTXD("0 tsh",CR,"1 bip",CR,"2 beep50",CR,"3 sshhh",CR) SERTXD("4 StampRL",CR,"5 WaveL",CR,"6 S",CR,"7 C",CR,"8 T",CR) RETURN '==================================================== PrintActs: 'Remember internal Slots/Acts are 0-7 keys [1]-[8] FOR cmnd ="1" TO "8" GOSUB PrintAct NEXT cmnd SERTXD(CR) RETURN '---------------------------------------------------- PrintBeHaves: SERTXD(CR,CR,"Thor",CR) SERTXD(Scmnd," speed",CR) SERTXD(#Speedmax," speedmax",CR) SERTXD(FLcmnd,"(",#FL,") Lift",CR) SERTXD(FPcmnd,"(",#FP,") Pace",CR) SERTXD(FTcmnd,"(",#FT,") Turn",CR) SERTXD(RHcmnd,"(",#LHC,",",#RHC,") Ride height LR",CR) ' SERTXD("Toes Offset Down= ",#TOD,CR) SERTXD(#TOF," Toes offset Front",CR) ' SERTXD("FootUp Leg in= ",FUScmnd,CR) SERTXD(kickcmnd," Kick",CR) SERTXD(#f_b_react," $ react",CR) SERTXD(#f_b_autosense," $ autotest",CR) SERTXD(#f_b_Uon," U/S react",CR) PEEK RAM_Wthresh,temp0 :SERTXD(#temp0," Wthresh",CR) PEEK RAM_Fthresh,temp0 :SERTXD(#temp0," Fthresh",CR) PEEK RAM_USawareAt,temp0 :SERTXD(#temp0," USawareAt - units 5cm/2inch",CR) PEEK RAM_UStoonear,temp0 :SERTXD(#temp0," UStoonear - units 5cm/2inch",CR) RETURN '---------------------------------------------------- PrintAct: 'Remember internal Slots/Acts are 0-7 keys [1]-[8] Slot =cmnd -"1" 'Logical Act 0 - 7 temp0 =Slot +1 Actptr =f_page0 *128 Actptr =Slot *16 +Actptr ActEnd =Actptr +15 MAX EEPROM_ActsEnd IF Actptr>=ActEnd THEN RETURN :ENDIF SERTXD(CR,"Act ") IF f_page0=1 THEN SERTXD("0") :ENDIF SERTXD(#temp0," - ") DO READ Actptr,temp0 IF temp0=255 THEN _endPrintAct 'uninitialised location SERTXD(temp0) Actptr =Actptr +1 LOOP UNTIL temp0="." OR temp0=";" OR temp0=255 OR Actptr>ActEnd _endPrintAct: RETURN '---------------------------------------------------- DumpActs: 'Dump sends all DATA to PC SERTXD(CR) FOR Slot =0 TO 14 'don't print slot 15 with config data FOR Actptr =0 TO 15 temp0 =Slot *16 +Actptr READ temp0,cmnd SERTXD(cmnd) NEXT SERTXD("|",CR) NEXT SERTXD(CR) RETURN '---------------------------------------------------- DumpASCIIacts: SERTXD(CR) FOR Slot =0 TO 15 FOR Actptr =0 TO 15 temp0 =Slot *16 +Actptr READ temp0,cmnd SERTXD(#cmnd,",") NEXT SERTXD("|",CR) NEXT SERTXD(CR) RETURN '---------------------------------------------------- PrintPose: '?p SERTXD(CR,CR,"RFwd=",#f_Rfwd,CR) READ EEPROM_LAC,temp0 SERTXD("E_LAC=",#temp0) READ EEPROM_LHC,temp0 SERTXD(" E_LHC=",#temp0) READ EEPROM_RHC,temp0 SERTXD(" E_RHC=",#temp0) READ EEPROM_RAC,temp0 SERTXD(" E_RAC=",#temp0,CR) SERTXD(" LAC=",#LAC," LHC=",#LHC," RHC=",#RHC," RAC=",#RAC,CR) SERTXD(" LAat=",#LAat," LHat=",#LHat," RHat=",#RHat," RAat=",#RAat,CR) RETURN '---------------------------------------------------- 'PrintTipSensor: '?T 'RETURN '---------------------------------------------------- PrintGroundSensors: '?G SERTXD(CR,"L",#senseLtoe," R",#senseRtoe,CR) RETURN '==================================================== PrintReactions: '2023-01-10 SERTXD(CR,"US+ vttatmtm.") SERTXD(CR,"US- vss-Btatmtm.") 'obstacle SERTXD(CR,"OLR s-BBtatmtm.") SERTXD(CR,"OL_ s-BRR.") SERTXD(CR,"O_R s-BLL.") 'hole SERTXD(CR,"HLR s-BBBBtatmtm.") SERTXD(CR,"HL_ s-BRRR.") SERTXD(CR,"H_R s-BLLL.",CR) RETURN '==================================================== PrintMind: '2023-01-10 'one char SERTXD(CR,"FB3LVFBFVHFRLRLRHLFHK1LVRBZF2F4V")'32 'two chars SERTXD(CR,"w1vew3bVw5vew7w9vobLvevovob0vss+s-eRbNeL")'40 SERTXD(CR,"eEertaelvveetaeRats-tms+s+s+vvtoaSasacat")'40 SERTXD(CR,"bNaSaceEtmvevovv",CR)'16 RETURN '==================================================== Save_Behaviour: ' b_set_Defaults WRITE EEPROM_f8_behaves,f8_behaves temp0 =Speedmax *16 +Scmnd -"0" WRITE EEPROM_Speeds,temp0 WRITE EEPROM_FLcmnd, FLcmnd WRITE EEPROM_FPcmnd, FPcmnd WRITE EEPROM_FTcmnd, FTcmnd WRITE EEPROM_TOF, TOF WRITE EEPROM_RHcmnd, RHcmnd WRITE EEPROM_kickcmnd,kickcmnd PEEK RAM_Wthresh,temp0 : WRITE EEPROM_Wthresh,temp0 PEEK RAM_Fthresh,temp0 : WRITE EEPROM_Fthresh,temp0 PEEK RAM_USawareAt,W2temphi 'hi nibble PEEK RAM_UStoonear,W2templo 'lo nibble temp0 =W2temphi *16 +W2templo WRITE EEPROM_USawarenear, temp0 'hi nibble,lo nibble RETURN '==================================================== LoadBehaviour: READ EEPROM_f8_behaves,f8_behaves READ EEPROM_Speeds, temp0 'Servo speeds Scmnd =temp0 //16 +"0" 'lo nib Speedmax =temp0 /16 'hi nib READ EEPROM_FLcmnd, FLcmnd 'Foot Lift UpDown movement READ EEPROM_FPcmnd, FPcmnd 'Foot Pace ForwardBack movement READ EEPROM_FTcmnd, FTcmnd 'Foot Turn READ EEPROM_RHcmnd, RHcmnd 'RideHeight READ EEPROM_TOF, TOF 'Toes Offset Front READ EEPROM_kickcmnd,kickcmnd READ EEPROM_RHC,RHC 'RHmid READ EEPROM_LHC,LHC 'LHmid READ EEPROM_LAC,LAC READ EEPROM_RAC,RAC READ EEPROM_Wthresh, temp0 :POKE RAM_Wthresh,temp0 READ EEPROM_Fthresh, temp0 :POKE RAM_Fthresh,temp0 READ EEPROM_USawarenear, temp0 W2temphi =temp0/16 :POKE RAM_USawareAt,W2temphi 'hi nibble W2templo =temp0//16 :POKE RAM_UStoonear,W2templo 'lo nibble f_Bmodified =1 :cmnd ="M" IF f_warm=1 THEN Run1 'do #1_NewBehave: so ?b(servo values) are right RETURN 'else return to #0 to do Posture '==================================================== InitEEPROM: WRITE EEPROM_LHC ,LHmid 'logical value WRITE EEPROM_LAC ,LAmid 'logical value WRITE EEPROM_RHC ,RHmid 'logical value WRITE EEPROM_RAC ,RAmid 'logical value WRITE EEPROM_TOF ,0 'Toes Offset Front 1-9 WRITE EEPROM_FLcmnd ,"2" 'Foot Lift 1-9, only 'up' foot moves WRITE EEPROM_FPcmnd ,"4" 'Pace ForwardBack movement 1-9 WRITE EEPROM_FTcmnd ,"4" 'Foot Turn movement 1-9 WRITE EEPROM_Speeds ,$52 'hinib=speedmax(5), lonib=speed(2) WRITE EEPROM_RHcmnd ,"1" 'RideHeight 1-9, WRITE EEPROM_kickcmnd, "2" WRITE EEPROM_Wthresh ,9 WRITE EEPROM_Fthresh ,9 WRITE EEPROM_USawarenear,$73 '7*16 +3 USawareAt=7 UStoonear=3 RETURN '====================================================