Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<at89c51xd2.h>
- unsigned char xdata control _at_ 0xe003;
- unsigned char xdata porta _at_ 0xe000;
- unsigned char xdata portb _at_ 0xe001;
- unsigned char xdata portc _at_ 0xe002;
- void function(unsigned char ch)
- {
- int i;
- for(i=0;i<8;i++)
- {
- unsigned char tmp;
- tmp=0x80&ch;
- if (tmp)
- control=0x03;
- else
- control=0x02;
- control=0x01;
- control=0x00;
- ch=ch<<1;
- }
- }
- void main()
- {
- control = 0x80;
- //prints 891
- function(0xf9);//8
- function(0x90);//9
- function(0x80);//1
- function(0xff);
- function(0xff);
- function(0xff);
- }
Add Comment
Please, Sign In to add comment