#include "3048F.H" void wait(void){ long loop=400000; while(loop--); } int main(void){ int k; unsigned char sw; P1.DDR=0xff; P2.DDR=0x00; P2.PCR.BYTE=0xff; while(1){ sw=P2.DR.BYTE; if(sw==0x01){ for(k=0;k<5;k++){ P1.DR.BYTE=0x01; wait(); P1.DR.BYTE=0x02; wait(); P1.DR.BYTE=0x04; wait(); P1.DR.BYTE=0x08; wait(); P1.DR.BYTE=0x10; wait(); P1.DR.BYTE=0x20; wait(); P1.DR.BYTE=0x40; wait(); P1.DR.BYTE=0x80; wait(); } } else{ for(k=0;k<2;k++){ P1.DR.BYTE=0x00; wait(); P1.DR.BYTE=0xff; wait(); P1.DR.BYTE=0x0f; wait(); P1.DR.BYTE=0xff; wait(); P1.DR.BYTE=0xf0; wait(); P1.DR.BYTE=0xff; wait(); P1.DR.BYTE=0xcc; wait(); P1.DR.BYTE=0xff; wait(); } } } return(1); }