David Buck
/
voltmeter
header.h@0:d322a5241da8, 2009-12-16 (annotated)
- Committer:
- Kaikestu
- Date:
- Wed Dec 16 12:04:23 2009 +0000
- Revision:
- 0:d322a5241da8
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kaikestu | 0:d322a5241da8 | 1 | /* header.h header file */ |
Kaikestu | 0:d322a5241da8 | 2 | |
Kaikestu | 0:d322a5241da8 | 3 | /*******************************************************/ |
Kaikestu | 0:d322a5241da8 | 4 | /* function prototypes */ |
Kaikestu | 0:d322a5241da8 | 5 | /*******************************************************/ |
Kaikestu | 0:d322a5241da8 | 6 | |
Kaikestu | 0:d322a5241da8 | 7 | /* main.cpp prototypes */ |
Kaikestu | 0:d322a5241da8 | 8 | |
Kaikestu | 0:d322a5241da8 | 9 | /* ADC_setup.cpp prototypes */ |
Kaikestu | 0:d322a5241da8 | 10 | void ADC_init(void); |
Kaikestu | 0:d322a5241da8 | 11 | float ADC_read(void); |
Kaikestu | 0:d322a5241da8 | 12 | |
Kaikestu | 0:d322a5241da8 | 13 | /* LDC_setup.cpp prototypes */ |
Kaikestu | 0:d322a5241da8 | 14 | void LCD_init(void); |
Kaikestu | 0:d322a5241da8 | 15 | void LCD_displayV(void); |
Kaikestu | 0:d322a5241da8 | 16 | void toggle_enable(void); |
Kaikestu | 0:d322a5241da8 | 17 | |
Kaikestu | 0:d322a5241da8 | 18 | /* mbed_functions.cpp prototypes*/ |
Kaikestu | 0:d322a5241da8 | 19 | void delay_s(void); |
Kaikestu | 0:d322a5241da8 | 20 | void delay_l(void); |
Kaikestu | 0:d322a5241da8 | 21 | |
Kaikestu | 0:d322a5241da8 | 22 | /********************************************************/ |
Kaikestu | 0:d322a5241da8 | 23 | /* #defines */ |
Kaikestu | 0:d322a5241da8 | 24 | /********************************************************/ |
Kaikestu | 0:d322a5241da8 | 25 | |
Kaikestu | 0:d322a5241da8 | 26 | // *** mc9s12dp256 register addresses |
Kaikestu | 0:d322a5241da8 | 27 | |
Kaikestu | 0:d322a5241da8 | 28 | // Pin Assignment |
Kaikestu | 0:d322a5241da8 | 29 | #define PINSEL_BASE_ADDR 0xE002C000 |
Kaikestu | 0:d322a5241da8 | 30 | //PINSEL1 |
Kaikestu | 0:d322a5241da8 | 31 | #define PINSEL1 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x04)) |
Kaikestu | 0:d322a5241da8 | 32 | |
Kaikestu | 0:d322a5241da8 | 33 | //SCS - System Controls and Status, & Power Control */ |
Kaikestu | 0:d322a5241da8 | 34 | #define SCB_BASE_ADDR 0xE01FC000 |
Kaikestu | 0:d322a5241da8 | 35 | #define SCS (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x1A0)) |
Kaikestu | 0:d322a5241da8 | 36 | #define PCONP (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x0C4)) |
Kaikestu | 0:d322a5241da8 | 37 | |
Kaikestu | 0:d322a5241da8 | 38 | // Digital IO registers |
Kaikestu | 0:d322a5241da8 | 39 | #define FIO_BASE_ADDR 0x3FFFC000 |
Kaikestu | 0:d322a5241da8 | 40 | //FIO2DIR0 |
Kaikestu | 0:d322a5241da8 | 41 | #define FIO2DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x40)) |
Kaikestu | 0:d322a5241da8 | 42 | //FIO2PIN0 |
Kaikestu | 0:d322a5241da8 | 43 | #define FIO2PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x54)) |
Kaikestu | 0:d322a5241da8 | 44 | //FIO2CLR0 |
Kaikestu | 0:d322a5241da8 | 45 | #define FIO2CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5C)) |
Kaikestu | 0:d322a5241da8 | 46 | //FIO2SET0 |
Kaikestu | 0:d322a5241da8 | 47 | #define FIO2SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x58)) |
Kaikestu | 0:d322a5241da8 | 48 | //FIO0DIR2 |
Kaikestu | 0:d322a5241da8 | 49 | #define FIO0DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x02)) |
Kaikestu | 0:d322a5241da8 | 50 | //FIO0PIN2 |
Kaikestu | 0:d322a5241da8 | 51 | #define FIO0PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x16)) |
Kaikestu | 0:d322a5241da8 | 52 | |
Kaikestu | 0:d322a5241da8 | 53 | // ADC registers |
Kaikestu | 0:d322a5241da8 | 54 | #define AD0_BASE_ADDR 0xE0034000 |
Kaikestu | 0:d322a5241da8 | 55 | //AD0CR |
Kaikestu | 0:d322a5241da8 | 56 | #define AD0CR (*(volatile unsigned long *)(AD0_BASE_ADDR + 0x00)) |
Kaikestu | 0:d322a5241da8 | 57 | //AD0GDR |
Kaikestu | 0:d322a5241da8 | 58 | #define AD0GDR (*(volatile unsigned long *)(AD0_BASE_ADDR + 0x04)) |
Kaikestu | 0:d322a5241da8 | 59 | |
Kaikestu | 0:d322a5241da8 | 60 | |
Kaikestu | 0:d322a5241da8 | 61 | /* LCD display constants */ |
Kaikestu | 0:d322a5241da8 | 62 | #define _sp 0x20 /* space */ |
Kaikestu | 0:d322a5241da8 | 63 | #define _eq 0x3d /* = sign */ |
Kaikestu | 0:d322a5241da8 | 64 | #define _0 0x30 |
Kaikestu | 0:d322a5241da8 | 65 | #define _1 0x31 |
Kaikestu | 0:d322a5241da8 | 66 | #define _2 0x32 |
Kaikestu | 0:d322a5241da8 | 67 | #define _3 0x33 |
Kaikestu | 0:d322a5241da8 | 68 | #define _4 0x34 |
Kaikestu | 0:d322a5241da8 | 69 | #define _5 0x35 |
Kaikestu | 0:d322a5241da8 | 70 | #define _6 0x36 |
Kaikestu | 0:d322a5241da8 | 71 | #define _7 0x37 |
Kaikestu | 0:d322a5241da8 | 72 | #define _8 0x38 |
Kaikestu | 0:d322a5241da8 | 73 | #define _9 0x39 |
Kaikestu | 0:d322a5241da8 | 74 | #define _A 0x41 |
Kaikestu | 0:d322a5241da8 | 75 | #define _B 0x42 |
Kaikestu | 0:d322a5241da8 | 76 | #define _C 0x43 |
Kaikestu | 0:d322a5241da8 | 77 | #define _D 0x44 |
Kaikestu | 0:d322a5241da8 | 78 | #define _E 0x45 |
Kaikestu | 0:d322a5241da8 | 79 | #define _F 0x46 |
Kaikestu | 0:d322a5241da8 | 80 | #define _G 0x47 |
Kaikestu | 0:d322a5241da8 | 81 | #define _H 0x48 |
Kaikestu | 0:d322a5241da8 | 82 | #define _I 0x49 |
Kaikestu | 0:d322a5241da8 | 83 | #define _J 0x4a |
Kaikestu | 0:d322a5241da8 | 84 | #define _K 0x4b |
Kaikestu | 0:d322a5241da8 | 85 | #define _L 0x4c |
Kaikestu | 0:d322a5241da8 | 86 | #define _M 0x4d |
Kaikestu | 0:d322a5241da8 | 87 | #define _N 0x4e |
Kaikestu | 0:d322a5241da8 | 88 | #define _O 0x4f |
Kaikestu | 0:d322a5241da8 | 89 | #define _P 0x50 |
Kaikestu | 0:d322a5241da8 | 90 | #define _Q 0x51 |
Kaikestu | 0:d322a5241da8 | 91 | #define _R 0x52 |
Kaikestu | 0:d322a5241da8 | 92 | #define _S 0x53 |
Kaikestu | 0:d322a5241da8 | 93 | #define _T 0x54 |
Kaikestu | 0:d322a5241da8 | 94 | #define _U 0x55 |
Kaikestu | 0:d322a5241da8 | 95 | #define _V 0x56 |
Kaikestu | 0:d322a5241da8 | 96 | #define _W 0x57 |
Kaikestu | 0:d322a5241da8 | 97 | #define _X 0x58 |
Kaikestu | 0:d322a5241da8 | 98 | #define _Y 0x59 |
Kaikestu | 0:d322a5241da8 | 99 | #define _Z 0x5a |
Kaikestu | 0:d322a5241da8 | 100 | #define _a 0x61 |
Kaikestu | 0:d322a5241da8 | 101 | #define _b 0x62 |
Kaikestu | 0:d322a5241da8 | 102 | #define _c 0x63 |
Kaikestu | 0:d322a5241da8 | 103 | #define _d 0x64 |
Kaikestu | 0:d322a5241da8 | 104 | #define _e 0x65 |
Kaikestu | 0:d322a5241da8 | 105 | #define _f 0x66 |
Kaikestu | 0:d322a5241da8 | 106 | #define _g 0x67 |
Kaikestu | 0:d322a5241da8 | 107 | #define _h 0x68 |
Kaikestu | 0:d322a5241da8 | 108 | #define _i 0x69 |
Kaikestu | 0:d322a5241da8 | 109 | #define _j 0x6a |
Kaikestu | 0:d322a5241da8 | 110 | #define _k 0x6b |
Kaikestu | 0:d322a5241da8 | 111 | #define _l 0x6c |
Kaikestu | 0:d322a5241da8 | 112 | #define _m 0x6d |
Kaikestu | 0:d322a5241da8 | 113 | #define _n 0x6e |
Kaikestu | 0:d322a5241da8 | 114 | #define _o 0x6f |
Kaikestu | 0:d322a5241da8 | 115 | #define _p 0x70 |
Kaikestu | 0:d322a5241da8 | 116 | #define _q 0x71 |
Kaikestu | 0:d322a5241da8 | 117 | #define _r 0x72 |
Kaikestu | 0:d322a5241da8 | 118 | #define _s 0x73 |
Kaikestu | 0:d322a5241da8 | 119 | #define _t 0x74 |
Kaikestu | 0:d322a5241da8 | 120 | #define _u 0x75 |
Kaikestu | 0:d322a5241da8 | 121 | #define _v 0x76 |
Kaikestu | 0:d322a5241da8 | 122 | #define _w 0x77 |
Kaikestu | 0:d322a5241da8 | 123 | #define _x 0x78 |
Kaikestu | 0:d322a5241da8 | 124 | #define _y 0x79 |
Kaikestu | 0:d322a5241da8 | 125 | #define _z 0x7a |