Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "reg515.sfr"
- #include "lcd.h"
- int main()
- {
- int kod=0,delta=0;
- unsigned char cos;
- CRCH=0xFF;
- CRCL=0x00;
- CCH1=0xFF;
- CCL1=0;
- CCEN=0x08;
- CLK=1;
- P3=0xDF;
- T2I0=1;
- T2R1=1;
- lcd_init();
- out_instr(1);
- out_char('P');
- out_char('W');
- out_char('M');
- out_char('=');
- out_char('0');
- out_char('0');
- out_char('0');
- while(1)
- {
- int i=0;
- cos=get_kb();
- for(i=0;i<4000;i++);
- if(cos=='d')
- {
- if(CCL1<1);
- else
- {
- CCL1--;
- delta=100*CCL1/255;
- out_instr(1);
- out_char('P');
- out_char('W');
- out_char('M');
- out_char('=');
- out_char((int)delta/100+48);
- if(delta<100)
- out_char((int)delta/10+48);
- else
- out_char((int)delta/10+38);
- out_char((int)delta%10+48);
- }
- }
- if(cos=='g')
- {
- if(CCL1>254);
- else
- {
- CCL1++;
- delta=100*CCL1/255;
- out_instr(1);
- out_char('P');
- out_char('W');
- out_char('M');
- out_char('=');
- out_char((int)delta/100+48);
- if(delta<100)
- out_char((int)delta/10+48);
- else
- out_char((int)delta/10+38);
- out_char((int)delta%10+48);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement