Subject:
|
NBC with NXT - crash!
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Sat, 21 Oct 2006 04:46:36 GMT
|
Viewed:
|
11998 times
|
| |
| |
Hi, I wrote the following program, and it causes my NXT to crash! If I remove
the ReadSensor() call from thread check_sensors, it doesn't crash. If I put a
call to ReadSensor() in thread main, it doesn't crash. I tried putting mutexes
around all the motor calls, but it still crashes. Can anybody explain why?
Note: My NXTdefs.h contains some macros which I've added, but nothing out of the
ordinary. I included my ReadSensor macro in the listing.
#include "NXTDefs.h"
#define MOVE_TIME 800
#define TURN_TIME 200
#define ReadSensor(port,value) mov value, InputIOScaledValue(port)
dseg segment
m1 mutex
value sword 0
buf byte[]
dseg ends
thread main
precedes move_square, check_sensors
SetSensorTouch(IN_1)
exit
endt
thread move_square
SquareLoop:
OnFwd(OUT_BC,100)
wait MOVE_TIME
OnRev(OUT_C,100)
wait TURN_TIME
jmp SquareLoop
endt
thread check_sensors
SensorLoop:
ReadSensor(IN_1,value)
//numtostr buf,Switch
//TextOut(0,0,1,buf,10)
brtst EQ, SensorLoop, value
OnRev(OUT_BC,100)
wait 50
Off(OUT_C)
wait 85
OnFwd(OUT_C,100)
jmp SensorLoop
endt
|
|
Message has 2 Replies: | | Re: NBC with NXT - crash!
|
| (...) Running this program on my NXT does not cause mine to crash. Are you definitely running the 1.03 firmware? You can see the version using Settings|NXT Version on the NXT or from the Diagnostic window in BricxCC. My brick shows 01.1240/01.03 in (...) (18 years ago, 21-Oct-06, to lugnet.robotics.nxt)
| | | Re: NBC with NXT - crash!
|
| (...) Well, I had to replace the batteries yesterday, and with the new batteries this no longer crashes! Seems weird to me, but there you are. Has anybody else seen weird behaviour with their NXT when the batteries are running low? ROSCO (18 years ago, 27-Oct-06, to lugnet.robotics.nxt)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in NXT programmable brick
|
|
|
|