NXC: program blocks caused by PlayTones()
Posted: 30 Mar 2013, 17:43
I added some PlayTones() to my program for status signalizing and debugging.
Now after playing the sound melody the program flow always blocks (freezes), the NXT makes a frequently cheeping noise (> 10kHz) or the motor mux crackles -
and nothing happens to the program any more.
Anyway, it still is reacting to a touch pressure polled by an Emergency Stop tasks.
This malfunction is new since I'm using a touch muxer (homebrewed PCF8574) and a motor muxer (MS_MTRMX) instead of a 2nd NXT (formerly paired shakily by BT)
- I'm not sure if an interference with a muxer is the reason why.
if I remove the Playtones() command then the program runs fine.
here's a snippet:
the whole NXC code:
any ideas?
Now after playing the sound melody the program flow always blocks (freezes), the NXT makes a frequently cheeping noise (> 10kHz) or the motor mux crackles -
and nothing happens to the program any more.
Code: Select all
Tone sndChordUp[] = {TONE_C4,50, TONE_E4,50, TONE_G4,50,
TONE_C5,50, TONE_E5,50, TONE_G5,50, TONE_C6,200};
...
PlayTones(sndChordUp);
This malfunction is new since I'm using a touch muxer (homebrewed PCF8574) and a motor muxer (MS_MTRMX) instead of a 2nd NXT (formerly paired shakily by BT)
- I'm not sure if an interference with a muxer is the reason why.
if I remove the Playtones() command then the program runs fine.
here's a snippet:
Code: Select all
/******************************************************************************/
task main(){
/******************************************************************************/
char EP, // flag: en passant
RK, // flag: castling=Rochade
CK, CM, // flag: check!=Schach! (1&8, 1&16)
turn, // side on turn
chosen; // manual or auto move from stdin input;
char board[129]; // Piece K_start-> L_dest
int K, L, // score local, remote
score, rscore1, rscore2, rscore3, idum, buf;
char PMOD=0, m1, m2, m3;
string s;
// init all defauts
Init();
InitIOports();
InitLookupTable();
start EmergencyStop;
start GetPCF8574Values;
start PneumPressurePump;
start DisplayValues;
// chess robot setup
Claw_close(); Wait(500);
Claw_open(); Wait(500);
Hand_up(); while (!SensorT_Cup);
RobotArmsZeroInit();
PlayTones(sndChordUp); // <<<< blocks if not outcommented
// align board center base line
Claw_close(); Wait(500);
statusline="=> sqr. 128 ";
MoveClawTo(128);
PlayTones(sndChordUp); // <<<< blocks if not outcommented
Coast(OUT_ABC); Wait(200);
// single chess square alignment
Hand_up(); while (!SensorT_Cup); Claw_open();
stop DisplayValues; statusline=clrln;
buf=Menu("Calibrate ?", "/9 /ALL /no");
any ideas?