|
- PBDATDIR .set 0709Ah
- main()
- {
- unsigned int i;
- unsigned long k;
- led=0x0080;
- while(1)
- {
- for (i=0;i<4;i++)
- {
- PBDATDIR = PBDATDIR & 0x0FF00;
- PBDATDIR = PBDATDIR | led;
- for(k=0;k<0x1FFFF;k++)
- {
- asm(" nop ");
- asm(" nop ");
- }
- led=led>>1;
- if(led==0x0008)
- {
- led=0x0080;
- }
- }
- }
- }
复制代码
书上的一个循环点亮IOPB4~IOPB7的程序
|
|