Our Propeller Chip keeps stopping mid program
What could be the cause of our micromouse having a stroke at random intervals of time?
My partner and I are almost finished with our micromouse but we are having problems. In mid program, our micromouse ceases to follow the code and does one of three things. The mouse completely stops (In some cases, a single LED on pin 6 turns on), The mouse has one track move in reverse and 2 LEDs turn on (Pins 6,5, and 3 go high but I do not have pins 6, and 5 set as outputs anywhere in my code. Pin 4 toggles at a frequency of 4 MHz) or the mouse just moves at full speed (Pins 3 and 1 stay high).
This problem can be cause by one of two things, probably the code but I also switched the power supply of our micromouse from 6 volts to 12 volts (The data sheets for all of our voltage regulators said they could be powered by anything below 30 Volts but the regulators seem to be running hotter). I am making the power supply a suspect because we did not have this problem until today.
Any help would be appreciated on this topic. I will try to post our code when I get back to my apartment.
My partner and I are almost finished with our micromouse but we are having problems. In mid program, our micromouse ceases to follow the code and does one of three things. The mouse completely stops (In some cases, a single LED on pin 6 turns on), The mouse has one track move in reverse and 2 LEDs turn on (Pins 6,5, and 3 go high but I do not have pins 6, and 5 set as outputs anywhere in my code. Pin 4 toggles at a frequency of 4 MHz) or the mouse just moves at full speed (Pins 3 and 1 stay high).
This problem can be cause by one of two things, probably the code but I also switched the power supply of our micromouse from 6 volts to 12 volts (The data sheets for all of our voltage regulators said they could be powered by anything below 30 Volts but the regulators seem to be running hotter). I am making the power supply a suspect because we did not have this problem until today.
Any help would be appreciated on this topic. I will try to post our code when I get back to my apartment.
CON _clkmode = xtal1 + pll16x 'Use crystal*16 for a speed of 80_000_000 Hz _xinfreq = 5_000_000 'External 5 MHz crystal XI & XO '--------------------------------------------------------------------------------------------------- VAR Long LIRSen Long RIRSen Long PingS Long Dir Long PushButton '---------------------------------------------------------------------------------------------------- PUB IR_Sensors Dira[4]~ 'This portion of the code prevents the program Repeat ' from starting until an external button is pushed PushButton := INA[4] ' on the top of the micromouse, allowin the user to While PushButton < 1 ' center the robot in the starting corner of the maze Cognew(@ADCclock,@LIRSen) 'Cog to run the clock for the AD converter Cognew(@SerIn,@LIRSen) 'Cog to read the Serial outputs from 2 ADC0831 converters Cognew(@Ping,@LIRSen) Waitcnt(clkfreq + cnt) Cognew(@Motor,@LIRSen) 'Cog used to run steering and basic motion 'Cognew(@Logic,@LIRSen) Repeat Waitcnt(400 +cnt) '--------------------------------------------------------------------------------------------------------- DAT ORG 0 ADCclock MOV DIRA,ClockPinout 'Toggles pins 16 and 23 high and low at 100KHz CLKLoop MOV OUTA,ClockPinout ' to create clock signal for the ADCs CALL #ClkDelay NOP 'Keeps the signal at a 50% duty cycle NOP MOV OUTA, #0 CALL #ClkDelay JMP #CLKLoop ClkDelay Mov DelayVal,#46 'Subroutine used to generate the delay between DelayLoop SUB DelayVal,#1 ' high and low cycles. TJNZ DelayVal,#DelayLoop ClkDelay_RET RET DelayVal LONG 0 'Variable for creating the delay to reach 100KHz ClockPinout LONG $810000 'Activates pins 16 and 23 for clock signal '----------------------------------------------------------------------------------------------- FIT 496 DAT 'Code reads AD converters ORG 0 'First part of the code reads the first SerIn MOV Temp,PAR MOV GlobReg1,Temp ADD GlobReg1,#4 MOV DIRA,IRMask ' five bits of the Right Sensor ADC MOV OUTA,IRMask '-------------------------------- SerLoop MOV RRange,#0 MOV LRange,#0 MOV OUTA,LBReadMask 'CK enable for the first adc CALL #CKFollow CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp ROL RRange,#1 CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp ROL RRange,#1 CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp ROL RRange,#1 CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp ROL RRange,#1 CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp ROL RRange,#1 CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp ROL RRange,#1 CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp ROL RRange,#1 CALL #CKFollow MOV RTemp,INA AND RTemp,DATMaskR OR RRange,RTemp CALL #CKFollow MOV RSenVal,RRange 'Stores final range values into variables ROR RSenVal,#14 WRLONG RSenVal,GlobReg1 '-------------------------------------- MOV OUTA,RBReadMask 'This remaining part of the code reads CALL #CKFollow ' the first five bits of the Left sensor CALL #CKFollow ' second ADC MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp ROL LRange,#1 CALL #CKFollow MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp ROL LRange,#1 CALL #CKFollow MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp ROL LRange,#1 CALL #CKFollow MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp ROL LRange,#1 CALL #CKFollow MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp ROL LRange,#1 CALL #CKFollow MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp ROL LRange,#1 CALL #CKFollow MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp ROL LRange,#1 CALL #CKFollow MOV LTemp,INA AND LTemp,DATMaskL OR LRange,LTemp CALL #CKFollow MOV OUTA,IRMask MOV LSenVal,LRange ' that will remain consistent through the ROR LSenVal,#15 WRLONG LSenVal,Temp JMP #SerLoop ' sampling period. CKFollow CKHigh MOV CLKMask,CKMask 'This Subroutine makes this cog wait AND CLKMask,INA ' unil the clock cog completes one TJZ CLKMask,#CKHigh ' oscillation before sampling a bit CKLow MOV CLKMask,CKMask AND CLKMask,INA TJNZ CLKMask,#CKLow CKFollow_RET RET LBReadMask LONG $40000 RBReadMask LONG $80000 IRMask LONG $C0000 CKMask LONG $400000 CLKMask LONG $400000 DATMaskR LONG $4000 DATMaskL LONG $8000 RRange LONG 0 LRange LONG 0 RTemp LONG 0 LTemp LONG 0 RSenVal LONG 0 LSenVal LONG 0 Temp LONG 0 GlobReg1 LONG 0 '-------------------------------------------------------------------------------------- FIT 496 DAT ORG 0 Motor MOV Temp2,PAR MOV GlobReg2,PAR ADD GlobReg2,#4 MOV GlobReg3,PAR ADD GlobReg3,#8 MOV DIRA,N MotorRun GoStrI GoStr MOV OUTA,#%1010 MOV X,BOn CALL #MovDel MOV OUTA,#%1000 MOV X,LOn CALL #MovDel MOV OUTA,#%0000 MOV X,Offf CALL #MovDel JMP #GoStr '------------------------------------------------------------------- '------------------------------------------------------------------- TurnLeft MOV OUTA,#%1001 'Turn Left MOV X,LeftDelay CALL #MovDel JMP #EndRun '------------------------------------------------------------------- '------------------------------------------------------------------- TurnRight MOV OUTA,#%0110 'Turn Right MOV X,RightDelay CALL #MovDel JMP #EndRun '------------------------------------------------------------------- '------------------------------------------------------------------- TurnAround MOV OUTA,#%1001 'Turn 180 degrees MOV X,RotateDelay CALL #MovDel JMP #EndRun '------------------------------------------------------------------- '------------------------------------------------------------------- Stop MOV OUTA,#%0000 JMP #Stop '------------------------------------------------------------------- '------------------------------------------------------------------- EndRun MOV OUTA,NU JMP #MotorRun '------------------------------------------------------------------- '------------------------------------------------------------------- MovDel SUB X,#1 'Universal Time Delay Loop TJNZ X,#MovDel MovDel_RET RET '------------------------------------------------------------------ '------------------------------------------------------------------- JPMorgan LONG 170 LouDiamondPhillips LONG 2000 K LONG 160 L LONG 50000 M LONG 50000 N LONG %1111 NU LONG %0010_0000_0000 TimeRemaining LONG 4000 BOn LONG 2000 LOn LONG 320 Offf LONG 150 LeftSenVal LONG 0 RightSenVal LONG 0 UltSenVal LONG 0 X LONG 0 LeftDelay LONG 5400000 RightDelay LONG 5400000 RotateDelay LONG 10000000 Temp2 LONG 0 GlobReg2 LONG 0 GlobReg3 LONG 0 FIT 496 DAT ORG 0 'Ping Ultrasonic Sensor driver Ping MOV TempAdd,PAR ADD TempAdd,#8 Ping2 MOV DIRA,PingMsk MOV OUTA,PingMsk MOV DelCnt,#20 Delay1 DJNZ DelCnt,#Delay1 MOV OUTA,#0 MOV DIRA,#0 MOV PingVal,#0 PinChk1 MOV PlsChk,INA AND PlsChk,PingMsk TJZ PlsChk,#PinChk1 CntLoop ADD PingVal,#1 MOV PlsChk,INA AND PlsChk,PingMsk TJNZ PlsChk,#CntLoop MOV PingValF,PingVal WRLONG PingValF,TempAdd MOV DelCnt,DelLong Delay2 NOP DJNZ DelCnt,#Delay2 JMP #Ping2 TempAdd LONG 0 PingMsk LONG %1000_0000_0000 PlsChk LONG 0 PingVal LONG 0 PingValF LONG 0 DelCnt LONG 0 DelLong LONG 1000000 FIT 496
Comments