اطلاعیه

Collapse
No announcement yet.

تست ماوس و کیبورد کامپیوتر با AVR

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    تست ماوس و کیبورد کامپیوتر با AVR

    سلام دوستان
    یک برنامه برای تست ماوس کامپیوتر می خواستم.
    ممنون
    اینم یک برنامه برای تست کیبورد هست:
    تست کردم خیلی خوب بود.
    کد:
    $regfile = "m8def.dat"
    $crystal = 8000000
    Config Lcd = 16 * 2
    Config Lcdpin = Pin , Db4 = Pind.4 , Db5 = Pind.5 , Db6 = Pind.6 , _
     Db7 = Pind.7 , E = Pind.2 , Rs = Pind.0
    Dim A As Byte
    Config Keyboard = Pinc.1 , Data = Pinc.0 , Keydata = Keydata
    Cls
    Lcd " KEYBOARD TEST "
    Wait 1
    Cls
    Waitms 500
    Cls
    Main:
    A = Getatkbd()
    Select Case A:
    Case 50:
    Lowerline
    Case 56:
    Home
    Case 44:
    Cls
    Home
    Case 52:
    Shiftcursor Left
    Case 54:
    Shiftcursor Right
    Case 13:
    Lowerline
    Case 9:
    Shiftcursor Right , 4
    Case 8:
    Shiftcursor Left
    Lcd " " ;
    Shiftcursor Left
    Case Else Lcd String(1 , A)
    End Select
    Goto Main
    End                             'end program
    
    
    Keydata:
    
    'normal keys lower case
    
    Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 27 , 0 , 0 , 0 , 0 , 9 , 9 , &H5E , 0
    
    Data 0 , 0 , 0 , 0 , 0 , 113 , 49 , 0 , 0 , 0 , 122 , 115 , 97 , 119 , 50 , 0
    
    Data 0 , 99 , 120 , 100 , 101 , 52 , 51 , 0 , 0 , 32 , 118 , 102 , 116 , 114 , 53 , 0
    
    Data 0 , 110 , 98 , 104 , 103 , 121 , 54 , 7 , 8 , 44 , 109 , 106 , 117 , 55 , 56 , 0
    
    Data 0 , 44 , 107 , 105 , 111 , 48 , 57 , 0 , 0 , 46 , 45 , 108 , 48 , 112 , 43 , 0
    
    Data 0 , 0 , 0 , 0 , 0 , 92 , 0 , 0 , 0 , 0 , 13 , 0 , 0 , 92 , 0 , 0
    
    Data 0 , 60 , 0 , 0 , 0 , 0 , 8 , 0 , 0 , 49 , 0 , 52 , 55 , 0 , 0 , 0
    
    Data 48 , 44 , 50 , 53 , 54 , 56 , 0 , 0 , 0 , 43 , 51 , 45 , 42 , 57 , 0 , 0
    
    
    
    'shifted keys UPPER case
    
    Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
    
    Data 0 , 0 , 0 , 0 , 0 , 81 , 33 , 0 , 0 , 0 , 90 , 83 , 65 , 87 , 34 , 0
    
    Data 0 , 67 , 88 , 68 , 69 , 0 , 35 , 0 , 0 , 32 , 86 , 70 , 84 , 82 , 37 , 0
    
    Data 0 , 78 , 66 , 72 , 71 , 89 , 38 , 0 , 0 , 76 , 77 , 74 , 85 , 47 , 40 , 0
    
    Data 0 , 59 , 75 , 73 , 79 , 61 , 41 , 0 , 0 , 58 , 95 , 76 , 48 , 80 , 63 , 0
    
    Data 0 , 0 , 0 , 0 , 0 , 96 , 0 , 0 , 0 , 0 , 13 , 94 , 0 , 42 , 0 , 0
    
    Data 0 , 62 , 0 , 0 , 0 , 8 , 0 , 0 , 49 , 0 , 52 , 55 , 0 , 0 , 0 , 0
    
    Data 48 , 44 , 50 , 53 , 54 , 56 , 0 , 0 , 0 , 43 , 51 , 45 , 42 , 57 , 0 , 0

    sigpic

    #2
    پاسخ : تست ماوس و کیبورد کامپیوتر با AVR

    سلام
    این فایلها رو از روی کتاب
    "مدارهای اصولی و پایه میکروکنترلر براساس میکروکنترلرهای AVR و 8051"
    نویسندگان : رضا فانی ، امین متین مقدم
    عکس گرفتم ...
    پیش خودم گفتم شاید به درد کسی بخوره ...
    امیدوارم راضی باشند ... :redface:
    =====================================
    فصل 15 :
    اتصال کیبرد PS/2
    http://s5.picofile.com/file/8121181700/DSC00002.gif
    http://s5.picofile.com/file/8121181718/DSC00004.gif
    http://s5.picofile.com/file/8121181742/DSC00005.gif
    http://s5.picofile.com/file/8121181768/DSC00006.gif
    http://s5.picofile.com/file/8121184984/DSC00007.gif
    http://s5.picofile.com/file/8121181800/DSC00008.gif
    http://s5.picofile.com/file/8121181834/DSC00009.gif
    کد:
    #include <mega16.h> 
    #include <delay.h> 
    unsigned char keyb_r (void);
    void keyb_w (unsigned char);
    void keyb_on (void);
    unsigned char b;
    
    void main(void)  { 
    PORTA = 0x00;
    DDRA = 0x00;
    PORTB = 0x00;
    DDRB = 0x00;
    DDRC = 0x00;
    PORTC = 0x00;
    PORTD = 0x00;
    DDRD = 0xff;
    // External Interrupt(s) initialization
    // INT0: Off
    // INT1: Off
    // INT2: Off
    MCUCR = 0x00;
    MCUCSR = 0x00;
    keyb_on();
    while (1)  {
          		PORTD = keyb_r();
      	}; 
    }
    unsigned char keyb_r (void)  {   
    unsigned char c, a, i = 0;
        	DDRB = 0x00;
          	while (PINB.0 == 0 | PINB.1 == 0); 
        	while (PINB.0 == 1 & PINB.1 == 1); 
        	while (PINB.0 == 0); 
        	while (PINB.0 == 1);
    for (i=0; i<8; i++)  { 
        		c = PINB;
        		c = c << 6;
        		c = c & 0x80;
        		a = a >> 1;
        		a = a ^ c;
        		while (PINB.0 == 0); 
        		while (PINB.0 == 1);
        	};        
        	while (PINB.0 == 0 & PINB.1 == 0); 
        	return a;
    }
    void keyb_w (unsigned char x)  {   
    unsigned char i, c, p = 0;
    PORTB = 0x03;
    DDRB = 0x03;
    while (PINB.0 == 0 |& PINB.1 == 0);
    PORTB.0 = 0;
    delay_us(100);
    PORTB.1 = 0;
    PORTB.0 = 1;
    DDRB = 0x02;
    while (PINB.0 == 1); 
    for (i=0; i<8; i++)  {
        		c = x;
        		c = c & 0x01;
        		x = x >> 1;
        		PORTB.1 = c;
        		if (c == 1)  p += 1;
        		while (PINB.0 == 0); 
        		while (PINB.0 == 1);
        	}; 
        	p = p % 2;
        	if (p == 0)  PORTB.1 = 1; 
    else  PORTB.1 = 0;
        	while (PINB.0 == 0); 
        	while (PINB.0 == 1);
        	PORTB.1 = 1; 
        	DDRB = 0x00;
        	while (PINB.0 == 1 & PINB.1 == 1);
        	while (PINB.0 == 0 & PINB.1 == 0); 
    }
    void keyb_on ()  {   
        	unsigned char y;
        	keyb_w(0xFF);
        	y = keyb_r();
        	y = keyb_r();
        	keyb_w(0xED); 
        	y = keyb_r();
        	b = 0x02;      
        	keyb_w(b); 
        	y = keyb_r();
    }
    ------------------------------------------------------------------------
    فصل 16 :
    اتصال موس PS/2
    http://s5.picofile.com/file/8121181850/DSC00011.gif
    http://s5.picofile.com/file/8121181868/DSC00013.gif
    http://s5.picofile.com/file/8121181892/DSC00014.gif
    http://s5.picofile.com/file/8121181992/DSC00015.gif
    http://s5.picofile.com/file/8121181968/DSC00016.gif
    کد:
    #include <mega16.h> 
    #include <delay.h> 
    unsigned char mouse_r (void);
    void mouse_w (unsigned char);
    void mouse_on (void);
    void main(void)  { 
    unsigned char y, x, s, ch;
    PORTA = 0x00;
    DDRA = 0xFF;
    PORTB = 0x00;
    DDRB = 0x00;
    PORTC = 0x00;
    DDRC = 0x00;
    PORTD = 0x00;
    DDRD = 0x00;
    mouse_on( );
    while (1)  {
       		s = mouse_r( ) ;
       		x = mouse_r( ) ;
       		y = mouse_r( ) ;
       		PORTA = 0x00;
       		ch = s;
       		ch &= 0xC0;
       		if (ch == 0)  {
       			ch = s;
       			ch &= 0x10;
            		if (ch!=0)  {
            			x = 255 - x; 
    if (x != 0)  PORTA.0 = 1;
    else  PORTA.0 = 0;
            		}
            		else
    if ( x!= 0)  PORTA.1 = 1; 
    else  PORTA.1 = 0;
             
       			ch = s;
       			ch &= 0x20; 
            		if (ch != 0)  {
            			y = 255 - y; 
            			if (y != 0)  PORTA.2 = 1; 
    else  PORTA.2 = 0;
            		}
            		else 
            			if (y != 0)  PORTA.3 = 1; 
    else  PORTA.3 = 0; 
        			//key check   
        			ch = s;
        			ch &= 0x02; 
            		if (ch != 0)  PORTA.4 = 1;
       			ch = s;
       			ch &= 0x01; 
            		if (ch != 0)  PORTA.6 = 1;
       			ch = s;
       			ch &= 0x04; 
            		if (ch != 0)  PORTA.5 = 1;
       		};
       	}; 
    }
    unsigned char mouse_r (void)  {   
    unsigned char c, a, i = 0;
    DDRB = 0x00;
    while (PINB.0 == 0 & PINB.1 == 0); 
    while (PINB.0 == 1 & PINB.1 == 1); 
    while (PINB.0 == 0); 
    while (PINB.0 == 1);
    for (i=0; i<8; i++)  { 
        		c = PINB;
        		c = c << 6;
        		c = c & 0x80;
        		a = a >> 1;
        		a = a ^ c;
        		while (PINB.0 == 0); 
        		while (PINB.0 == 1);
        	};        
        	while (PINB.0 == 0 & PINB.1 == 0); 
        	return a ;   
    } 
    void mouse_w (unsigned char x)  {   
    unsigned char i, c, p = 0;
    PORTB = 0x03;
    DDRB = 0x03;
    while (PINB.0 == 0 & PINB.1 == 0);
    PORTB.0 = 0;
    delay_us(100);
    PORTB.1 = 0;
    PORTB.0 = 1;
    DDRB = 0x02;
    while (PINB.0 == 1); 
    for (i=0; i<8; i++)  {
    c = x;
    c = c & 0x01;
        		x = x >> 1;
        		PORTB.1 = c;
        		if (c == 1)  p += 1;
        		while (PINB.0 == 0); 
        		while (PINB.0 == 1);
        	}; 
        	p = p%2;
        	if (p == 0)  PORTB.1 = 1; 
    else  PORTB.1 = 0;
        	while (PINB.0 == 0); 
        	while (PINB.0 == 1);
        	PORTB.1 = 1; 
        	DDRB = 0x00;
        	while (PINB.0 == 1 & PINB.1 == 1);
        	while (PINB.0 == 0 & PINB.1 == 0); 
    }
    void mouse_on ( )  {   
    unsigned char y;
    mouse_w(0xFF);
    y = mouse_r( );
    y = mouse_r( );
    mouse_w(0xEA); 
    y = mouse_r( );
        	mouse_w(0xE8); 
        	y = mouse_r( );
        	mouse_w(0x01); 
        	y = mouse_r( );
        	mouse_w(0xF3); 
        	y = mouse_r( ); 
        	mouse_w(0x0A); 
        	y = mouse_r( );
        	mouse_w(0xF4); 
        	y = mouse_r( ); 
    }
    -----------------------------------------------------------------------
    فصل 22 :
    اتصال کیبرد PS/2 به صورت کامل با LCD
    http://s5.picofile.com/file/8121181942/DSC00018.gif
    http://s5.picofile.com/file/8121181926/DSC00019.gif
    http://s5.picofile.com/file/8121181918/DSC00020.gif
    http://s5.picofile.com/file/8121182084/DSC00021.gif
    http://s5.picofile.com/file/8121182076/DSC00022.gif
    کد:
    #include <mega16.h> 
    #include <delay.h> 
    #include <lcd.h>
    // External Interrupt 0 service routine
    interrupt [EXT_INT0] void ext_int0_isr(void)
    {
      DDRB = 0x01; 
      while(PIND.2 == 0)PORTB.0 = 0;  
      DDRB = 0x00;
    }
    #asm
     .equ __lcd_port=0x1B ;PORTA
    #endasm
    unsigned char keyb_r (void);
    void keyb_w (unsigned char);
    void keyb_on (void);
    unsigned char b;
    
    void main(void)  
    { 
      unsigned char s,ch;
      unsigned char lo[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, '~',
                0, 0, 0, 0, 0, 0, 'q', '1', 0, 0, 0, 'z', 's', 'a', 'w', '2',
                0, 0, 'c', 'x', 'd', 'e', '4', '3', 0, 0, ' ', 'v', 'f', 't', 'r',
                '5', 0, 0, 'n', 'b', 'h', 'g', 'y', '6', 0, 0, 0, 'm', 'j', 'u', '7',
                '8', 0, 0, ',', 'k', 'i', 'o', '0', '9', 0, 0, '.', '/', 'l', ';', 'p',
                '-', 0, 0, 0, '"', 0, '[', '=', 0, 0, 0, 0, 0, ']', 0, 0,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '1', 0, '4', '7', 0, 0, 0, '0',
                '.', '2', '5', '6', '8', 0, 0, 0, '+', '3', '-', '*', '9', 0};
      unsigned char up[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, '`',
                0, 0, 0, 0, 0, 0, 'Q', '!', 0, 0, 0, 'Z', 'S', 'A', 'W', '@',
                0, 0, 'C', 'X', 'D', 'E', '$', '#', 0, 0, ' ' ,'V' ,'F' ,'T' ,'R',
                '%',0, 0, 'N','B','H','G','Y','^',0, 0, 0, 'M','J','U', '&',
                '*', 0, 0, '<', 'K','I', 'O', ')', '(', 0, 0, '>', '?', 'L', ':','P',
                '_', 0, 0, 0, '"', 0, '{', '+', 0, 0, 0, 0, 0, '}', 0, '|',
                0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, '1', 0, '4', '7', 0, 0, 0, '0',
                '.', '2', '5', '6', '8', 0, 0, 0, '+', '3', '-', '*', '9', 0}; 
      PORTA = 0x00;
      DDRA = 0x00;
      PORTB = 0x00;
      DDRB = 0x00;
      DDRC = 0x00;
      PORTC = 0x00;
      PORTD = 0x00;
      DDRD = 0x00;
      // External Interrupt(s) initialization
      // INT0: On
      // INT0 Mode: Low level
      // INT1: Off
      // INT2: Off
      GICR |= 0x40;
      MCUCR = 0x00;
      MCUCSR = 0x00;
      GIFR = 0x40;
      // LCD module initialization 
      lcd_init(16);
      // Global enable interrupts
      #asm("sei")
      keyb_on();
      lcd_clear();
      ch = b;
      while (1)  
      {
        //input data      
        s = keyb_r();
        switch (s)  
        {
          case 0xF0:
            s = keyb_r();
            if (s == 0x12 | s == 0x59)  ch = b;
            break; 
          case 0x58:
            keyb_w(0xED); 
            s = keyb_r();
            b = b ^ 0x04;
            ch = b;
            keyb_w(b); 
            s = keyb_r();
            break; 
          case 0x77:
            keyb_w(0xED); 
            s = keyb_r();
            b = b ^ 0x02;
            keyb_w(b); 
            s = keyb_r();
            break; 
          case 0x7E:
            keyb_w(0xED); 
            s = keyb_r();
            b = b ^ 0x01;
            keyb_w(b); 
            s = keyb_r();
            break;
          case 0x76:
            keyb_on();
            lcd_clear();
            break; 
          case 0x12:
            ch = 0x04;
            break; 
          case 0x59:
            ch = 0x04;
            break; 
            default:
            if (ch <= 3)  s = lo[s];
            else  s = up[s];
            lcd_putchar(s);
        };
      }
    }
    unsigned char keyb_r (void)  
    {   
      unsigned char c, a, i = 0;
      DDRB = 0x00;
      while (PINB.0 == 0 | PINB.1 == 0); 
      while (PINB.0 == 1 & PINB.1 == 1); 
      while (PINB.0 == 0); 
      while (PINB.0 == 1);
      for (i=0; i<8; i++)
      { 
        c = PINB;
        c = c << 6;
        c = c & 0x80;
        a = a >> 1;
        a = a ^ c;
        while (PINB.0 == 0); 
        while (PINB.0 == 1);
      }        
      while (PINB.0 == 0 & PINB.1 == 0); 
      return a;
    }
    void keyb_w (unsigned char x)  
    {   
      unsigned char i, c, p = 0;
      PORTB = 0x03;
      DDRB = 0x03;
      while (PINB.0 == 0 |& PINB.1 == 0);
      PORTB.0 = 0;
      delay_us(100);
      PORTB.1 = 0;
      PORTB.0 = 1;
      DDRB = 0x02;
      while (PINB.0 == 1); 
      for (i=0; i<8; i++)  
      {
        c = x;
        c = c & 0x01;
        x = x >> 1;
        PORTB.1 = c;
        if (c == 1)  p += 1;
        while (PINB.0 == 0); 
        while (PINB.0 == 1);
      }; 
      p = p % 2;
      if (p == 0)  PORTB.1 = 1; 
      else  PORTB.1 = 0;
      while (PINB.0 == 0); 
      while (PINB.0 == 1);
      PORTB.1 = 1; 
      DDRB = 0x00;
      while (PINB.0 == 1 & PINB.1 == 1);
      while (PINB.0 == 0 & PINB.1 == 0); 
    }
    void keyb_on ()  
    {   
      unsigned char y;
      keyb_w(0xFF);
      y = keyb_r();
      y = keyb_r();
      keyb_w(0xED); 
      y = keyb_r();
      b = 0x02;      
      keyb_w(b); 
      y = keyb_r();
    }
    ------------------------------------------------------------------------
    فصل 23 :
    رسم تصاویر با موس PS/2 روی GLCD
    http://s5.picofile.com/file/8121182050/DSC00023.gif
    http://s5.picofile.com/file/8121182026/DSC00024.gif
    http://s5.picofile.com/file/8121182000/DSC00025.gif
    http://s5.picofile.com/file/8121182126/DSC00026.gif
    http://s5.picofile.com/file/8121182118/DSC00027.gif
    کد:
    #include <mega16.h> 
    #include <delay.h> 
    void command(unsigned char); 
    void display(unsigned char);
    void ready(void);
    unsigned char mouse_r (void);
    void mouse_w (unsigned char);
    void mouse_on (void);
    void show (unsigned char,unsigned char,unsigned char); 
    void mem_s (unsigned char,unsigned char);
    void mem_r (unsigned char,unsigned char);
    void lcd_clr (void);
    unsigned char mem[8, 64];
    void main(void)  { 
    unsigned char i, j, y, x, s, ch;
    PORTA = 0x00;
    DDRA = 0xFF;
    PORTB = 0x00;
    DDRB = 0x00;
    PORTC = 0x5F;
    DDRC = 0xFF;
    PORTD = 0x00;
    DDRD = 0xFF;
    // LCD module initialization 
    command(0x3F);
    command(0xB8);
    command(0x40); 
    command(0xC0);
    lcd_clr ( );
    mouse_on( );
    i = j = 0;
    while (1)  {
       		s = mouse_r( ) ;
       		x = mouse_r( ) ;
       		y = mouse_r( ) ;
       		show(j, i, 0x00);
       		ch = s;
       		ch &= 0xC0;
       		if (ch == 0)  {
       			ch = s;
       			ch &= 0x10;
            		if (ch != 0)  { 
            			x = 255 - x; 
            			if (i-x >= 0 & i-x <= 63)  i -= x; 
    else  i = 0;
    }
            		else 
            			if (i+x <= 63)  i += x; 
    else  i = 63;
       			ch = s;
       			ch &= 0x20; 
            		if (ch != 0)  {
    y = 255 - y; 
            			if (j+y <= 63)  j += y; 
    else  j = 63;
    }
            		else 
            			if (j-y >= 0 & j-y <= 63)  j -= y; 
    else  j = 0; 
      			//key check   
        			ch = s;
        			ch &= 0x02; 
            		if (ch != 0)  mem_r(j, i);
       			ch = s;
       			ch &= 0x01; 
            		if (ch != 0)  mem_s(j, i);
       			ch = s;
       			ch &= 0x04; 
            		if (ch != 0)  lcd_clr( );
    show(j, i, 0x01);
       		};
       	}; 
    }
    
    unsigned char mouse_r (void)  {   
        	unsigned char c, a, i = 0;
        	DDRB = 0x00;
        	while (PINB.0 == 0 & PINB.1 == 0); 
        	while (PINB.0 == 1 & PINB.1 == 1); 
        	while (PINB.0 == 0); 
        	while (PINB.0 == 1);
        	for (i=0; i<8; i++) {
    c = PINB;
        		c = c << 6;
        		c = c & 0x80;
        		a = a >> 1;
        		a = a ^ c;
       		while (PINB.0 == 0); 
        		while (PINB.0 == 1);
        	};        
        	while (PINB.0 == 0 & PINB.1 == 0); 
        	return a ;   
    } 
    void mouse_w (unsigned char x)  {   
    unsigned char i, c, p = 0;
        	PORTB = 0x03;
        	DDRB = 0x03;
        	while (PINB.0 == 0 & PINB.1 == 0);
        	PORTB.0 = 0;
        	delay_us(100);
        	PORTB.1 = 0;
        	PORTB.0 = 1;
        	DDRB = 0x02;
        	while (PINB.0 == 1); 
        	for (i=0; i<8; i++)  {
        		c = x;
        		c = c & 0x01;
        		x = x >> 1;
        		PORTB.1 = c;
        		if (c == 1)  p += 1;
        		while (PINB.0 == 0); 
        		while (PINB.0 == 1);
        	}; 
        	p = p % 2;
        	if (p == 0)  PORTB.1 = 1; 
    else  PORTB.1 = 0;
        	while (PINB.0 == 0); 
        	while (PINB.0 == 1);
        	PORTB.1 = 1; 
        	DDRB = 0x00;
        	while (PINB.0 == 1 & PINB.1 == 1);
        	while (PINB.0 == 0 & PINB.1 == 0); 
    }
    void mouse_on ( )  {   
        	unsigned char y;
        	mouse_w(0xFF);
        	y = mouse_r( );
        	y = mouse_r( );
        	mouse_w(0xEA); 
        	y = mouse_r( );
        	mouse_w(0xE8); 
        	y = mouse_r( );
        	mouse_w(0x01); 
        	y = mouse_r( );
        	mouse_w(0xF3); 
        	y = mouse_r( ); 
        	mouse_w(0x0A); 
        	y = mouse_r( );
        	mouse_w(0xF4); 
        	y = mouse_r( ); 
    }
    void command (unsigned char x)  {    
    ready( );
        	PORTA = x;
        	PORTC.0 = 0;
        	PORTC.1 = 0;
        	PORTC.2 = 1;
        	PORTC.2 = 0;
    }
    void display(unsigned char x)  {    
        	ready( );
        	PORTA = x;
        	PORTC.0 = 1;
        	PORTC.1 = 0;
        	PORTC.2 = 1;
        	PORTC.2 = 0;
    }
    void ready(void)  {
    DDRA = 0x7F;    
        	PORTC.0 = 0;
        	PORTC.1 = 1;
        	do  {
           	PORTC.2 = 1;
           	PORTC.2 = 0;
           }
        	while (PINA.7 == 1);
        	DDRA = 0xFF;
    }  
    void show (unsigned char i,unsigned char j,unsigned char sc)  {    
        	unsigned char x, y, t;
        	x = i % 8;
        	i /= 8;
          	command(0xB8 + i);
          command(0x40 + j);
    y = sc;
          y = y << x;
          t = y | mem[i, j];
          y = y ^ t;
          display(y);
    }
    void mem_s (unsigned char i, unsigned char j)  {    
        	unsigned char x, y, t;
        	x = i % 8;
        	i /= 8;
          y = 0x01;
          y = y << x;
          t = y | mem[i, j];
          mem[i, j] = y ^ t;
    }
    void mem_r (unsigned char i, unsigned char j)  {    
    unsigned char x, y;
        	x = i % 8;
        	i /= 8;
          DDRD = 0xFF;
          PORTD = 0xB8 + i;
          y = 0x01;
          y = y << x;
          y = y | mem[i, j];
          mem[i, j] = y ^ 0x00;
    }
    void lcd_clr (void)  {        
    unsigned char i, j;
    for (i=0; i<8; i++)
    for (j=0; j<64; j++)  {	
    mem[i, j] = 0xFF; 
             		command(0xB8 + i);
             		command(0x40 + j);
             		display(0xFF);
    };
    }
    -----------------------------------------------------------------------------------
    اگر بد بود به بزرگی خودتون ببخشید ...
    موفق باشید
    [b]چگونه همه پایه های میکروکنترلر AVR را PWM کنیم؟
    معرفی نرم افزارEasy 7segment (برای راه اندازی آسانتر 7segment )
    معرفی نرم افزار Codewizard PWM
    با من بیشتر آشنا شوید

    دیدگاه


      #3
      پاسخ : تست ماوس و کیبورد کامپیوتر با AVR

      خیلی خیلی ممنون از سامان اسدی عزیز
      تاپیک به نتیجه رسید :wow:

      sigpic

      دیدگاه


        #4
        پاسخ : تست ماوس و کیبورد کامپیوتر با AVR

        نوشته اصلی توسط ناصر منتظری
        خیلی خیلی ممنون از سامان اسدی عزیز
        تاپیک به نتیجه رسید :wow:
        قابلی نداشت ... :nice:
        [b]چگونه همه پایه های میکروکنترلر AVR را PWM کنیم؟
        معرفی نرم افزارEasy 7segment (برای راه اندازی آسانتر 7segment )
        معرفی نرم افزار Codewizard PWM
        با من بیشتر آشنا شوید

        دیدگاه

        لطفا صبر کنید...
        X