?? ddx.c
字號:
#include <avr/io.h>
#include <avr/delay.h>
#include "TWI/TWI.h"
#include "LCD12864/LCD12864.h"
#include "KEY/KEY.h"
#define SETBIT(x,y) (x|=(1<<y)) //set bit y in byte x
#define CLRBIT(x,y) (x&=(~(1<<y))) //clear bit y in byte xx
#define DDX_RET { SETBIT(DDRD,PD7);CLRBIT(PORTD,PD7);}
#define DDX_OPER { CLRBIT(DDRD,PD7);SETBIT(PORTD,PD7);}
/*--------------------主程序---------------------------------*/
int main()
{
uint8 write_buff[7]={0x80,0x01,0x70,0x20,0x89,0x6d,0x66},read_buff;
DDRB=0X00;
PORTB=0XFF;
init_lcd();
twi_init(); //初始化cpu
inform_disp();
DDX_RET;
_delay_ms(2);
DDX_OPER;
while(wtDDX_nbyte(&write_buff[2],0x08,1));//no enable
while(wtDDX_nbyte(&write_buff[1],0x09,1));//mute
while(wtDDX_nbyte(&write_buff[3],0x0b,1));
while(wtDDX_nbyte(&write_buff[3],0x0c,1));
while(wtDDX_nbyte(&write_buff[3],0x0d,1));
while(wtDDX_nbyte(&write_buff[3],0x0e,1));
while(wtDDX_nbyte(&write_buff[3],0x0f,1));
while(wtDDX_nbyte(&write_buff[3],0x10,1));
while(wtDDX_nbyte(&write_buff[3],0x11,1));
while(wtDDX_nbyte(&write_buff[3],0x12,1));
while(wtDDX_nbyte(&write_buff[4],0x00,1));//MLCK in
// while(wtDDX_nbyte(&write_buff[2],0x0a,1));//master volumen
while(wtDDX_nbyte(&write_buff[2],0x09,1));//no mute
while(wtDDX_nbyte(&write_buff[0],0x08,1));//enable
uint8 sw_num,master_vol=120;
while(1)
{
sw_num=SW_turn();
if(sw_num!=100)
{
if(sw_num<100){master_vol+=1;if(master_vol>255)master_vol=255;}
if(sw_num>100){master_vol-=1;if(master_vol<1)master_vol=1;}
Disp_char(0,40,((256-master_vol)/100+48),1);
Disp_char(0,48,((256-master_vol)%100/10+48),1);
Disp_char(0,56,((256-master_vol)%10+48),1);
while(wtDDX_nbyte(&master_vol,0x0a,1));//master volumen
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -