4 SAMPLE CODE MANUAL .............................................................................................. 26
4.1 Project Structure ..................................................................................................... 26
4.2.1
ADC .c ....................................................................................................... 27
4.2.2
Addressjudge .c ........................................................................................ 28
4.2.3
Ext-interrupt .c ........................................................................................... 29
4.2.4
I2C .c ......................................................................................................... 30
4.2.5
Initial .c ...................................................................................................... 31
4.2.6
Slavemodei2c .c ........................................................................................ 32
4.2.7
Standby .c ................................................................................................. 33
4.2.8
Timer.c ...................................................................................................... 34
4.3.1
I2CMasterMacro.c ..................................................................................... 35
4.3.2
I2CSlaveMacro.c ....................................................................................... 37
4.3.3
SleepMacro.c ............................................................................................ 38
4.6 Usage Demo ........................................................................................................... 41
4.6.1
Code of main.c .......................................................................................... 41
4.6.2
Code of Initial_ADC ................................................................................... 41
4.6.3
Code of Read_ADC .................................................................................. 42
4.6.4
4.6.5
Code of Init_EXT ....................................................................................... 43
4.6.6
Code of INTER_EXT ................................................................................. 43
4.6.7
Code of I2C_Init ........................................................................................ 43
4.6.8
Code of Read_I2C .................................................................................... 44
4.6.9
Code of Write_I2C ..................................................................................... 44
4.6.10 Code of Initial ............................................................................................ 44
MB2146-460-E Setup Guide V1.2
Contents
MCU-AN-500083-E-12 - Page 4