Hi, I am working with uvision4 for c167 and the problem i face with is that I dont know how to define and use signal function utility to assign a pulse input to my program.This is my code and following is the syntax error i confronted:any one can help me? Regards
#include<stdio.h> #include<reg167.h>
signal void int0_signal (void) { while (1) { PORT3 |= 0x04; /* pull PORT 3.2 high */ swatch (0.05); /* wait 50 milliseconds */ PORT3 &= ~0x04; /* pull PORT 3.2 low */ swatch (0.05); /* wait 50 milliseconds */ } } void main (void) { int0_signal(); }
Build target 'Target 1' compiling wave.c... wave.c(6): error C42: 'int0_signal': not in formal parameter list wave.c(6): error C25: syntax error near '{' wave.c(18): error C7: compilation aborted Target not created
Careful there so you don't mix the syntax used for writing debug scripts run by the debugger to send stimuli to a simulated processor with normal C code that you write and compile and run inside your microcontroller.
The debugger scripts aren't compiled by the C166 compiler. And they can't be run in the processor - it is the debugger that runs them.
Thanks for your reply but I am new in keil and I dont understand where I should write my debugger script and signal function.Can you please explain more?
I dont want to send the code to processor but I want to simulate my programm and as an input I need to simulate the input pulse.How can i simulate this input pulse?
By how about not trying to compile your debugger script with the compiler? It is not (!) C code, even if it has lots of similarities.
Your file have extension .c. You include stdio.h and reg167.h as if you intended to write a c program.
Have you looked at the available debugger script examples?
You should write a signal function or create a Toolbox and store all your simulation functions in a file (e.g. a *.ini) Then go to "Options for Target - Debug - Initialization File: ..." and specify this file. You can edit it later.
Don't forget to read the µVision help wich shows several examples (search for "Simulation").