Hi all,
Is it possible to get the CPU's machine cicles from a C script? I'm using the C Scripting feature of the uVision3, and I need to syncronise the scripts with the simulation. For example, i need to have a C script that will togle a pn after a specific number of machine cicles.... Is it possible?
Best regards, Marius
I'm using the C Scripting feature of the uVision3,
You're being a little hard to understand there. That's the language of debugger functions you're talking about. Yes, it looks and works a lot like C. But it's not C, nor is it really a script language --- it's somewhere in between.
For example, i need to have a C script that will togle a pn after a specific number of machine cicles.... Is it possible?
Yes. See the debugger script help file about twatch() and swatch() and friends (GS51.pdf, "uVision Debugger functions"
Thanks Hans,
I will check the GS51.pdf manual. Please see my previsios for a more detailed description of what i'm needed. It is difficult to explain my self when I have 40C and the boss is putting a big pressure on your shoulders. :)
A nice day to you.
I managed to find an answer to my problem; it is much simple than i was expected.
µVision3 includes a number of predefined debug functions that are always available from the debuger's simulation function. Those are: - void rwatch (ulong address) -> Delay execution of signal function until read access to address - void swatch (float seconds) -> Delay execution of signal function for specified time - void twatch (ulong states) -> Delay execution of signal function for specified number of CPU states - void wwatch (ulong address) -> Delay execution of signal function until write access to address
All of these are very useful to syncronize your debug function with the simulator. Moreover, the debuger provide system variables that are very usefull in case that you need the syncronization: - $ unsigned long represents the program counter. You may use $ to display and change the program counter. For example, $ = 0x4000sets the program counter to address 0x4000. - states unsigned long current value of the CPU instruction state counter; starts counting from 0 when your target program begins execution and increases for each instruction that is executed.