换一种思路:
也可以直接对三个常数进行比较大小,然后将最大的数存放在于bank3的某单元中。
<span style="font-size:18px;">#include<pic.h>
//符号定义
#define x_data 0xe0;
#define y_data 0x60;
#define z_data 0x90;
bank3 static volatile unsigned char add @0x40 ; //实际地址=80h*3+40h=1c0h
int x,y,z;
void comparison()
{ if (x>y)
z=x;
else
z=y;
}
main()
{ x = x_data ;
y = y_data;
comparison();
x = z;
y = z_data;
comparison();
add = z;
while(1){ ; }
}</span>
|