I'm having some difficulty writing a serial test program. I'm using the wwatch() function to look for serial input from the application program. This is in a signal function which is being called from a user function: func void serialTestHarness(void) { /* declare variables */ <snip> LiMode = 0x00; /* wait for message */ /* state machine */ while(1) { switch (LiMode) { /* Just wait here for message. When program sends one, * start processing it. */ case 0x00: waitForMsg(); LiMode = 0x01; break; /* A byte is being received. Read incoming message. */ case 0x01: readMsg(); LiMode = 0x02; break; /* respond to message */ case 0x02: respondToMsg(); LiMode = 0x00; break; } } } signal void waitForMsg(void) { /* wait here until byte is received */ wwatch(SOUT); printf("%2.2X ", SOUT); /*debug*/ /* when byte is received, store in variable & return */ msgCmd = SOUT; } When the waitForMsg() function is called from serialTestHarness(), it returns immediately, without printing the value of SOUT. In other programs I've written, when wwatch() is in the function called from the command line, it works fine. Has anyone else seen this? Does anyone havce a suggestion? (Function serialTestHarness() calls other signal functions. Since signal functions can't call other signal fucntions, I can't put wwatch in serialTestHarness() and make it a signal function, too.)
From "Getting Started with µVision2", Chap. 6, µVision2 Debug Functions, User Functions, Restrictions: User functions may not invoke signal functions or the twatch function. Actually, I found that user functions can invoke signal functions, but with unexpected consequences. In my case, I found that the signal function returns, but the swatch() command is still executing! (I assume the same would happen with other watch() functions, but I'm not going to check.) Interestingly, one of the restrictions for Signal functions contradicts the above user function restriction: A signal function may be invoked by a user function. Typo? I don't know if I can rely on this feature of µVision2. Seems like it's not as developed as I had hoped.