Parent Directory
|
Revision Log
Seems like I forgot to import my own code/project
1 | torben | 77 | |
2 | #include <pic18.h> | ||
3 | #include <stdio.h> | ||
4 | #include "delay.h" | ||
5 | #include "lcd.h" | ||
6 | #include "myi2c.h" | ||
7 | #include "barcode.h" | ||
8 | #include "globals.h" | ||
9 | #include "keyboard.h" | ||
10 | |||
11 | /* | ||
12 | void i2c_init(void) | ||
13 | { | ||
14 | // I2C_MODULE hører hjemme i i2c.h | ||
15 | #ifdef I2C_MODULE | ||
16 | SSPMode(MASTER_MODE); | ||
17 | SSPEN = 1; //Synch. Serial Port Enable | ||
18 | CKP = 1; //SCL Release control bit | ||
19 | |||
20 | //note to self : husk altid at justere Baud-rate generatoren så at det passer sammen med krystal-frekvensen | ||
21 | SSPADD = 0x0A; | ||
22 | #else | ||
23 | SCL_DIR = I2C_OUTPUT; | ||
24 | SDA_DIR = I2C_OUTPUT; | ||
25 | SDA = 0; | ||
26 | SCL = 0; | ||
27 | #endif | ||
28 | } | ||
29 | */ | ||
30 | |||
31 | |||
32 | void main(void) | ||
33 | { | ||
34 | char key, key2; | ||
35 | char buffer[5]; | ||
36 | int i; | ||
37 | lcd_init(0); | ||
38 | InitI2C(); | ||
39 | barcode_init(); | ||
40 | |||
41 | while (1) | ||
42 | {/* | ||
43 | if (barcode_is_ready()) | ||
44 | { | ||
45 | lcd_home(); | ||
46 | for (i=0; i<20; i++) | ||
47 | { | ||
48 | if (i<barcode_get_length()) | ||
49 | lcd_putch(global_barcode_buffer[i]); | ||
50 | else | ||
51 | lcd_putch(' '); | ||
52 | } | ||
53 | barcode_reset(); | ||
54 | } | ||
55 | |||
56 | key = keyboard_read(); | ||
57 | |||
58 | |||
59 | lcd_goto(0x40); | ||
60 | |||
61 | if (key ==0) | ||
62 | lcd_puts(" "); | ||
63 | else | ||
64 | { | ||
65 | key2 = key; | ||
66 | for (i=0;i<8;i++) | ||
67 | { | ||
68 | if (key & 0x80) | ||
69 | lcd_putch('1'); | ||
70 | else | ||
71 | lcd_putch('0'); | ||
72 | key <<= 1; | ||
73 | } | ||
74 | lcd_putch('_'); | ||
75 | lcd_putch(key2); | ||
76 | } | ||
77 | */ | ||
78 | |||
79 | key = keyboard_read_safe(); | ||
80 | if (key) | ||
81 | lcd_putch(key); | ||
82 | |||
83 | DelayMs(30); | ||
84 | } | ||
85 | } |
ViewVC Help | |
Powered by ViewVC 1.1.20 |