/[H8]/trunk/PIC/Torbens/main.c
ViewVC logotype

Contents of /trunk/PIC/Torbens/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101 - (show annotations) (download)
Fri May 25 14:20:54 2007 UTC (17 years ago) by torben
File MIME type: text/plain
File size: 1696 byte(s)
Trying to implement this !"#€%&/()= LCD module
1
2 #include <pic18.h>
3 #include <stdio.h>
4
5 #include "delay.h"
6 #include "myi2c.h"
7 #include "barcode.h"
8 #include "globals.h"
9 #include "keyboard.h"
10
11
12
13 #define USE_EXTERNAL_LCD
14
15 #ifdef USE_EXTERNAL_LCD
16 #include "mylcd.h"
17 #else
18 #include "lcd.h"
19 #endif
20
21
22 /*
23 void i2c_init(void)
24 {
25 // I2C_MODULE hører hjemme i i2c.h
26 #ifdef I2C_MODULE
27 SSPMode(MASTER_MODE);
28 SSPEN = 1; //Synch. Serial Port Enable
29 CKP = 1; //SCL Release control bit
30
31 //note to self : husk altid at justere Baud-rate generatoren så at det passer sammen med krystal-frekvensen
32 SSPADD = 0x0A;
33 #else
34 SCL_DIR = I2C_OUTPUT;
35 SDA_DIR = I2C_OUTPUT;
36 SDA = 0;
37 SCL = 0;
38 #endif
39 }
40 */
41
42
43
44
45
46 void main(void)
47 {
48 char key, key2;
49 char buffer[5];
50 int i;
51 char x = 0;
52 char y = 'A';
53 TRISB0= 0;
54
55 InitI2C();
56 barcode_init();
57
58 #ifdef USE_EXTERNAL_LCD
59 mylcd_init();
60 #else
61 lcd_init(0);
62 #endif
63
64
65
66 while (1)
67 {/*
68 if (barcode_is_ready())
69 {
70 lcd_home();
71 for (i=0; i<20; i++)
72 {
73 if (i<barcode_get_length())
74 lcd_putch(global_barcode_buffer[i]);
75 else
76 lcd_putch(' ');
77 }
78 barcode_reset();
79 }
80
81 key = keyboard_read();
82
83
84 lcd_goto(0x40);
85
86 if (key ==0)
87 lcd_puts(" ");
88 else
89 {
90 key2 = key;
91 for (i=0;i<8;i++)
92 {
93 if (key & 0x80)
94 lcd_putch('1');
95 else
96 lcd_putch('0');
97 key <<= 1;
98 }
99 lcd_putch('_');
100 lcd_putch(key2);
101 }
102 */
103
104 key = keyboard_read_safe();
105 key = 'a'; //debug
106 if (key)
107 {
108 #ifdef USE_EXTERNAL_LCD
109 mylcd_putch(key);
110 #else
111 lcd_putch(key);
112 #endif
113 }
114
115
116 DelayMs(30);
117
118 x++;
119 RB0 = x;
120
121
122 }
123 }
124

  ViewVC Help
Powered by ViewVC 1.1.20