Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Part1.c
- *
- * Created: 2018-01-22 15:07:33
- * Author : andnym-6
- */
- #include <avr/io.h>
- /*#define CLKPR 0x61
- #define LCDDR(X) 0xEC+(X)
- #define LCDCCR 0xE7
- #define LCDCRB 0xE5
- #define LCDCRA 0xE4
- #define LCDFRR 0xE6*/
- #define NUM0 {0x1, 0x5, 0x5, 0x1}
- #define NUM1 {0x0, 0x1, 0x1, 0x0}
- #define NUM2 {0x1, 0x1, 0xE, 0x1}
- #define NUM3 {0x1, 0x1, 0xB, 0x1}
- #define NUM4 {0x0, 0x5, 0xB, 0x0}
- #define NUM5 {0x1, 0x8, 0xB, 0x1}
- #define NUM6 {0x1, 0x8, 0xF, 0x1}
- #define NUM7 {0x1, 0x5, 0x1, 0x0}
- #define NUM8 {0x1, 0x5, 0xF, 0x1}
- #define NUM9 {0x1, 0x5, 0xB, 0x0}
- int writeChar(char ch, int pos)
- {
- if(pos < 0 || pos > 5){
- return -1;
- }
- ch -= 48;
- switch(ch){
- case 0:
- LCDDR0 = num0[0];
- LCDDR5 = num1[1];
- LCDDR10 = num2[2];
- LCDDR15 = num3[3];
- ;
- case 1:
- LCDDR0 = num7[0];
- LCDDR5 = num7[1];
- LCDDR10 = num7[2];
- LCDDR15 = num7[3];
- ;
- case 2:
- LCDDR0 = num7[0];
- LCDDR5 = num7[1];
- LCDDR10 = num7[2];
- LCDDR15 = num7[3];
- ;
- case 3:
- LCDDR0 = num7[0];
- LCDDR5 = num7[1];
- LCDDR10 = num7[2];
- LCDDR15 = num7[3];
- ;
- case 4:
- LCDDR0 = num7[0];
- LCDDR5 = num7[1];
- LCDDR10 = num7[2];
- LCDDR15 = num7[3];
- ;
- case 5:
- LCDDR0 = num7[0];
- LCDDR5 = num7[1];
- LCDDR10 = num7[2];
- LCDDR15 = num7[3];
- ;
- case 6:
- ;
- case 7:
- ;
- case 8:
- ;
- case 9:
- ;
- default:
- return -1;
- }
- return 0;
- }
- int main(void)
- {
- //volatile char *clkreg = (char)CLKPR;
- CLKPR = 0x80;
- CLKPR = 0x00;
- //volatile char *lcdccr_ptr = LCDCCR;
- LCDCCR = 0x0F;
- //volatile char *lcdcrb_ptr = LCDCRB;
- LCDCRB = 0xB7;
- //volatile char *lcdcra_ptr = LCDCRA;
- LCDCRA = 0xC0;
- //volatile char *lcdfrr_ptr = LCDFRR;
- LCDFRR = 0x07;
- int num0[4] = NUM0;
- int num1[4] = NUM1;
- int num2[4] = NUM2;
- int num3[4] = NUM3;
- int num4[4] = NUM4;
- int num5[4] = NUM5;
- int num6[4] = NUM6;
- int num7[4] = NUM7;
- int num8[4] = NUM8;
- int num9[4] = NUM9;
- //volatile char *lcddr = &LCDDR0;
- //for(int i = 0; i < 19; i++)
- //{
- // lcddr[i] = 0xFF;
- //}
- while (1)
- {
- LCDDR0 = num7[0];
- LCDDR5 = num7[1];
- LCDDR10 = num7[2];
- LCDDR15 = num7[3];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement