On 2006-07-03, Lichen Wang <old_cow_yel...@yahoo.com> wrote: > P1IN is a hardware read-only 8-bit Special Function Register > (SFR). Every time you read it, it gives a potentially > different result. In addition, it may result in some side > effect in the hardware. > > Suppose I want to read P1IN twice and I do not care about the reading and > only want to cause the hardware side effect twice. In Assembly, I would write: > mov.b &P1IN,Rx > mov.b &P1IN,Rx > where Rx is one of the un-used registers R4-R15. > > How do I do the same thing in C?
(void)P1IN; (void)P1IN; > (P1IN is declared to be a volatile unsigned char in the header file.) > Can I write two = P1IN + P1N;? Yes. > How about if (P1IN + P1IN) {/* nothing */}? Sure. > I am just starting to use c as a tool to generate code for > embedded system. I understand and accept the fact that in > order to be able to use any tool, you have to learn how to > use that tool first. But is this like priesthood? Do I have > to recite in Latin? No, just PDP-11 assembly language. -- Grant Edwards grante Yow! I am covered with at pure vegetable oil and I am visi.com writing a best seller!