Need to be clearer. I cannot interfere with the customers' routines. Therefore, I can't 'break' in and print out register contents. So how do I say, "OK, Printf: print out what's at this address. " I tried passing R1 to PrintF. Unless I call is an unsigned integer, it doesn't help. And then it thinks it's a VARIABLE named R1, not the specific register. I tried @R1. Nothing there either. Is there a special symbol that says, "Look, this is an internal register. I want you to print the contents of it: e.g., #R1, *R1, %R1. Thanks, I need specifics.
"So how do I say, "OK, Printf: print out what's at this address. " Create a pointer to that address and dereference it. "Look, this is an internal register. I want you to print the contents of it:" You're unlikely to learn anything useful from using printf() to output the contents of the 8051 registers. What are you trying to achieve?
Ahhh, I think you have it. Could you give me an example of "Creating a pointer and dereferencing it"? I'm afraid the verb 'dereference' isn't in my vocabulary. Thanks.
I cannot interfere with the customers' routines. ... So how do I say, "OK, Printf: print out what's at this address. " I tried passing R1 to PrintF. If you can not "interfere with routines" the value of r1 will be totally meaningless. Erik
I suspect that what he means when he says to make a pointer and dereference it is that you should do something like:
unsigned char data *regptr; regptr = 0x01; printf("R1: %x\n",*regptr);
Not true that the 'registers' contents will be totally meaningless' by the time I get to Printf. I've already single stepped through the disassembly code, and the only Register whose contents change in MY Printf, is Reg. 7. I am checking out a routine which uses registers to move external data around, and want to verify for the customer that the registers are doing what I claim they are doing. I've only been throwing code for 35 years, from the days of the UNIVAC 1004 with 80 bytes (not KByte, not MBytes) and the PDP-11 with DEC's wonderful Macro-11 assembly code, so the oneupsmanship/ganging-up remarks don't mean much. But it would seem that Keil employees, if such you are, would be more civil. If you're just ordinary engineers, I understand. Civility isn't a pre-requisite for such professions, unfortunately. So cut and slice away!!! I've got what I needed. Great way to encourage use of this 'forum'.
Once again we have a thread "it is no business of yours what I am doing, just answer my question". Ever so often, someone believe that "switching to micros' is nothing (as indicated by the previous experience the poster list) and "just answer" is impossible since the question is asked from the perspective of a non-micro. The techniques and approaches in the micro world are very different from the techniques used in e.g. the VAX or PC world. For that very reason the questions "why do you want to do this" are by no means an offense but rateher a means of honing in on what the "real" problem is. And - once again someone got offended by our attempts to help - so be it. Erik
None of the users who have been "ganging-up" on you are Keil employees. Just wanted to point that out, since I wouldn't want to malign their reputation in this whole discourse. Also, while I appreciate that you've been "throwing code" for quite some time, it's clear that said code thrown was not written in C. People need to ask legitimate questions about what you're doing when you talk about using printf() without yet telling us whether something's connected to a serial port and if so, what. Otherwise, printf might not do anything at all, even if my pointer example was the code you were looking for.
"I've only been throwing code for 35 years" and yet you still don't know what "dereference" means in the context of a pointer?!