REJ05B0811_0110 Rev.1.10
2007.11
Page 2 of 16
M16C/26A Group
Sample Program (Lux Meter)
3.
Port Arrangement
4.
Operational Outline
Illuminance levels (
−4 to 4) are shown on liquid crystal display by using an illuminance sensor.
Determine the criterion for brightness in 5 seconds after the pressing the reset switch.
Then, when light is impinged on the illuminance sensor to increase brightness, the illuminance level displayed on LCD changes from 0 to 1,
2, 3 and 4.
Conversely, when brightness is reduced, the illuminance level displayed on LCD changes from 0 to 1, 2, 3 and 4.
• Timer A0 (timer mode, main 2 ms cycle)
This timer counts 2 milliseconds using the main clock of the microcomputer as the count source.
It is used as the basic timer of RSK_LIB.
Time management, LCD display management and AD input are performed using this timer.
• AD0 (single-shot mode, illuminance input measurement)
Analog voltages are converted to digital data using the main clock of the microcomputer as a conversion clock.
More specifically, the analog voltages output from the illuminance sensor are A/D converted.
L E
E L
V
L I G H T
0
10MHz
LCD
P100
Xin
P60
P61
P62
P63
P90
P91
LCD E
LCD RS
LCD D7
LCD D6
LCD D5
LCD D4
M30260F8AGP
Luxmeter
When light is impinged on illuminance
sensor, illuminance level increases.
L I G H T
L E V E L 4
Liquid crystal display
M16C26A
Illuminance sensor
5seconds elapsed
Reset switch
depressed
Liquid crystal display
M16C26A