Hi. I tried to use the Signal Function i my project (lpc2129) and it didn't work. There an error appeared during compilation. Code of my simple signal function:
void signal sig(void) { ain1=1.0; twatch(100); }
Can someone explain why it doesn't work?
wrong syntax - it should be something like shown below. You might also look into the 'Measure' example provided with the MDK.
Signal void analog0 (float limit) { float volts; printf ("Analog0 (%f) entered.\n", limit); while (1) { /* forever */ volts = 0; while (volts <= limit) { ain0 = volts; /* analog input-0 */ swatch (0.01); /* wait 0.01 seconds */ volts += 0.1; /* increase voltage */ } volts = limit; while (volts >= 0.0) { ain0 = volts; swatch (0.01); /* wait 0.01 seconds */ volts -= 0.1; /* decrease voltage */ } } }
The code shown above doesn't work. Another error appeared: error: #77-D: this declaration has no storage class or type specifier
I had been trying to use signal functions presented in Keil user's guide...and nothing...
The signal function shown before applies to the uVision simulator and acts much like a script which generates inputs to the simulation. Such funtions are 'compiled' in the simulator environment by a built in parser and.
Trying to compile a 'signal' funtions with the MDK/RVCT compiler makes no sense since it does not know anything about the simulation or 'signal' or 'twatch' etc.