定位显示系统msp430程序
- #include "msp430g2553.h"
- #include "math.h"
- #define SENDCOMM 0XF8 //0XF1000
- #define READCOMM 0XFC //0XF1100
- #define SENDDATA 0XFA //0XF1010
- #define READDATA 0XFE //0XF1110
- /*-----12864串行定义--------*/
- #define E_CLK_0 P1OUT &= ~BIT7 //时钟信号为0
- #define E_CLK_1 P1OUT |= BIT7 //时钟信号为1
- #define RW_SID_0 P1OUT &= ~BIT6 //数据信号为0
- #define RW_SID_1 P1OUT |= BIT6 //数据信号为1
- /*-----12864工作方式定义-------*/
- #define EXTEND_SET 0x34//扩展指令集,绘图显示关
- #define DRAW_ON 0x36 //绘图显示开
- #define DRAW_OFF 0x34 //绘图显示关
- #define BASIC_SET 0x30//基本指令集
- #define FOSC 16000000
- #define Machine_cycle 1.0/FOSC
- #define Sound 340
- /*------LCD12864基本函数-------*/
- void LCD_send_byte(unsigned char a);
- unsigned char LCD_read_byte();
- void LCD_write_com(unsigned char comm);
- void LCD_write_data(unsigned char lcd_data);
- void LCD_set_addr(unsigned char x, unsigned char y);
- void LCD_write_string(unsigned char addr_x, unsigned char addr_y, char* str);
- void LCD_list_num(unsigned char x,unsigned char y,long number);
- void LCD_list_Decimal(unsigned char x,unsigned char y,double Decimal);
- void LCD_init(void);
- void LCD_write_char(unsigned char x, unsigned char y,unsigned char flag, char data);
- void LCD_clear(void);
- unsigned char LCD_read_data();
- void check_busy();
- /*-----LCD12864绘图函数-------*/
- void GUI_clear(); //绘图清屏函数 (清屏指令在画图时不能使用)
- void GUI_draw_full_picture(const unsigned char *dat);//画满屏图片,横向取模
- //void LCD_set_dot(unsigned char x,unsigned char y);//打点程序
- //void GUI_hline(unsigned char x0,unsigned char x1,unsigned char y);//画水平线函数,x0,x1为起始点和终点的水平坐标,y为垂直坐标
- /*---------键盘函数---------*/
- unsigned char getkey(void);
- void GPIO_init();
- void tiMER0_init();
- void TIMER1_init();
- void Calculation();
- unsigned char num[] = {"0123456789ABCDEF"};
- unsigned char key_t,key,t;
- unsigned char odd;
- unsigned long cap1_2=0;
- unsigned long cap2_0=0;
- unsigned long cap2_1=0;
- unsigned long cap2_4=0;
- unsigned int flag=0;
- double x=0,y=0;
- double X[20];
- double Y[20];
- void main(void) {
- WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
- DCOCTL=CALDCO_16MHZ;
- BCSCTL1=CALBC1_16MHZ;
- IFG1 &= ~OFIFG; // Clear OSCFault flag
- LCD_init();
- LCD_clear();
- GPIO_init();
- TIMER0_init();
- TIMER1_init();
- LCD_write_string(1,8,"坐标");
- _EINT();//开全局中断
- while(1)
- {
- if(cap1_2!=0)
- if(cap2_0!=0)
- if(cap2_1!=0)
- if(cap2_4!=0)
- {
- _DINT();
- TA0CTL&=~MC_2;
- TA1CTL&=~MC_2;
- Calculation();
- cap1_2=0;
- cap2_0=0;
- cap2_1=0;
- cap2_4=0;
- TA0CCR1=0x0000;
- TA1CCR0=0x0000;
- TA1CCR1=0x0000;
- TA1CCR2=0x0000;
- P1SEL&=~BIT2;
- P1OUT&=~BIT2;
- _delay_cycles(10);
- P1IE|=BIT2;
- _EINT();
- }
- }
- }
- //P1口外部中断
- #pragma vector=PORT1_VECTOR
- __interrupt void Port_1(void)
- {
- if(P1IFG&BIT2)
- {
- P1OUT^=BIT0;
- P1IE&=~BIT2; //1.2禁止中断
- P1OUT|=BIT2; //1.2输出
- P1SEL|=BIT2; //p1.2外围模块功能
- _delay_cycles(10);
- TA0CTL|=MC_2+TACLR; //MC2连续计数 TACLR清除
- TA1CTL|=MC_2+TACLR;
- TA0CCTL1|=CM_2+CCIE;//CM选择捕获 CCIE中断允许
- TA1CCTL0|=CM_2+CCIE;
- TA1CCTL1|=CM_2+CCIE;
- TA1CCTL2|=CM_2+CCIE;
- P1IFG&=~BIT2; //P1.2无中断请求
- }
- }
- // Timer A0 interrupt service routine
- #pragma vector=TIMER0_A1_VECTOR //A1定时 R0计数
- __interrupt void Timer0_A1(void)
- {
- TA0CCTL1&=~CM_2;
- TA0CCTL1&=~CCIE;
- P1OUT^=BIT0;
- cap1_2=TA0CCR1;
- TA0CCTL1&=~CCIFG;
- }
- // Timer A1 interrupt service routine
- #pragma vector=TIMER1_A0_VECTOR
- __interrupt void Timer1_A0(void) //A0定时 R1计数
- {
- TA1CCTL0&=~CM_2;
- TA1CCTL0&=~CCIE;
- P1OUT^=BIT0;
- cap2_0=TA1CCR0;
- TA1CCTL0&=~CCIFG;
- }
- #pragma vector=TIMER1_A1_VECTOR //A1定时 R1计数
- __interrupt void Timer1_A1(void)
- {
- switch(TA1IV)
- {
- case TA1IV_TACCR1:
- {
- TA1CCTL1&=~CM_2;
- TA1CCTL1&=~CCIE;
- P1OUT^=BIT0;
- cap2_1=TA1CCR1;
- TA1CCTL1&=~CCIFG;
- break;
- }
- case TA1IV_TACCR2:
- {
- TA1CCTL2&=~CM_2;
- TA1CCTL2&=~CCIE;
- P1OUT^=BIT0;
- cap2_4=TA1CCR2;
- TA1CCTL2&=~CCIFG;
- break;
- }
- default:break;
- }
- }
- void GPIO_init()
- {
- //标志口
- P1DIR|=BIT0;
- P1OUT&=~BIT0;
- _delay_cycles(20);
- //p1.2外部中断设置
- P1DIR&=~BIT2;//输入,上升沿触发,开中断
- P1REN|=BIT2;
- P1OUT&=~BIT2;
- P1IES&=~BIT2;
- P1IE|=BIT2;
- P1IFG&=~BIT2;
- _delay_cycles(20);
- //p2.0 p2.1 p2.4捕获设置
- P2DIR&=~BIT0+BIT1+BIT4;//设置P2.0,2.1,2.4为输入
- P2REN|=BIT0+BIT1+BIT4;
- P2OUT|=BIT0+BIT1+BIT4;
- P2SEL|=BIT0+BIT1+BIT4;
- _delay_cycles(20);
- }
- void TIMER0_init()
- {
- TA0CTL |= TASSEL_2+MC_0+TACLR;
- TA0CCTL1|=CCIS_0+SCS+CAP+CM_0;
- }
- void TIMER1_init()
- {
- TA1CTL |= TASSEL_2+MC_0+TACLR;
- TA1CCTL0|=CCIS_0+SCS+CAP+CM_0;
- TA1CCTL1|=CCIS_0+SCS+CAP+CM_0;
- TA1CCTL2|=CCIS_0+SCS+CAP+CM_0;
- }
- void Calculation()
- {
- long a,b,c,d;
- double DA,DB,DC,DD;
- double x1,x2,y1,y2;
- DA=Sound*cap1_2*Machine_cycle*100.0;
- DB=Sound*cap2_0*Machine_cycle*100.0;
- DC=Sound*cap2_1*Machine_cycle*100.0;
- DD=Sound*cap2_4*Machine_cycle*100.0;
- x1=(DD*DD-DC*DC+250000*1.0)/(1000*1.0);
- x2=(DA*DA-DB*DB+250000*1.0)/(1000*1.0);
- y1=(DB*DB-DC*DC+122500*1.0)/(700*1.0);
- y2=(DA*DA-DD*DD+122500*1.0)/(700*1.0);
- if(flag<20)
- {
- X[flag]=(x1+x2)*1.0/2.0;
- Y[flag]=(y1+y2)*1.0/2.0;
- flag++;
- }
- else
- {
- for(flag=0;flag<20;flag++)
- {
- x=x+X[flag];
- y=y+Y[flag];
- }
- x=x*1.0/20.0;
- y=y*1.0/20.0;
- LCD_list_Decimal(2,4,x);
- LCD_list_Decimal(3,4,y);
- flag=0;
- }
- // a=cap1_2-cap1_2;
- // b=cap2_0-cap1_2;
- // c=cap2_1-cap1_2;
- // d=cap2_4-cap1_2;
- // LCD_list_num(1,1,a);
- // LCD_list_num(2,1,b);
- // LCD_list_num(3,1,c);
- // LCD_list_num(4,1,d);
- LCD_list_num(1,1,cap1_2);
- LCD_list_num(2,1,cap2_0);
- LCD_list_num(3,1,cap2_1);
- LCD_list_num(4,1,cap2_4);
- }
- /*---------键盘函数---------*/
- unsigned char getkey(void) //获得键盘的值
- {
- P1REN |= BIT3 + BIT4 + BIT5;
- P1DIR &= ~(BIT3 + BIT4 + BIT5);
- P1OUT |= BIT3 + BIT4 + BIT5; //00111000
- t = (P1IN & 0x38)/8;
- if (t == 0x07) {
- P1REN |= BIT4 + BIT5;
- P1REN &= ~BIT3;
- P1DIR |= BIT3 + BIT4 + BIT5;
- P1OUT |= BIT4 + BIT5; //00110000
- P1OUT &= ~BIT3;
- P1DIR &= ~(BIT4 + BIT5);
- t = P1IN & 0x038;
- t = (t/8) / 2 + 7;
- if (t == 0x0a) {
- P1REN |= BIT5 + BIT3;
- P1REN &= ~BIT4;
- P1DIR |= BIT3 + BIT4 + BIT5;
- P1OUT |= BIT3+BIT5; //00101000
- P1OUT &= ~BIT4;
- P1DIR &= ~(BIT3 + BIT5);
- t = P1IN & 0x38;
- t = ((t/8) + 1) / 2 + 10;
- if (t == 0x0d) {
- P1REN |= BIT3 + BIT4;
- P1REN &= ~BIT5;
- P1DIR |= BIT3 + BIT4 + BIT5;
- P1OUT |= BIT3+BIT4; //00011000
- P1OUT &= ~BIT5;
- P1DIR &= ~(BIT3 + BIT4);
- t = P1IN & 0x38;
- t =(t/8)+13;
- }
- }
- }
- return (t);
- }
- void show_key()//显示键盘的值
- {
- key_t=getkey();
- if(key_t!=16)
- {
- _delay_cycles(20000);
- key=getkey();
- if(key==key_t)
- {
- while(1)
- {
- key_t=getkey();
- if(key_t==16)
- break;
- }
- }
- else
- {
- key=16;
- }
- if(key==15)
- LCD_clear();
- else
- LCD_write_char(1, 2,0,num[key]);
- _delay_cycles(200000);
- }
- }
- /*------LCD12864基本函数-------*/
- void check_busy()
- {
- do
- {
- LCD_send_byte(READCOMM);
- }
- while(LCD_read_byte()&0x80);
- }
- void LCD_send_byte(unsigned char a) {
- unsigned char i=0;
- for (i = 8; i > 0; i--) {
- if (a & (0x01 << (i - 1)))
- RW_SID_1;
- else
- RW_SID_0;
- _delay_cycles(100);
- E_CLK_1;
- _delay_cycles(100);
- E_CLK_0;
- _delay_cycles(100);
- }
- }
- unsigned char LCD_read_byte()
- {
- unsigned char i,j,temp1=0;
- _delay_cycles(100);
- P1DIR&=~BIT6;
- RW_SID_1;
- for(j=0;j<2;j++)
- {
- for(i=0;i<4;i++)
- {
- if(P1IN&BIT6) temp1|=0x01;
- else temp1&=~0x01;
- temp1<<=1;
- E_CLK_0;
- _delay_cycles(100);
- E_CLK_1;
- _delay_cycles(100);
- E_CLK_0;
- _delay_cycles(100);
- }
- for(i=0;i<4;i++)
- {
- E_CLK_0;
- _delay_cycles(100);
- E_CLK_1;
- _delay_cycles(100);
- E_CLK_0;
- _delay_cycles(100);
- }
- }
- P1DIR|=BIT6;
- return temp1;
- }
- unsigned char LCD_read_data()
- {
- unsigned char temp;
- LCD_send_byte(READDATA);
- _delay_cycles(1000);
- temp=LCD_read_byte();
- return temp;
- }
- void LCD_write_com(unsigned char comm) {
- unsigned char temp;
- check_busy();
- _delay_cycles(100);
- LCD_send_byte(SENDCOMM); //MCU to LCD, command
- temp = comm & 0XF0;
- LCD_send_byte(temp); //send high 4 bits
- temp = ((comm & 0X0F) << 4) & 0XF0;
- LCD_send_byte(temp); //send low 4 bits
- _delay_cycles(100);
- }
- void LCD_write_data(unsigned char lcd_data) //写数据
- {
- unsigned char temp;
- check_busy();
- _delay_cycles(100);
- LCD_send_byte(SENDDATA);
- temp = lcd_data & 0xf0;
- LCD_send_byte(temp);
- temp = (lcd_data & 0X0F) << 4;
- LCD_send_byte(temp);
- _delay_cycles(100);
- }
- void LCD_set_addr(unsigned char x, unsigned char y) //设置显示位置
- {
- if(y%2==0) odd=0;
- else odd=1;
- y=(y+1)/2;
- switch (x) {
- case 1:
- LCD_write_com(0X7F + y);
- break;
- case 2:
- LCD_write_com(0X8F + y);
- break;
- case 3:
- LCD_write_com(0X87 + y);
- break;
- case 4:
- LCD_write_com(0X97 + y);
- break;
- default:
- break;
- }
- }
- void LCD_write_char(unsigned char x, unsigned char y,unsigned char flag, char data)
- {
- LCD_set_addr(x, y);
- if(odd==0)
- {
- if(flag==1)
- {
- LCD_read_data();
- LCD_set_addr(x,y);
- LCD_write_data(data);
- }
- }
- LCD_write_data(data);
- }
- void LCD_write_string(unsigned char addr_x, unsigned char addr_y, char* str) {
- unsigned char LCD_temp;
- LCD_set_addr(addr_x, addr_y);
- if(odd==0)
- {
- LCD_read_data();
- LCD_set_addr(addr_x,addr_y);
- LCD_write_data(*str++);
- }
- LCD_temp = *str;
- while (LCD_temp != 0x00) {
- LCD_write_data(LCD_temp);
- LCD_temp = *(++str);
- }
- }
- void LCD_list_num(unsigned char x,unsigned char y,long number)
- {
- unsigned char pos;
- switch (x)
- {
- case 1:
- x=0x7F;
- break;
- case 2:
- x=0x8F;
- break;
- case 3:
- x=0x87;
- break;
- case 4:
- x=0x97;
- break;
- }
- pos=x+y;
- LCD_write_com(pos);
- if(number<=-100000&&number>-1000000)
- {
- LCD_write_data(0x30+(-number)/100000);
- LCD_write_data(0x30+((-number)/10000)%10);
- LCD_write_data(0x30+((-number)/1000)%10);
- LCD_write_data(0x30+((-number)/100)%10);
- LCD_write_data(0x30+((-number)/10)%10);
- LCD_write_data(0x30+(-number)%10);
- }
- if(number<=-10000&&number>-100000)
- {
- LCD_write_data(0x30+(-number)/10000);
- LCD_write_data(0x30+((-number)/1000)%10);
- LCD_write_data(0x30+((-number)%1000)/100);
- LCD_write_data(0x30+((-number)%100)/10);
- LCD_write_data(0x30+(-number)%10);
- }
- if(number<=-1000&&number>-10000)
- {
- LCD_write_data('-');
- LCD_write_data(0x30+(-number)/1000);
- LCD_write_data(0x30+((-number)/100)%10);
- LCD_write_data(0x30+((-number)%100)/10);
- LCD_write_data(0x30+(-number)%10);
- }
- if(number<=-100&&number>-1000)
- {
- LCD_write_data('-');
- LCD_write_data(0x30+(-number)/100);
- LCD_write_data(0x30+((-number)/10)%10);
- LCD_write_data(0x30+(-number)%10);
- }
- if(number<=-10&&number>-100)
- {
- LCD_write_data('-');
- LCD_write_data(0x30+(-number)/10);
- LCD_write_data(0x30+(-number)%10);
- }
- if(number<0&&number>-10)
- {
- LCD_write_data('-');
- LCD_write_data(0x30+(-number)%10);
- }
- if(number>=0&&number<10)
- {
- LCD_write_data(0x30+number%10);
- }
- if(number>=10&&number<100)
- {
- LCD_write_data(0x30+number/10);
- LCD_write_data(0x30+number%10);
- }
- if(number>=100&&number<1000)
- {
- LCD_write_data(0x30+number/100);
- LCD_write_data(0x30+(number/10)%10);
- LCD_write_data(0x30+number%10);
- }
- if(number>=1000&&number<10000)
- {
- LCD_write_data(0x30+number/1000);
- LCD_write_data(0x30+(number/100)%10);
- LCD_write_data(0x30+(number%100)/10);
- LCD_write_data(0x30+number%10);
- }
- if(number>=10000&&number<100000)
- {
- LCD_write_data(0x30+number/10000);
- LCD_write_data(0x30+(number/1000)%10);
- LCD_write_data(0x30+(number%1000)/100);
- LCD_write_data(0x30+(number%100)/10);
- LCD_write_data(0x30+number%10);
- }
- if(number>=100000&&number<1000000)
- {
- LCD_write_data(0x30+number/100000);
- LCD_write_data(0x30+(number/10000)%10);
- LCD_write_data(0x30+(number/1000)%10);
- LCD_write_data(0x30+(number/100)%10);
- LCD_write_data(0x30+(number/10)%10);
- LCD_write_data(0x30+number%10);
- }
- if(number>=1000000&&number<10000000)
- {
- LCD_write_data(0x30+number/1000000);
- LCD_write_data(0x30+(number/100000)%10);
- LCD_write_data(0x30+(number/10000)%10);
- LCD_write_data(0x30+(number/1000)%10);
- LCD_write_data(0x30+(number/100)%10);
- LCD_write_data(0x30+(number/10)%10);
- LCD_write_data(0x30+number%10);
- }
- }
- void LCD_list_Decimal(unsigned char x,unsigned char y,double Decimal)
- {
- unsigned char pos;
- double Deci;
- unsigned long num;
- num=(unsigned long)Decimal;
- Deci=Decimal-num;
- switch (x)
- {
- case 1:
- x=0x7F;
- break;
- case 2:
- x=0x8F;
- break;
- case 3:
- x=0x87;
- break;
- case 4:
- x=0x97;
- break;
- }
- pos=x+y;
- LCD_write_com(pos);
- if(Decimal>=0 && Decimal<1)
- {
- LCD_write_data(0x30+0);
- LCD_write_data('.');
- LCD_write_data(0x30+(int)(Deci*10)%10);
- LCD_write_data(0x30+(int)(Deci*100)%10);
- LCD_write_data(0x30+(int)(Deci*1000)%10);
- LCD_write_data(0x30+(int)(Deci*10000)%10);
- LCD_write_data(0x30+(int)(Deci*100000)%10);
- }
- if(Decimal>=1 && Decimal<10)
- {
- LCD_write_data(0x30+num%10);
- LCD_write_data('.');
- LCD_write_data(0x30+(int)(Deci*10)%10);
- LCD_write_data(0x30+(int)(Deci*100)%10);
- LCD_write_data(0x30+(int)(Deci*1000)%10);
- LCD_write_data(0x30+(int)(Deci*10000)%10);
- LCD_write_data(0x30+(int)(Deci*100000)%10);
- }
- if(Decimal>=10 && Decimal<100)
- {
- LCD_write_data(0x30+num/10);
- LCD_write_data(0x30+num%10);
- LCD_write_data('.');
- LCD_write_data(0x30+(int)(Deci*10)%10);
- LCD_write_data(0x30+(int)(Deci*100)%10);
- LCD_write_data(0x30+(int)(Deci*1000)%10);
- LCD_write_data(0x30+(int)(Deci*10000)%10);
- LCD_write_data(0x30+(int)(Deci*100000)%10);
- }
- if(Decimal>=100 && Decimal<1000)
- {
- LCD_write_data(0x30+num/100);
- LCD_write_data(0x30+num/10%10);
- LCD_write_data(0x30+num%10);
- LCD_write_data('.');
- LCD_write_data(0x30+(int)(Deci*10)%10);
- LCD_write_data(0x30+(int)(Deci*100)%10);
- LCD_write_data(0x30+(int)(Deci*1000)%10);
- LCD_write_data(0x30+(int)(Deci*10000)%10);
- LCD_write_data(0x30+(int)(Deci*100000)%10);
- }
- if(Decimal>=1000 && Decimal<10000)
- {
- LCD_write_data(0x30+num/1000);
- LCD_write_data(0x30+num/100%10);
- LCD_write_data(0x30+num/10%10);
- LCD_write_data(0x30+num%10);
- LCD_write_data('.');
- LCD_write_data(0x30+(int)(Deci*10)%10);
- LCD_write_data(0x30+(int)(Deci*100)%10);
- LCD_write_data(0x30+(int)(Deci*1000)%10);
- LCD_write_data(0x30+(int)(Deci*10000)%10);
- LCD_write_data(0x30+(int)(Deci*100000)%10);
- }
- }
- void LCD_init(void) {
- P1DIR |= BIT6 + BIT7;
- _delay_cycles(2000);
- LCD_write_com(0x30); //一次送8位数据
- LCD_write_com(0x0C); //整体显示,游标off,游标位置off
- LCD_write_com(0x01); //清DDRAM
- LCD_write_com(0x02); //DDRAM地址归位
- LCD_write_com(0x80); //设定DDRAM 7位地址000,0000到地址计数器AC
- }
- void LCD_clear(void){
- LCD_write_com(0x01);
- }
- /*-----LCD12864绘图函数-------*/
- void GUI_clear() //绘图清屏函数 (清屏指令在画图时不能使用)
- {
- unsigned char i,j,k;
- LCD_write_com(EXTEND_SET);//扩展指令集,8位数据传输,绘图开
- LCD_write_com(DRAW_OFF); //关闭绘图显示
- for(i=0;i<2;i++) //分上下两屏写
- {
- for(j=0;j<32;j++)
- {
- LCD_write_com(0x80+j); //写y坐标
- _delay_cycles(10);
- if(i==0)//写x坐标
- {
- LCD_write_com(0x80);
- _delay_cycles(100);
- }
- else
- {
- LCD_write_com(0x88);
- _delay_cycles(100);
- }
- for(k=0;k<16;k++) //写一整行数据
- {
- LCD_write_data(0x00); //写高字节
- LCD_write_data(0x00); //写低字节
- _delay_cycles(100);
- }
- }
- }
- LCD_write_com(DRAW_ON); //打开绘图显示
- LCD_write_com(BASIC_SET);//打开基本指令集
- }
- void GUI_draw_full_picture(const unsigned char *dat)//画满屏图片,横向取模
- {
- unsigned char i,j,k;
- unsigned char GDRAMAddrX=0x80;
- unsigned char GDRAMAddrY=0x80;
- for(i=0;i<2;i++)
- {
- for(j=0;j<32;j++)
- {
- for(k=0;k<8;k++)
- {
- LCD_write_com(DRAW_OFF);
- LCD_write_com(GDRAMAddrY+j);
- LCD_write_com(GDRAMAddrX+k);
- LCD_write_data(*dat++);
- LCD_write_data(*dat++);
- }
- }
- GDRAMAddrX=0x88;
- }
- LCD_write_com(DRAW_ON);
- LCD_write_com(BASIC_SET);
- }
- /*
- void LCD_set_dot(unsigned char x,unsigned char y)//打点程序
- {
- unsigned char x_byte,x_bit; //确定在坐标的那一字节哪一位
- unsigned char y_byte,y_bit; //确定在坐标的哪一屏哪一行
- unsigned char temph,templ; //定义两个临时变量,用于存放读出来的数据
- LCD_write_com(EXTEND_SET); //扩展指令集
- LCD_write_com(DRAW_OFF);//绘图显示关闭
- x_byte=x/16;
- x_bit=x%16;
- y_byte=y/32;
- y_bit=y%32;
- LCD_write_com(EXTEND_SET);
- LCD_write_com(0x80+y_bit);
- LCD_write_com(0x80+x_byte+8*y_byte);
- LCD_read_byte();
- temph=LCD_read_byte();
- templ=LCD_read_byte();
- _delay_cycles(10);
- LCD_write_com(0x80+y_bit);
- LCD_write_com(0x80+x_byte+8*y_byte);
- _delay_cycles(10);
- if(x_bit<8)
- {
- LCD_write_data(temph|(0x01<<(7-x_bit)));
- LCD_write_data(templ);
- }
- else
- {
- LCD_write_data(temph);
- LCD_write_data(templ|(0x01<<(15-x_bit)));
- }
- LCD_write_com(DRAW_ON);
- LCD_write_com(BASIC_SET);
- }
- */
| Sound_positioning_system1_0.rar
0
|
|
|
|