add buttons for voltmeters

This commit is contained in:
eddyem 2015-04-19 23:23:40 +03:00
parent f5bd901e9e
commit 8cde19f5b1
26 changed files with 3620 additions and 0 deletions

View File

@ -0,0 +1,101 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# 4-digit,common_cathode
#
DEF 4-digit,common_cathode DIS 0 40 Y Y 1 F N
F0 "DIS" 0 500 60 H V C CNN
F1 "4-digit,common_cathode" 0 -450 60 H V C CNN
F2 "" -450 0 60 H V C CNN
F3 "" -450 0 60 H V C CNN
DRAW
C -520 -320 20 0 1 0 F
C -70 -320 20 0 1 0 F
C 380 -320 20 0 1 0 F
C 830 -320 20 0 1 0 F
S -1150 400 1150 -400 0 1 0 N
P 6 0 1 0 -850 -20 -550 -20 -600 -320 -900 -320 -850 -20 -850 -20 N
P 6 0 1 0 -800 320 -500 320 -550 20 -850 20 -800 320 -800 320 N
P 6 0 1 0 -400 -20 -100 -20 -150 -320 -450 -320 -400 -20 -400 -20 N
P 6 0 1 0 -350 320 -50 320 -100 20 -400 20 -350 320 -350 320 N
P 6 0 1 0 50 -20 350 -20 300 -320 0 -320 50 -20 50 -20 N
P 6 0 1 0 100 320 400 320 350 20 50 20 100 320 100 320 N
P 6 0 1 0 500 -20 800 -20 750 -320 450 -320 500 -20 500 -20 N
P 6 0 1 0 550 320 850 320 800 20 500 20 550 320 550 320 N
X E 1 -1450 250 300 R 50 50 1 1 I
X D 2 -1450 150 300 R 50 50 1 1 I
X DP 3 -1450 50 300 R 50 50 1 1 I
X C 4 -1450 -50 300 R 50 50 1 1 I
X G 5 -1450 -150 300 R 50 50 1 1 I
X DIG4 6 -1450 -250 300 R 50 50 1 1 I
X B 7 1450 -250 300 L 50 50 1 1 I
X DIG3 8 1450 -150 300 L 50 50 1 1 I
X DIG2 9 1450 -50 300 L 50 50 1 1 I
X F 10 1450 50 300 L 50 50 1 1 I
X A 11 1450 150 300 L 50 50 1 1 I
X DIG1 12 1450 250 300 L 50 50 1 1 I
ENDDRAW
ENDDEF
#
# ARK-SN410362N
#
DEF ARK-SN410362N DIS 0 40 Y Y 1 F N
F0 "DIS" 0 500 60 H V C CNN
F1 "ARK-SN410362N" 0 -450 60 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
C -70 -320 20 0 1 0 F
C 430 -320 20 0 1 0 F
S 550 -400 -550 450 0 1 0 N
P 6 0 1 0 -400 -20 -100 -20 -150 -320 -450 -320 -400 -20 -400 -20 N
P 6 0 1 0 -350 320 -50 320 -100 20 -400 20 -350 320 -350 320 N
P 6 0 1 0 100 -20 400 -20 350 -320 50 -320 100 -20 100 -20 N
P 6 0 1 0 150 320 450 320 400 20 100 20 150 320 150 320 N
X G 1 -850 300 300 R 50 50 1 1 I
X DP 2 -850 150 300 R 50 50 1 1 I
X A 3 -850 0 300 R 50 50 1 1 I
X F 4 -850 -150 300 R 50 50 1 1 I
X DIG2 5 -850 -300 300 R 50 50 1 1 I
X D 6 850 -300 300 L 50 50 1 1 I
X E 7 850 -150 300 L 50 50 1 1 I
X C 8 850 0 300 L 50 50 1 1 I
X B 9 850 150 300 L 50 50 1 1 I
X DIG1 10 850 300 300 L 50 50 1 1 I
ENDDRAW
ENDDEF
#
# ARK-SP410361N
#
DEF ARK-SP410361N DIS 0 40 Y Y 1 F N
F0 "DIS" 0 500 60 H V C CNN
F1 "ARK-SP410361N" 0 -450 60 H V C CNN
F2 "" -250 0 60 H V C CNN
F3 "" -250 0 60 H V C CNN
DRAW
C -320 -320 20 0 1 0 F
C 130 -320 20 0 1 0 F
C 580 -320 20 0 1 0 F
S -800 400 750 -400 0 1 0 N
P 6 0 1 0 -650 -20 -350 -20 -400 -320 -700 -320 -650 -20 -650 -20 N
P 6 0 1 0 -600 320 -300 320 -350 20 -650 20 -600 320 -600 320 N
P 6 0 1 0 -200 -20 100 -20 50 -320 -250 -320 -200 -20 -200 -20 N
P 6 0 1 0 -150 320 150 320 100 20 -200 20 -150 320 -150 320 N
P 6 0 1 0 250 -20 550 -20 500 -320 200 -320 250 -20 250 -20 N
P 6 0 1 0 300 320 600 320 550 20 250 20 300 320 300 320 N
X E 1 -1100 250 300 R 50 50 1 1 I
X D 2 -1100 150 300 R 50 50 1 1 I
X DP 3 -1100 50 300 R 50 50 1 1 I
X C 4 -1100 -50 300 R 50 50 1 1 I
X G 5 -1100 -150 300 R 50 50 1 1 I
X NC 6 -1100 -250 300 R 50 50 1 1 N
X B 7 1050 -250 300 L 50 50 1 1 I
X DIG3 8 1050 -150 300 L 50 50 1 1 I
X DIG2 9 1050 -50 300 L 50 50 1 1 I
X F 10 1050 50 300 L 50 50 1 1 I
X A 11 1050 150 300 L 50 50 1 1 I
X DIG1 12 1050 250 300 L 50 50 1 1 I
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1,86 @@
EESchema-LIBRARY Version 2.3 Date: Сб 31 янв 2015 19:22:46
#encoding utf-8
#
# STM8S003F3P6
#
DEF STM8S003F3P6 IC 0 40 Y Y 1 F N
F0 "IC" 0 600 60 H V C CNN
F1 "STM8S003F3P6" 0 -800 60 H V C CNN
F2 "TSSOP20" -100 500 60 H I C CNN
F3 "~" 0 0 60 H V C CNN
$FPLIST
TSSOP*
$ENDFPLIST
DRAW
S -1100 450 1200 -650 0 1 0 N
X PD4(HS)/BEEP/TIM2_CH1/UART1_CK 1 -1250 350 149 R 40 40 1 1 B
X PD5(HS)/UART1_TX/AIN5 2 -1250 250 149 R 40 40 1 1 B
X PD6(HS)/UART1_RX/AIN6 3 -1250 150 149 R 40 40 1 1 B
X NRST 4 -1250 50 149 R 40 40 1 1 I
X PA1/OSCI 5 -1250 -50 149 R 40 40 1 1 B
X PA2/OSCOUT 6 -1250 -150 149 R 40 40 1 1 B
X VSS 7 -1250 -250 149 R 40 40 1 1 W
X Vcap 8 -1250 -350 149 R 40 40 1 1 O
X VDD 9 -1250 -450 149 R 40 40 1 1 W
X PA3(HS)/[SPI_NSS]TIM2_CH3 10 -1250 -550 149 R 40 40 1 1 B
X AIN4/ADC_ETR/TIM2_CH2/(HS)PD3 20 1350 350 149 L 40 40 1 1 B
X [TIM1_BKIN]/I2C_SDA/(T)PB5 11 1350 -550 149 L 40 40 1 1 B
X [ADC_ETR]/I2C_SCL/(T)PB4 12 1350 -450 149 L 40 40 1 1 B
X [TLI]/[TIM1_CH1N]/TIM1_CH3/(HS)PC3 13 1350 -350 149 L 40 40 1 1 B
X CLK_CCO/TIM1_CH4/AIN2/[TIM1_CH2N]/(HS)PC4 14 1350 -250 149 L 40 40 1 1 B
X [TIM2_CH1]/SPI_SCK/(HS)PC5 15 1350 -150 149 L 40 40 1 1 B
X [TIM1_CH1]/SPI_MOSI/(HS)PC6 16 1350 -50 149 L 40 40 1 1 B
X [TIM1_CH2]/SPI_MISO/(HS)PC7 17 1350 50 149 L 40 40 1 1 B
X SWIM/(HS)PD1 18 1350 150 149 L 40 40 1 1 B
X AIN3/[TIM2_CH3]/(HS)PD2 19 1350 250 149 L 40 40 1 1 B
ENDDRAW
ENDDEF
#
# STM8S003K3T
#
DEF STM8S003K3T IC 0 40 Y Y 1 F N
F0 "IC" -800 1150 60 H V C CNN
F1 "STM8S003K3T" 550 -1100 60 H V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
$FPLIST
LQFP32*
$ENDFPLIST
DRAW
S -850 1100 850 -1050 0 1 10 f
X NRST 1 -1000 1000 149 R 40 40 1 1 I
X OSCI/PA1 2 1000 1000 149 L 40 40 1 1 B
X OSCOUT/PA2 3 1000 900 149 L 40 40 1 1 B
X VSS 4 0 -1200 149 U 40 40 1 1 W
X Vcap 5 -1000 -950 149 R 40 40 1 1 I
X VDD 6 0 1250 149 D 40 40 1 1 W
X [SPI_NSS]TIM2_CH3/PA3 7 1000 800 149 L 40 40 1 1 B
X PF4 8 -1000 -350 149 R 40 40 1 1 B
X PB7 9 1000 -50 149 L 40 40 1 1 B
X PB6 10 1000 50 149 L 40 40 1 1 B
X TIM1_CH3/PC3 20 1000 -400 149 L 40 40 1 1 B
X PD5/UART1_TX 30 -1000 150 149 R 40 40 1 1 B
X I2C_SDA/PB5 11 1000 150 149 L 40 40 1 1 B
X CLK_CCO/TIM1_CH4/PC4 21 1000 -500 149 L 40 40 1 1 B
X PD6/UART1_RX 31 -1000 50 149 R 40 40 1 1 B
X I2C_SCL/PB4 12 1000 250 149 L 40 40 1 1 B
X SPI_SCK/PC5 22 1000 -600 149 L 40 40 1 1 B
X PD7/TLI[TIM1_CH4] 32 -1000 -50 148 R 40 40 1 1 B
X TIM1_ETR/AIN3/PB3 13 1000 350 149 L 40 40 1 1 B
X PI_MOSI/PC6 23 1000 -700 149 L 40 40 1 1 B
X TIM1_CH3N/AIN2/PB2 14 1000 450 149 L 40 40 1 1 B
X PI_MISO/PC7 24 1000 -800 149 L 40 40 1 1 B
X TIM1_CH2N/AIN1/PB1 15 1000 550 149 L 40 40 1 1 B
X PD0/TIM1_BKIN[CLK_CCO] 25 -1000 650 148 R 40 40 1 1 B
X TIM1_CH1N/AIN0/PB0 16 1000 650 149 L 40 40 1 1 B
X PD1/SWIM 26 -1000 550 149 R 40 40 1 1 B
X PE5/SPI_NSS 17 -1000 -200 148 R 40 40 1 1 B
X PD2[TIM2_CH3] 27 -1000 450 149 R 40 40 1 1 B
X UART1_CK/TIM1_CH1/PC1 18 1000 -200 149 L 40 40 1 1 B
X PD3/ADC_ETR/TIM2_CH2 28 -1000 350 149 R 40 40 1 1 B
X TIM1_CH2/PC2 19 1000 -300 149 L 40 40 1 1 B
X PD4/BEEP/TIM2_CH1 29 -1000 250 149 R 40 40 1 1 B
ENDDRAW
ENDDEF
#
#End Library

Binary file not shown.

View File

@ -0,0 +1,88 @@
update=Вт 14 апр 2015 01:19:49
version=1
last_client=kicad
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
LastNetListRead=
PadDrlX=320
PadDimH=550
PadDimV=550
BoardThickness=620
TxtPcbV=600
TxtPcbH=600
TxtModV=500
TxtModH=500
TxtModW=100
VEgarde=100
DrawLar=120
EdgeLar=80
TxtLar=120
MSegLar=120
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=libcms
LibName7=display
LibName8=led
LibName9=dip_sockets
LibName10=pga_sockets
LibName11=valves
[general]
version=1
[eeschema]
version=1
PageLayoutDescrFile=
SubpartIdSeparator=0
SubpartFirstId=65
LibDir=
NetFmtName=
SpiceForceRefPrefix=0
SpiceUseNetNumbers=0
RptD_X=0
RptD_Y=100
RptLab=1
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
LibName31=stm8
LibName32=seven_segm
LibName33=stm8s003
LibName34=relays

View File

@ -0,0 +1,693 @@
EESchema Schematic File Version 2
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers
LIBS:dsp
LIBS:microchip
LIBS:analog_switches
LIBS:motorola
LIBS:texas
LIBS:intel
LIBS:audio
LIBS:interface
LIBS:digital-audio
LIBS:philips
LIBS:display
LIBS:cypress
LIBS:siliconi
LIBS:opto
LIBS:atmel
LIBS:contrib
LIBS:valves
LIBS:stm8
LIBS:seven_segm
LIBS:stm8s003
LIBS:relays
LIBS:thermostat-cache
EELAYER 24 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date "16 feb 2015"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L STM8S003F3P6 IC1
U 1 1 54CCE7DB
P 2700 2050
F 0 "IC1" H 2700 2650 60 0000 C CNN
F 1 "STM8S003F3P6" H 2700 1250 60 0000 C CNN
F 2 "TSSOP20" H 2600 2550 60 0001 C CNN
F 3 "~" H 2700 2050 60 0000 C CNN
1 2700 2050
1 0 0 -1
$EndComp
$Comp
L ARK-SP410361N DIS1
U 1 1 54CCF1F0
P 6100 1200
F 0 "DIS1" H 6100 1700 60 0000 C CNN
F 1 "ARK-SP420361N" H 6100 750 60 0000 C CNN
F 2 "~" H 5850 1200 60 0000 C CNN
F 3 "~" H 5850 1200 60 0000 C CNN
1 6100 1200
1 0 0 -1
$EndComp
Text Label 5000 1350 2 60 ~ 0
G
Text Label 5000 1150 2 60 ~ 0
DP
Text Label 7150 1050 0 60 ~ 0
A
Text Label 7150 1150 0 60 ~ 0
F
Text Label 5000 1050 2 60 ~ 0
D
Text Label 5000 950 2 60 ~ 0
E
Text Label 5000 1250 2 60 ~ 0
C
Text Label 7150 1450 0 60 ~ 0
B
Text Label 7750 950 0 60 ~ 0
C1
Text Label 7750 1250 0 60 ~ 0
C2
Text Label 7750 1350 0 60 ~ 0
C3
$Comp
L VCC #PWR01
U 1 1 54CD9F1D
P 1400 2500
F 0 "#PWR01" H 1400 2600 30 0001 C CNN
F 1 "VCC" H 1400 2600 30 0000 C CNN
F 2 "" H 1400 2500 60 0000 C CNN
F 3 "" H 1400 2500 60 0000 C CNN
1 1400 2500
0 -1 -1 0
$EndComp
$Comp
L GND #PWR02
U 1 1 54CDA116
P 1350 2300
F 0 "#PWR02" H 1350 2300 30 0001 C CNN
F 1 "GND" H 1350 2230 30 0001 C CNN
F 2 "" H 1350 2300 60 0000 C CNN
F 3 "" H 1350 2300 60 0000 C CNN
1 1350 2300
0 1 1 0
$EndComp
$Comp
L C C5
U 1 1 54CDA380
P 1250 2900
F 0 "C5" H 1250 3000 40 0000 L CNN
F 1 "1u" H 1256 2815 40 0000 L CNN
F 2 "" H 1288 2750 30 0000 C CNN
F 3 "" H 1250 2900 60 0000 C CNN
1 1250 2900
1 0 0 -1
$EndComp
Wire Wire Line
1250 2400 1450 2400
$Comp
L GND #PWR03
U 1 1 54CDA4A6
P 1250 3200
F 0 "#PWR03" H 1250 3200 30 0001 C CNN
F 1 "GND" H 1250 3130 30 0001 C CNN
F 2 "" H 1250 3200 60 0000 C CNN
F 3 "" H 1250 3200 60 0000 C CNN
1 1250 3200
1 0 0 -1
$EndComp
Wire Wire Line
1250 3200 1250 3100
Wire Wire Line
1350 2300 1450 2300
Wire Wire Line
1400 2500 1450 2500
Text Label 1450 2000 2 60 ~ 0
RST
$Comp
L C C4
U 1 1 552C43E6
P 800 2450
F 0 "C4" H 800 2550 40 0000 L CNN
F 1 "7.7u" H 806 2365 40 0000 L CNN
F 2 "" H 838 2300 30 0000 C CNN
F 3 "" H 800 2450 60 0000 C CNN
1 800 2450
1 0 0 -1
$EndComp
$Comp
L GND #PWR04
U 1 1 552C4457
P 800 2750
F 0 "#PWR04" H 800 2750 30 0001 C CNN
F 1 "GND" H 800 2680 30 0001 C CNN
F 2 "" H 800 2750 60 0000 C CNN
F 3 "" H 800 2750 60 0000 C CNN
1 800 2750
1 0 0 -1
$EndComp
Wire Wire Line
800 2750 800 2650
$Comp
L VCC #PWR05
U 1 1 552C4466
P 800 2250
F 0 "#PWR05" H 800 2350 30 0001 C CNN
F 1 "VCC" H 800 2350 30 0000 C CNN
F 2 "" H 800 2250 60 0000 C CNN
F 3 "" H 800 2250 60 0000 C CNN
1 800 2250
1 0 0 -1
$EndComp
Text Notes 5650 650 0 60 ~ 0
COMMON CATHODE!!!
$Comp
L R Rc1
U 1 1 552C4A0C
P 7500 950
F 0 "Rc1" V 7580 950 40 0000 C CNN
F 1 "220" V 7507 951 40 0000 C CNN
F 2 "" V 7430 950 30 0000 C CNN
F 3 "" H 7500 950 30 0000 C CNN
1 7500 950
0 1 1 0
$EndComp
Wire Wire Line
7250 950 7150 950
$Comp
L R Rc2
U 1 1 552C4B1F
P 7500 1250
F 0 "Rc2" V 7400 1250 40 0000 C CNN
F 1 "220" V 7507 1251 40 0000 C CNN
F 2 "" V 7430 1250 30 0000 C CNN
F 3 "" H 7500 1250 30 0000 C CNN
1 7500 1250
0 1 1 0
$EndComp
Wire Wire Line
7250 1250 7150 1250
Text Label 7150 1350 0 60 ~ 0
F
$Comp
L R Rc3
U 1 1 552C4B40
P 7500 1350
F 0 "Rc3" V 7580 1350 40 0000 C CNN
F 1 "220" V 7507 1351 40 0000 C CNN
F 2 "" V 7430 1350 30 0000 C CNN
F 3 "" H 7500 1350 30 0000 C CNN
1 7500 1350
0 1 1 0
$EndComp
Wire Wire Line
7250 1350 7150 1350
$Comp
L CONN_4 P1
U 1 1 552C5047
P 1100 750
F 0 "P1" V 1050 750 50 0000 C CNN
F 1 "CONN_4" V 1150 750 50 0000 C CNN
F 2 "" H 1100 750 60 0000 C CNN
F 3 "" H 1100 750 60 0000 C CNN
1 1100 750
-1 0 0 1
$EndComp
$Comp
L GND #PWR06
U 1 1 552C519A
P 1800 650
F 0 "#PWR06" H 1800 650 30 0001 C CNN
F 1 "GND" H 1800 580 30 0001 C CNN
F 2 "" H 1800 650 60 0000 C CNN
F 3 "" H 1800 650 60 0000 C CNN
1 1800 650
1 0 0 -1
$EndComp
Wire Wire Line
1450 600 1800 600
$Comp
L VCC #PWR07
U 1 1 552C51CA
P 1450 1000
F 0 "#PWR07" H 1450 1100 30 0001 C CNN
F 1 "VCC" H 1450 1100 30 0000 C CNN
F 2 "" H 1450 1000 60 0000 C CNN
F 3 "" H 1450 1000 60 0000 C CNN
1 1450 1000
-1 0 0 1
$EndComp
Wire Wire Line
1450 1000 1450 900
Text Label 1450 700 0 60 ~ 0
RST
Wire Wire Line
1800 600 1800 650
Text Label 1450 800 0 60 ~ 0
E
Text Label 4050 1900 0 60 ~ 0
E
Text Label 4050 1700 0 60 ~ 0
D
Text Label 4050 1800 0 60 ~ 0
DP
Text Label 4050 2000 0 60 ~ 0
C
Text Label 4050 2100 0 60 ~ 0
G
$Comp
L SW_PUSH SW1
U 1 1 552C59D6
P 5450 2600
F 0 "SW1" H 5600 2710 50 0000 C CNN
F 1 "SW_PUSH" H 5450 2520 50 0000 C CNN
F 2 "" H 5450 2600 60 0000 C CNN
F 3 "" H 5450 2600 60 0000 C CNN
1 5450 2600
1 0 0 -1
$EndComp
$Comp
L SW_PUSH SW2
U 1 1 552C5A2D
P 6300 2600
F 0 "SW2" H 6450 2710 50 0000 C CNN
F 1 "SW_PUSH" H 6300 2520 50 0000 C CNN
F 2 "" H 6300 2600 60 0000 C CNN
F 3 "" H 6300 2600 60 0000 C CNN
1 6300 2600
1 0 0 -1
$EndComp
$Comp
L SW_PUSH SW3
U 1 1 552C5A69
P 7200 2600
F 0 "SW3" H 7350 2710 50 0000 C CNN
F 1 "SW_PUSH" H 7200 2520 50 0000 C CNN
F 2 "" H 7200 2600 60 0000 C CNN
F 3 "" H 7200 2600 60 0000 C CNN
1 7200 2600
1 0 0 -1
$EndComp
$Comp
L GND #PWR08
U 1 1 552C5FCF
P 5750 2700
F 0 "#PWR08" H 5750 2700 30 0001 C CNN
F 1 "GND" H 5750 2630 30 0001 C CNN
F 2 "" H 5750 2700 60 0000 C CNN
F 3 "" H 5750 2700 60 0000 C CNN
1 5750 2700
1 0 0 -1
$EndComp
Wire Wire Line
5750 2700 5750 2600
$Comp
L GND #PWR09
U 1 1 552C5FEC
P 6600 2700
F 0 "#PWR09" H 6600 2700 30 0001 C CNN
F 1 "GND" H 6600 2630 30 0001 C CNN
F 2 "" H 6600 2700 60 0000 C CNN
F 3 "" H 6600 2700 60 0000 C CNN
1 6600 2700
1 0 0 -1
$EndComp
Wire Wire Line
6600 2700 6600 2600
$Comp
L GND #PWR010
U 1 1 552C6009
P 7500 2700
F 0 "#PWR010" H 7500 2700 30 0001 C CNN
F 1 "GND" H 7500 2630 30 0001 C CNN
F 2 "" H 7500 2700 60 0000 C CNN
F 3 "" H 7500 2700 60 0000 C CNN
1 7500 2700
1 0 0 -1
$EndComp
Wire Wire Line
7500 2700 7500 2600
Text Label 6900 2600 2 60 ~ 0
"-"
Text Label 6000 2600 2 60 ~ 0
"+"
Text Label 5150 2600 2 60 ~ 0
"SET"
Text Label 4050 2400 0 60 ~ 0
"SET"
Text Label 4050 2300 0 60 ~ 0
"+"
Text Label 4050 2200 0 60 ~ 0
"-"
Text Label 4050 2600 0 60 ~ 0
C2
Text Label 4050 2500 0 60 ~ 0
C3
Text Label 1450 1700 2 60 ~ 0
C1
Text Label 1450 1800 2 60 ~ 0
A
Text Label 1450 2100 2 60 ~ 0
F
Text Label 1450 2200 2 60 ~ 0
B
$Comp
L R R7
U 1 1 552C6D41
P 1450 3750
F 0 "R7" V 1530 3750 40 0000 C CNN
F 1 "2k" V 1457 3751 40 0000 C CNN
F 2 "" V 1380 3750 30 0000 C CNN
F 3 "" H 1450 3750 30 0000 C CNN
1 1450 3750
1 0 0 -1
$EndComp
$Comp
L R R1
U 1 1 552C6DEC
P 1450 4350
F 0 "R1" V 1530 4350 40 0000 C CNN
F 1 "10k" V 1457 4351 40 0000 C CNN
F 2 "" V 1380 4350 30 0000 C CNN
F 3 "" H 1450 4350 30 0000 C CNN
1 1450 4350
1 0 0 -1
$EndComp
$Comp
L GND #PWR011
U 1 1 552C6E73
P 1450 4700
F 0 "#PWR011" H 1450 4700 30 0001 C CNN
F 1 "GND" H 1450 4630 30 0001 C CNN
F 2 "" H 1450 4700 60 0000 C CNN
F 3 "" H 1450 4700 60 0000 C CNN
1 1450 4700
1 0 0 -1
$EndComp
Wire Wire Line
1450 4700 1450 4600
Wire Wire Line
1450 4000 1450 4100
Wire Wire Line
1450 2600 1450 3500
$Comp
L MOS_N Q1
U 1 1 552C6F93
P 1850 4050
F 0 "Q1" H 1860 4220 60 0000 R CNN
F 1 "MOS_N" H 1860 3900 60 0000 R CNN
F 2 "" H 1850 4050 60 0000 C CNN
F 3 "" H 1850 4050 60 0000 C CNN
1 1850 4050
1 0 0 -1
$EndComp
Wire Wire Line
1650 4050 1450 4050
Connection ~ 1450 4050
$Comp
L GND #PWR012
U 1 1 552C7049
P 1950 4350
F 0 "#PWR012" H 1950 4350 30 0001 C CNN
F 1 "GND" H 1950 4280 30 0001 C CNN
F 2 "" H 1950 4350 60 0000 C CNN
F 3 "" H 1950 4350 60 0000 C CNN
1 1950 4350
1 0 0 -1
$EndComp
Wire Wire Line
1950 4350 1950 4250
$Comp
L RM50-xx21 RL1
U 1 1 552C730E
P 2650 4050
F 0 "RL1" H 2300 4300 40 0000 C CNN
F 1 "RM50-xx21" V 3095 4065 40 0000 C CNN
F 2 "" H 2650 4050 60 0000 C CNN
F 3 "" H 2650 4050 60 0000 C CNN
1 2650 4050
0 1 1 0
$EndComp
Wire Wire Line
1950 3850 2350 3850
$Comp
L CONN_4 P2
U 1 1 552C777F
P 2900 5250
F 0 "P2" V 2850 5250 50 0000 C CNN
F 1 "CONN_4" V 2950 5250 50 0000 C CNN
F 2 "" H 2900 5250 60 0000 C CNN
F 3 "" H 2900 5250 60 0000 C CNN
1 2900 5250
0 1 1 0
$EndComp
Wire Wire Line
2750 4900 2750 4750
Wire Wire Line
2750 4750 2350 4750
Wire Wire Line
2350 4750 2350 4300
Wire Wire Line
2850 4900 2850 4600
Wire Wire Line
2850 4600 2950 4600
Wire Wire Line
2950 4600 2950 4400
$Comp
L GND #PWR013
U 1 1 552C7ACE
P 3200 5000
F 0 "#PWR013" H 3200 5000 30 0001 C CNN
F 1 "GND" H 3200 4930 30 0001 C CNN
F 2 "" H 3200 5000 60 0000 C CNN
F 3 "" H 3200 5000 60 0000 C CNN
1 3200 5000
1 0 0 -1
$EndComp
Wire Wire Line
3200 5000 3200 4900
Wire Wire Line
3200 4900 3050 4900
$Comp
L DIODE D2
U 1 1 552C7B28
P 3300 4700
F 0 "D2" H 3300 4800 40 0000 C CNN
F 1 "DIODE" H 3300 4600 40 0000 C CNN
F 2 "" H 3300 4700 60 0000 C CNN
F 3 "" H 3300 4700 60 0000 C CNN
1 3300 4700
1 0 0 -1
$EndComp
Wire Wire Line
2950 4900 2950 4700
Wire Wire Line
2950 4700 3100 4700
$Comp
L DIODE D1
U 1 1 552C7BB2
P 2650 3400
F 0 "D1" H 2650 3500 40 0000 C CNN
F 1 "DIODE" H 2650 3300 40 0000 C CNN
F 2 "" H 2650 3400 60 0000 C CNN
F 3 "" H 2650 3400 60 0000 C CNN
1 2650 3400
1 0 0 -1
$EndComp
Wire Wire Line
2350 3850 2350 3400
Wire Wire Line
2350 3400 2450 3400
Connection ~ 2350 3850
Connection ~ 2950 3850
Wire Wire Line
2950 3850 2950 3400
Wire Wire Line
2850 3400 3050 3400
$Comp
L R R3
U 1 1 552C7C92
P 3300 3400
F 0 "R3" V 3380 3400 40 0000 C CNN
F 1 "10" V 3307 3401 40 0000 C CNN
F 2 "" V 3230 3400 30 0000 C CNN
F 3 "" H 3300 3400 30 0000 C CNN
1 3300 3400
0 1 1 0
$EndComp
Connection ~ 2950 3400
Wire Wire Line
3550 3400 3550 4700
Wire Wire Line
3550 4700 3500 4700
$Comp
L NCP1117ST50T3G U1
U 1 1 552C83A4
P 4150 3450
F 0 "U1" H 4150 3700 40 0000 C CNN
F 1 "NCP1117ST50T3G" H 4150 3650 40 0000 C CNN
F 2 "" H 4150 3450 60 0000 C CNN
F 3 "" H 4150 3450 60 0000 C CNN
1 4150 3450
1 0 0 -1
$EndComp
Wire Wire Line
3750 3400 3550 3400
Connection ~ 3550 3400
$Comp
L GND #PWR014
U 1 1 552C87A6
P 4150 3800
F 0 "#PWR014" H 4150 3800 30 0001 C CNN
F 1 "GND" H 4150 3730 30 0001 C CNN
F 2 "" H 4150 3800 60 0000 C CNN
F 3 "" H 4150 3800 60 0000 C CNN
1 4150 3800
1 0 0 -1
$EndComp
Wire Wire Line
4150 3800 4150 3700
$Comp
L C C6
U 1 1 552C8A2F
P 3800 3750
F 0 "C6" H 3800 3850 40 0000 L CNN
F 1 "7.7u" H 3806 3665 40 0000 L CNN
F 2 "" H 3838 3600 30 0000 C CNN
F 3 "" H 3800 3750 60 0000 C CNN
1 3800 3750
0 1 1 0
$EndComp
Wire Wire Line
3550 3750 3600 3750
Connection ~ 3550 3750
Wire Wire Line
4000 3750 4250 3750
Connection ~ 4150 3750
$Comp
L C C7
U 1 1 552C8B6E
P 4450 3750
F 0 "C7" H 4450 3850 40 0000 L CNN
F 1 "7.7u" H 4456 3665 40 0000 L CNN
F 2 "" H 4488 3600 30 0000 C CNN
F 3 "" H 4450 3750 60 0000 C CNN
1 4450 3750
0 1 1 0
$EndComp
Wire Wire Line
4550 3400 4650 3400
Wire Wire Line
4650 3300 4650 3750
$Comp
L VCC #PWR015
U 1 1 552C933C
P 4650 3300
F 0 "#PWR015" H 4650 3400 30 0001 C CNN
F 1 "VCC" H 4650 3400 30 0000 C CNN
F 2 "" H 4650 3300 60 0000 C CNN
F 3 "" H 4650 3300 60 0000 C CNN
1 4650 3300
1 0 0 -1
$EndComp
Connection ~ 4650 3400
$Comp
L CONN_2 P3
U 1 1 552C9B93
P 6750 3550
F 0 "P3" V 6700 3550 40 0000 C CNN
F 1 "CONN_2" V 6800 3550 40 0000 C CNN
F 2 "" H 6750 3550 60 0000 C CNN
F 3 "" H 6750 3550 60 0000 C CNN
1 6750 3550
1 0 0 -1
$EndComp
$Comp
L GND #PWR016
U 1 1 552C9DC9
P 6400 3750
F 0 "#PWR016" H 6400 3750 30 0001 C CNN
F 1 "GND" H 6400 3680 30 0001 C CNN
F 2 "" H 6400 3750 60 0000 C CNN
F 3 "" H 6400 3750 60 0000 C CNN
1 6400 3750
1 0 0 -1
$EndComp
Wire Wire Line
6400 3750 6400 3650
$Comp
L C C1
U 1 1 552C9E00
P 6100 3650
F 0 "C1" H 6100 3750 40 0000 L CNN
F 1 "2u" H 6106 3565 40 0000 L CNN
F 2 "" H 6138 3500 30 0000 C CNN
F 3 "" H 6100 3650 60 0000 C CNN
1 6100 3650
1 0 0 -1
$EndComp
$Comp
L R R2
U 1 1 552C9ED3
P 5550 3450
F 0 "R2" V 5630 3450 40 0000 C CNN
F 1 "20k" V 5557 3451 40 0000 C CNN
F 2 "" V 5480 3450 30 0000 C CNN
F 3 "" H 5550 3450 30 0000 C CNN
1 5550 3450
0 1 1 0
$EndComp
Wire Wire Line
5800 3450 6400 3450
Connection ~ 6100 3450
Wire Wire Line
6100 3850 6250 3850
Wire Wire Line
6250 3850 6250 3650
Wire Wire Line
6250 3650 6400 3650
Connection ~ 6400 3650
Text Notes 7600 3600 2 60 ~ 0
10k thermistor
$Comp
L VCC #PWR017
U 1 1 552CA241
P 5300 3450
F 0 "#PWR017" H 5300 3550 30 0001 C CNN
F 1 "VCC" H 5300 3550 30 0000 C CNN
F 2 "" H 5300 3450 60 0000 C CNN
F 3 "" H 5300 3450 60 0000 C CNN
1 5300 3450
1 0 0 -1
$EndComp
Wire Wire Line
6100 3450 6100 3200
Text Label 6100 3200 0 60 ~ 0
Vt
Text Label 1450 1900 2 60 ~ 0
Vt
Wire Wire Line
1250 2400 1250 2700
$EndSCHEMATC

View File

@ -0,0 +1,33 @@
NAME=testproj
SDCC=sdcc
CCFLAGS=-DSTM8S003 -I../ -I../../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
LDFLAGS=-mstm8 --out-fmt-ihx -lstm8
FLASHFLAGS=-cstlinkv2 -pstm8s003
SRC=$(wildcard *.c)
OBJ=$(SRC:%.c=%.rel)
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
TRASH+=$(SRC:%.c=%.sym) $(NAME).lk $(NAME).map
INDEPENDENT_HEADERS=../stm8l.h Makefile
all: $(NAME).ihx
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
@touch $@
%.h: ;
clean:
rm -f $(TRASH)
load: $(NAME).ihx
stm8flash $(FLASHFLAGS) -w $(NAME).ihx
%.rel: %.c
$(SDCC) $(CCFLAGS) -c $<
$(NAME).ihx: $(OBJ)
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
.PHONY: all

View File

@ -0,0 +1,149 @@
/*
* interrupts.c
*
* Copyright 2015 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "stm8l.h"
#include "interrupts.h"
// Top Level Interrupt
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
// Auto Wake Up Interrupt
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
// Clock Controller Interrupt
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
// External Interrupt PORTA
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
// External Interrupt PORTB
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
// External Interrupt PORTC
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
// External Interrupt PORTD
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){}
// External Interrupt PORTE
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
#ifdef STM8S903
// External Interrupt PORTF
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
#endif // STM8S903
#if defined (STM8S208) || defined (STM8AF52Ax)
// CAN RX Interrupt routine.
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
// CAN TX Interrupt routine.
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
#endif // STM8S208 || STM8AF52Ax
// SPI Interrupt routine.
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
// Timer1 Update/Overflow/Trigger/Break Interrupt
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
if(TIM1_SR1 & TIM_SR1_UIF){ // update interrupt
Global_time++; // increase timer
}
TIM1_SR1 = 0; // clear all interrupt flags
}
// Timer1 Capture/Compare Interrupt routine.
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
#ifdef STM8S903
// Timer5 Update/Overflow/Break/Trigger Interrupt
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
// Timer5 Capture/Compare Interrupt
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
// Timer2 Update/Overflow/Break Interrupt
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){}
// Timer2 Capture/Compare Interrupt
// process soft I2C
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
}
#endif // STM8S903
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
// Timer3 Update/Overflow/Break Interrupt
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){}
// Timer3 Capture/Compare Interrupt
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
// UART1 TX Interrupt
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
// UART1 RX Interrupt
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
// I2C Interrupt
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
// UART2 TX interrupt
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
// UART2 RX interrupt
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){}
#endif // STM8S105 or STM8AF626x
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// UART3 TX interrupt
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
// UART3 RX interrupt
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// ADC2 interrupt
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
#else
// ADC1 interrupt
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
}
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#ifdef STM8S903
// Timer6 Update/Overflow/Trigger Interrupt
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
// Timer4 Update/Overflow Interrupt
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){}
#endif // STM8S903
// Eeprom EEC Interrupt
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}

View File

@ -0,0 +1,148 @@
/*
* interrupts.h
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __INTERRUPTS_H__
#define __INTERRUPTS_H__
#include "stm8l.h"
extern U8 ADC_ready; // flag: data ready
extern U32 Global_time; // global time in ms
extern int ADC_value; // value of last ADC measurement
// Top Level Interrupt
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
// Auto Wake Up Interrupt
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
// Clock Controller Interrupt
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
// External Interrupt PORTA
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
// External Interrupt PORTB
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
// External Interrupt PORTC
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
// External Interrupt PORTD
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
// External Interrupt PORTE
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
#ifdef STM8S903
// External Interrupt PORTF
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
#endif // STM8S903
#if defined (STM8S208) || defined (STM8AF52Ax)
// CAN RX Interrupt routine.
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
// CAN TX Interrupt routine.
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
#endif // STM8S208 || STM8AF52Ax
// SPI Interrupt routine.
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
// Timer1 Update/Overflow/Trigger/Break Interrupt
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
// Timer1 Capture/Compare Interrupt routine.
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
#ifdef STM8S903
// Timer5 Update/Overflow/Break/Trigger Interrupt
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
// Timer5 Capture/Compare Interrupt
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
// Timer2 Update/Overflow/Break Interrupt
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
// Timer2 Capture/Compare Interrupt
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
#endif // STM8S903
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
// Timer3 Update/Overflow/Break Interrupt
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
// Timer3 Capture/Compare Interrupt
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
// UART1 TX Interrupt
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
// UART1 RX Interrupt
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
// I2C Interrupt
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
// UART2 TX interrupt
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
// UART2 RX interrupt
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
#endif // STM8S105 or STM8AF626x
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// UART3 TX interrupt
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
// UART3 RX interrupt
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// ADC2 interrupt
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
// ADC1 interrupt
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#ifdef STM8S903
// Timer6 Update/Overflow/Trigger Interrupt
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
// Timer4 Update/Overflow Interrupt
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
#endif // STM8S903
// Eeprom EEC Interrupt
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
#endif // __INTERRUPTS_H__

View File

@ -0,0 +1,258 @@
/*
* led.c
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "stm8l.h"
#include "led.h"
/*
* bits no 7 6 5 4 3 2 1 0
* dec value 128 64 32 16 8 4 2 1
*/
/********** current variant **********/
/*
* One digit: TABLE:
* ***A*** 0 1 2 3 4 5 6 7 8 9 A B C D E F - h
* * * (F) PB4 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0
* F B (B) PB5 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1
* * * (A) PC3 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1
* ***G*** (G) PC7 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
* * * (C) PD1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0
* E C (DP)PC6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
* * * ** (D) PC5 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1
* ***D*** *DP* (E) PC4 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0
* **
*/
/*
* BUTTONS
* DON'T FORGET: PB4 & PB5 are "real open-drain"! They can't be pullup inputs, so
* you should solder resistor 10..47k to appropriate buttons!
* 0 - PB4, 1 - PB5, 2 - PD1, 3..7 - PC3..PC7
* or:
* 0 - F(10), 1 - B(7), 2 - C(4), 3 - A(11), 4 - E(1), 5 - D(2), 6 - DP(3), 7 - G(5)
*/
volatile U8 buttons_state;
static U8 display_buffer[3] = {' ',' ',' '}; // blank by default
static U8 N_current = 0; // current digit to display
/*
* Number of digit on indicator with common anode
* digis 0..2: PA3, PD4, PD5
*/
#define CLEAR_ANODES() do{PD_ODR &= ~(0x30);PA_ODR &= ~(0x08);}while(0)
/************* arrays for ports *************/
// PB, mask: 0x30 (dec: 48), PB4:0x10=16, PB5:0x20=32
// To light up a segment we should setup it as PPout -> this arrays are inverse!
#define PB_BLANK 0x30
static U8 PB_bits[18] = {48,32,32,32,48,16,16,32,48,48,48,16,16,32,16,16,0,16};
// PC, mask: 0xF8 (dec: 248), PC3:0x08=8, PC4:0x10=16, PC5:0x20=32, PC6:0x40=64, PC7:0x80=128
#define PC_BLANK 0xF8
static U8 PC_bits[18] = {56,0,184,168,128,168,184,8,184,168,152,176,56,176,184,152,128,144};
// PD, mask: 0x02, PD1
static U8 PD_bits[18] = {2,2,0,2,2,2,2,2,2,2,2,2,0,2,0,0,0,2};
#define PD_BLANK 0x02
/**
* Initialize ports
* anodes (PA3, PD4, PD5) are push-pull outputs,
* cathodes (PB4, PB5, PD1, PC3..PC7) are ODouts in active mode, pullup inputs in buttons reading and floating inputs in inactive
* PA3, PB4|5, PC3|4|5|6|7, PD1|4|5
*/
void LED_init(){
PA_DDR |= 0x08; PD_DDR |= 0x30; // anodes are PPout, cathodes will be PPout only in active mode
PA_CR1 |= 0x08; PD_CR1 |= 0x30;
// prepare cathodes ODR
PB_ODR &= ~PB_BLANK; PC_ODR &= ~PC_BLANK; PD_ODR &= ~PD_BLANK;
}
/*
********************* GPIO (page 111) ********************
* Px_ODR - Output data register bits
* Px_IDR - Pin input values
* Px_DDR - Data direction bits (1 - output)
* Px_CR1 - DDR=0: 0 - floating, 1 - pull-up input; DDR=1: 0 - pseudo-open-drain, 1 - push-pull output [not for "T"]
* Px_CR2 - DDR=0: 0/1 - EXTI disabled/enabled; DDR=1: 0/1 - 2/10MHz
*
*/
/**
* Show next digit - function calls from main() by some system time value amount
*/
void show_next_digit(){
U8 L = display_buffer[N_current] & 0x7f;
// first turn all off
CLEAR_ANODES();
// convert all cathodes to pullup inputs (CR1 is already in ones)
PB_DDR &= ~PB_BLANK;
PC_DDR &= ~PC_BLANK;
PD_DDR &= ~PD_BLANK;
PB_CR1 |= PB_BLANK;
PC_CR1 |= PC_BLANK;
PD_CR1 |= PD_BLANK;
// process buttons attached to A1 and cathodes
if(N_current == 1){ // first digit was lighten up, now we light second -- check buttons
// now check button states: 0 - PB4, 1 - PB5, 2 - PD1, 3..7 - PC3..PC7
buttons_state =
((PB_IDR & PB_BLANK) >> 4) |
((PD_IDR & PD_BLANK) << 1) |
(PC_IDR & PC_BLANK);
}
// switch all anodes to floating inputs
PA_DDR &= ~0x08; PA_CR1 &= ~0x08;
PD_DDR &= ~0x30; PD_CR1 &= ~0x30;
// turn off pullups of cathodes (also all outputs now will be OD)
PB_CR1 &= ~PB_BLANK;
PC_CR1 &= ~PC_BLANK;
PD_CR1 &= ~PD_BLANK;
// now set spare segments switching them to ODoutputs
if(L < 18){ // letter
PB_DDR |= PB_bits[L];
PC_DDR |= PC_bits[L];
PD_DDR |= PD_bits[L];
}
if(L & 0x80){ // DP
PC_DDR |= GPIO_PIN6;
}
switch(N_current){
case 0:
PA_DDR |= 0x08; // switch to output
PA_CR1 |= 0x08; // push-pull
PA_ODR |= 0x08;
break;
case 1:
PD_DDR |= 0x10;
PD_CR1 |= 0x10;
PD_ODR |= 0x10;
break;
case 2:
PD_DDR |= 0x20;
PD_CR1 |= 0x20;
PD_ODR |= 0x20;
break;
}
if(++N_current > 2) N_current = 0;
}
/**
* fills buffer to display
* @param str - string to display, contains "0..f" for digits, " " for space, "." for DP
* for example: " 1.22" or "h1ab" (something like "0...abc" equivalent to "0.abc"
* register independent!
* any other letter would be omitted
* if NULL - fill buffer with spaces
*/
void set_display_buf(char *str){
U8 B[3];
char ch, M = 0, i;
N_current = 0; // refresh current digit number
// empty buffer
for(i = 0; i < 3; i++)
display_buffer[i] = ' ';
if(!str) return;
i = 0;
for(;(ch = *str) && (i < 3); str++){
M = 0;
if(ch > '/' && ch < ':'){ // digit
M = '0';
}else if(ch > '`' & ch < 'g'){ // a..f
M = 'a' - 10;
}else if(ch > '@' & ch < 'G'){ // A..F
M = 'A' - 10;
}else if(ch == '-'){ // minus
M = '-' - 16;
}else if(ch == 'h'){ // hex
M = 'h' - 17;
}else if(ch == 'H'){ // hex
M = 'H' - 17;
}else if(ch == '.'){ // DP, set it to previous char
if(i == 0){ // word starts from '.' - make a space with point
B[0] = 0xff;
}else{ // set point for previous character
B[i-1] |= 0x80;
}
continue;
}else if(ch != ' '){ // bad character - continue
continue;
}
B[i] = ch - M;
i++;
}
// now make align to right
ch = 2;
for(M = i-1; M > -1; M--, ch--){
display_buffer[ch] = B[M];
}
}
/**
* convert integer value i into string and display it
* @param i - value to display, -99 <= i <= 999, if wrong, displays "---E"
*/
void display_int(int I, char voltmeter){
int rem;
U8 pos = 0; //DP position
char N = 2, sign = 0, i;
if(I < -99 || I > 999){
set_display_buf("--E");
return;
}
// prepare buffer for voltmeter's values
if(voltmeter){
for(i = 0; i < 3; i++)
display_buffer[i] = 0;
if(I>999){
I /= 10;
pos = 1; // DP is in 2nd position - voltage more than 9.99V
}
}else{
for(i = 0; i < 3; i++)
display_buffer[i] = ' ';
}
if(I == 0){ // just show zero
display_buffer[2] = 0;
return;
}
if(I < 0){
sign = 1;
I *= -1;
}
do{
rem = I % 10;
display_buffer[N] = rem;
I /= 10;
}while(--N > -1 && I);
if(sign && N > -1) display_buffer[N] = 16; // minus sign
if(voltmeter) display_buffer[pos] |= 0x80;
}
/**
* displays digital point at position i
* @param i - position to display DP, concequent calls can light up many DPs
*/
void display_DP_at_pos(U8 i){
if(i > 2) return;
display_buffer[i] |= 0x80;
}

View File

@ -0,0 +1,35 @@
/*
* led.h
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __LED_H__
#define __LED_H__
#include "stm8l.h"
extern volatile U8 buttons_state; // flags for button: 1 - pressed, 0 - not pressed
void LED_init();
void set_display_buf(char *str);
void show_next_digit();
void display_int(int i, char voltmeter);
void display_DP_at_pos(U8 i);
#endif // __LED_H__

View File

@ -0,0 +1,132 @@
/*
* main.c
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "main.h"
#include "interrupts.h"
#include "led.h"
/*
int temp;
#define PIX_SORT(a,b) { if ((a)>(b)) PIX_SWAP((a),(b)); }
#define PIX_SWAP(a,b) { temp=(a);(a)=(b);(b)=temp; }
int p[9]; // buffer for median filtering
int opt_med9(){
PIX_SORT(p[1], p[2]) ; PIX_SORT(p[4], p[5]) ; PIX_SORT(p[7], p[8]) ;
PIX_SORT(p[0], p[1]) ; PIX_SORT(p[3], p[4]) ; PIX_SORT(p[6], p[7]) ;
PIX_SORT(p[1], p[2]) ; PIX_SORT(p[4], p[5]) ; PIX_SORT(p[7], p[8]) ;
PIX_SORT(p[0], p[3]) ; PIX_SORT(p[5], p[8]) ; PIX_SORT(p[4], p[7]) ;
PIX_SORT(p[3], p[6]) ; PIX_SORT(p[1], p[4]) ; PIX_SORT(p[2], p[5]) ;
PIX_SORT(p[4], p[7]) ; PIX_SORT(p[4], p[2]) ; PIX_SORT(p[6], p[4]) ;
PIX_SORT(p[4], p[2]) ; return(p[4]) ;
}
*/
U32 Global_time = 0L; // global time in ms
// one digit emitting time
#define LED_delay 1
// pause between buttons actions
#define BTNS_delay 30
int main() {
U32 T_LED = 0L; // time of last digit update
U32 T_time = 0L; // timer
U32 T_btns = 0L; // buttons timer
U8 old_btns_state = 0;
//U8 tmpva = 0;
// int pidx = 0; // index in median buffer
// long cntrin = 0, cntrcap = 0; // counters for average
// Configure clocking
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
// Configure pins
CFG_GCR |= 1; // disable SWIM
LED_init();
CCR |= 0x28; // make shure that we are on level 3 - disabled SW priority
// Configure Timer1
// prescaler = f_{in}/f_{tim1} - 1
// set Timer1 to 1MHz: 16/1 - 1 = 15
TIM1_PSCRH = 0;
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
TIM1_ARRH = 0x03;
TIM1_ARRL = 0xE8;
// interrupts: update
TIM1_IER = TIM_IER_UIE;
// auto-reload + interrupt on overflow + enable
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
// enable all interrupts
enableInterrupts();
set_display_buf("abc");
// Loop
do {
// onse per 300ms refresh displayed value
if(((unsigned int)(Global_time - T_time) > 300) || (T_time > Global_time)){
T_time = Global_time;
// display_int((int)tmpva++,0);
// cntrin = 0;cntrcap = 0;voltagein = 0L;voltagecap = 0L;pidx = 0;
}
if((U8)(Global_time - T_LED) > LED_delay){
T_LED = Global_time;
show_next_digit();
}
if((U8)(Global_time - T_btns) > BTNS_delay){
T_btns = Global_time;
if(old_btns_state != buttons_state){
U8 pressed = old_btns_state & ~buttons_state; // pressed buttons are ones
if(pressed){ // display
//display_int(pressed, 0);
display_int(buttons_state, 0);
}else{ // some buttons released
if(buttons_state == 0xff){ // all buttons released
set_display_buf("abc");
}else{
display_int(~old_btns_state & buttons_state, 0); // released are ones
}
}
old_btns_state = buttons_state;
}
}
} while(1);
}
/*
if(ADC_ready){
// prepare data for rounded output
p[pidx] = ADC_value;
if(++pidx == 9){ // buffer is ready
if(vcap){
voltagecap += (long)(opt_med9());
cntrcap++;
ADC_CSR = 0x24; // switch to ain
vcap = 0;
}else{
voltagein += (long)(opt_med9());
cntrin++;
ADC_CSR = 0x26; // switch to vcap
vcap = 1;
}
pidx = 0;
}
ADC_ready = 0;
}
*/

View File

@ -0,0 +1,30 @@
/*
* main.h
*
* Copyright 2015 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __MAIN_H__
#define __MAIN_H__
#include "stm8l.h"
#define CONCAT(a,b) a##_##b
#define PORT(a,b) CONCAT(a,b)
#endif // __MAIN_H__

View File

@ -0,0 +1,58 @@
:2080A000808080808080808080AE5255F644241B90CE000472A90001C60003A90097C60025
:1980C00002A9009590CF0004CF0002AE52557F808080808080808080805F
:208000008200808382000000820080A0820080A1820080A2820080A3820080A4820080A57E
:20802000820080A6820080A78200000082000000820080A8820080A9820080D0820080D1F1
:20804000820080D28200000082000000820080D3820080D4820080D58200000082000000C2
:20806000820080D6820080D7820080D88200000082000000820000008200000082000000EB
:1D808300AE00012707724F00005A26F9AE003E2709D6866ED700015A26F7CC8080C8
:03808000CC80D9D8
:2080D900521D5F1F0C1F0A5F1F081F065F1F041F020F01AE50C67FAE7F60F6AA01F7CD8250
:2080F90008AE7F0AF6AA28F7AE52607FAE5261A60FF7AE5262A603F7AE5263A6E8F7AE5293
:2081190054A601F7AE5250A685F79AAE82041F0E1E0E89CD83A45B02CE000472F008C600DF
:208139000312076B1BC600021206C600056B1390CE0003C600026B10A3012C2211CE0004E2
:208159001308C600031207C600021206240A17077B136B097B106B06C60005887B0E6B1A7E
:20817900841019A101230D170B7B136B0D7B106B0ACD823AC60005887B066B17841016A115
:208199001E2395CE00041F04CE00021F027B01C100012603CC8131C600014314014D271082
:2081B900C60001974F954B0089CD84D55B032030C60001A1FF260A1E0E89CD83A45B0220FF
:2081D9001F7B016B180F171E1753C600010F1489140285979E1414954B0089CD84D55B0362
:0F81F900C600016B01CC81315B1D8161626300A7
:04866F000000000007
:20820800AE5002F6AA08F7AE5011F6AA30F7AE5003F6AA08F7AE5012F6AA30F7AE5005F671
:20822800A4CFF7AE500AF6A407F7AE500FF6A4FDF7815206AE00069FCB0009979EA900951E
:20824800F6A47F6B01AE500FF6A4CFF7AE5000F6A4F7F7AE5007F6A4CFF7AE500CF6A4078E
:20826800F7AE5011F6A4FDF7AE5008F6AA30F7AE500DF6AAF8F7AE5012F6AA02F7C6000983
:20828800A1012621AE5006F6A4304EA40F6B03AE5010F6A402481A036B04AE500BF6A4F897
:2082A8001A04C70001AE5002F6A4F7F7AE5003F6A4F7F7AE5011F6A4CFF7AE5012F6A4CFD7
:2082C800F7AE5008F6A4CFF7AE500DF6A407F7AE5012F6A4FDF77B01A1122448AE5007F662
:2082E8006B06AE000A9F1B01979EA90095F61A06AE5007F7AE500CF66B05AE001C9F1B0118
:20830800979EA90095F61A05AE500CF7AE5011F66B02AE002E9F1B01979EA90095F61A023E
:20832800AE5011F77B01482407AE500CF6AA40F7C60009A1002710C60009A1012720C6003A
:2083480009A10227302043AE5002F6AA08F7AE5003F6AA08F7AE5000F6AA08F7202CAE5089
:2083680011F6AA10F7AE5012F6AA10F7AE500FF6AA10F72015AE5011F6AA20F7AE5012F6D1
:20838800AA20F7AE500FF6AA20F7C600094CC70009A1022304725F00095B06815212725FAA
:2083A8000009AE00061F114F5F9772FB1188A620F7844CA1032FF11E152603CC84D2965CBC
:2083C8001F0F0F041615170D1E0DF66B06887B054A6B0D844D2603CC84A67B04A1032F0364
:2083E800CC84A64F957B06A12F2D0C7B06A13A2E06A63095CC848B7B06A1602C040F0B204F
:2084080004A6016B0B7B06A1672F034F2002A601140B4D2706A65795CC848B7B06A1402CCC
:20842800040F0A2004A6016B0A7B06A1472F034F2002A601140A4D2705A6379520457B0635
:20844800A12D2605A61D95203A7B06A1682605A65795202F7B06A1482605A6379520247B0D
:2084680006A12E26180D0426071E0FA6FFF720265F7B0C9772FB0FF6AA80F720197B06A129
:20848800202613905F7B04909772F90F7B068910018590F70C041E0D5C1F0DCC83D07B0CDC
:2084A8006B057B056B09A6026B067B09A1FF2D1A5F7B069772FB111F075F7B099772FB0FBB
:2084C800F61E07F70A090A0620E05B1281520A0F030F011E0DA3FF9D2F131E0DA303E72C63
:2084E800040F0A2004A6016B0A0D0A270CAE85D889CD83A45B02CC85C00D0F2729AE0006B7
:208508001F044F5F9772FB047F4CA1032FF50D0A27294B0A4B001E0F89CD861A5B041F0D32
:20852800A6016B032015AE00061F064F5F9772FB0688A620F7844CA1032FF11E0D2607AE79
:2085480000087FCC85C01E0DA300002E09A6016B011E0D501F0DAE00061F08A6026B024B81
:208568000A4B001E0F89CD85DC5B04905F7B02909772F9089F90F74B0A4B001E0F89CD8686
:208588001A5B041F0D0A027B02A1FF2C034F2002A6014D27041E0D26C60D01270D4D270A6F
:2085A8005F7B029772FB08A610F70D0F270A5F7B039772FB087999765B0A817B03A1022237
:1485C8000EAE00069F1B03979EA90095799976812D2D450005
:20867300202020003020202030101020303030101020101000103800B8A880A8B808B8A8A7
:1A86930098B038B0B898809002020002020202020202020200020000000223
:2085DC0052051E08A300002F040F012004A6016B010D0127051E085020021E081F041E0AA2
:2085FC00A300002E071E0A501F022004160A170216021E0465930D012701505B058152089E
:20861C001E0BA300002F040F052004A6016B050D0527051E0B5020021E0B1F011E0DA30000
:20863C00002F040F062004A6016B060D0627107B0E406B044F120D6B0316031707200416CB
:13865C000D170716071E01657B0518064D2701505B0881F8
:00000001FF

View File

@ -0,0 +1,89 @@
update=Пт 10 апр 2015 00:07:11
version=1
last_client=kicad
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
LastNetListRead=
PadDrlX=320
PadDimH=550
PadDimV=550
BoardThickness=620
TxtPcbV=600
TxtPcbH=600
TxtModV=500
TxtModH=500
TxtModW=100
VEgarde=100
DrawLar=120
EdgeLar=80
TxtLar=120
MSegLar=120
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=libcms
LibName7=display
LibName8=led
LibName9=dip_sockets
LibName10=pga_sockets
LibName11=valves
[general]
version=1
[eeschema]
version=1
PageLayoutDescrFile=
SubpartIdSeparator=0
SubpartFirstId=65
LibDir=/home/eddy/Docs/ELECTRONICS/STM8/voltmeters/kicad
NetFmtName=
SpiceForceRefPrefix=0
SpiceUseNetNumbers=0
RptD_X=0
RptD_Y=100
RptLab=1
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
LibName31=stm8
LibName32=ht7136
LibName33=mcp3421
LibName34=seven_segm
LibName35=stm8s003

View File

@ -0,0 +1,625 @@
EESchema Schematic File Version 2
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers
LIBS:dsp
LIBS:microchip
LIBS:analog_switches
LIBS:motorola
LIBS:texas
LIBS:intel
LIBS:audio
LIBS:interface
LIBS:digital-audio
LIBS:philips
LIBS:display
LIBS:cypress
LIBS:siliconi
LIBS:opto
LIBS:atmel
LIBS:contrib
LIBS:valves
LIBS:stm8
LIBS:3digit_voltmeter-cache
EELAYER 24 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date "16 feb 2015"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L STM8S003F3P6 IC1
U 1 1 54CCE7DB
P 5050 4600
F 0 "IC1" H 5050 5200 60 0000 C CNN
F 1 "STM8S003F3P6" H 5050 3800 60 0000 C CNN
F 2 "TSSOP20" H 4950 5100 60 0001 C CNN
F 3 "~" H 5050 4600 60 0000 C CNN
1 5050 4600
1 0 0 -1
$EndComp
$Comp
L R_PACK4 RP2
U 1 1 54CCE809
P 7200 4200
F 0 "RP2" H 7200 4650 40 0000 C CNN
F 1 "220" H 7200 4150 40 0000 C CNN
F 2 "" H 7200 4200 60 0000 C CNN
F 3 "" H 7200 4200 60 0000 C CNN
1 7200 4200
1 0 0 1
$EndComp
$Comp
L ARK-SP410361N DIS2
U 1 1 54CCF1F0
P 6550 3100
F 0 "DIS2" H 6550 3600 60 0000 C CNN
F 1 "ARK-SP410361N" H 6550 2650 60 0000 C CNN
F 2 "~" H 6300 3100 60 0000 C CNN
F 3 "~" H 6300 3100 60 0000 C CNN
1 6550 3100
1 0 0 -1
$EndComp
$Comp
L HT7136 U2
U 1 1 54CD13ED
P 3200 3050
F 0 "U2" H 3350 2854 60 0000 C CNN
F 1 "HT7136" H 3200 3250 60 0000 C CNN
F 2 "~" H 3200 3050 60 0000 C CNN
F 3 "~" H 3200 3050 60 0000 C CNN
1 3200 3050
1 0 0 -1
$EndComp
$Comp
L GND #PWR01
U 1 1 54CD1463
P 3200 3400
F 0 "#PWR01" H 3200 3400 30 0001 C CNN
F 1 "GND" H 3200 3330 30 0001 C CNN
F 2 "" H 3200 3400 60 0000 C CNN
F 3 "" H 3200 3400 60 0000 C CNN
1 3200 3400
1 0 0 -1
$EndComp
Wire Wire Line
3200 3400 3200 3300
$Comp
L C C1
U 1 1 54CD1475
P 2700 3350
F 0 "C1" H 2750 3450 50 0000 L CNN
F 1 "100n" H 2750 3250 50 0000 L CNN
F 2 "" H 2700 3350 60 0000 C CNN
F 3 "" H 2700 3350 60 0000 C CNN
1 2700 3350
1 0 0 -1
$EndComp
Wire Wire Line
2700 3150 2700 3000
$Comp
L GND #PWR02
U 1 1 54CD148D
P 2700 3650
F 0 "#PWR02" H 2700 3650 30 0001 C CNN
F 1 "GND" H 2700 3580 30 0001 C CNN
F 2 "" H 2700 3650 60 0000 C CNN
F 3 "" H 2700 3650 60 0000 C CNN
1 2700 3650
1 0 0 -1
$EndComp
Wire Wire Line
2700 3550 2700 3650
$Comp
L CP1 C2
U 1 1 54CD14C2
P 3750 3200
F 0 "C2" H 3800 3300 50 0000 L CNN
F 1 "100u" H 3800 3100 50 0000 L CNN
F 2 "" H 3750 3200 60 0000 C CNN
F 3 "" H 3750 3200 60 0000 C CNN
1 3750 3200
1 0 0 -1
$EndComp
Wire Wire Line
3600 3000 3900 3000
$Comp
L GND #PWR03
U 1 1 54CD271D
P 3750 3500
F 0 "#PWR03" H 3750 3500 30 0001 C CNN
F 1 "GND" H 3750 3430 30 0001 C CNN
F 2 "" H 3750 3500 60 0000 C CNN
F 3 "" H 3750 3500 60 0000 C CNN
1 3750 3500
1 0 0 -1
$EndComp
Wire Wire Line
3750 3400 3750 3500
Connection ~ 3750 3000
$Comp
L VCC #PWR04
U 1 1 54CD31C2
P 3900 3000
F 0 "#PWR04" H 3900 3100 30 0001 C CNN
F 1 "VCC" H 3900 3100 30 0000 C CNN
F 2 "" H 3900 3000 60 0000 C CNN
F 3 "" H 3900 3000 60 0000 C CNN
1 3900 3000
1 0 0 -1
$EndComp
$Comp
L CONN_4 P1
U 1 1 54CD436B
P 4900 2950
F 0 "P1" V 4850 2950 50 0000 C CNN
F 1 "CONN_5" V 4950 2950 50 0000 C CNN
F 2 "" H 4900 2950 60 0000 C CNN
F 3 "" H 4900 2950 60 0000 C CNN
1 4900 2950
0 1 -1 0
$EndComp
Wire Wire Line
5050 3450 5050 3300
$Comp
L R_PACK4 RP1
U 1 1 54CD4EA1
P 6950 4800
F 0 "RP1" H 6950 5250 40 0000 C CNN
F 1 "220" H 6950 4750 40 0000 C CNN
F 2 "" H 6950 4800 60 0000 C CNN
F 3 "" H 6950 4800 60 0000 C CNN
1 6950 4800
1 0 0 1
$EndComp
Text Label 7400 4350 0 60 ~ 0
G
Text Label 7400 4450 0 60 ~ 0
DP
Text Label 7150 4950 0 60 ~ 0
A
Text Label 7150 5050 0 60 ~ 0
F
Text Label 7400 4550 0 60 ~ 0
D
Text Label 7150 4850 0 60 ~ 0
E
Text Label 7400 4250 0 60 ~ 0
C
Text Label 7150 5150 0 60 ~ 0
B
Text Label 5450 3250 2 60 ~ 0
G
Text Label 5450 3050 2 60 ~ 0
DP
Text Label 7600 2950 0 60 ~ 0
A
Text Label 7600 3050 0 60 ~ 0
F
Text Label 5450 2950 2 60 ~ 0
D
Text Label 5450 2850 2 60 ~ 0
E
Text Label 5450 3150 2 60 ~ 0
C
Text Label 7600 3350 0 60 ~ 0
B
Text Label 4850 3300 3 60 ~ 0
SWIM
Text Label 4750 3300 3 60 ~ 0
RST
Text Label 7600 2850 0 60 ~ 0
A1
Text Label 7600 3150 0 60 ~ 0
A2
Text Label 7600 3250 0 60 ~ 0
A3
$Comp
L VCC #PWR05
U 1 1 54CD9F1D
P 3750 5050
F 0 "#PWR05" H 3750 5150 30 0001 C CNN
F 1 "VCC" H 3750 5150 30 0000 C CNN
F 2 "" H 3750 5050 60 0000 C CNN
F 3 "" H 3750 5050 60 0000 C CNN
1 3750 5050
0 -1 -1 0
$EndComp
$Comp
L GND #PWR06
U 1 1 54CDA116
P 3700 4850
F 0 "#PWR06" H 3700 4850 30 0001 C CNN
F 1 "GND" H 3700 4780 30 0001 C CNN
F 2 "" H 3700 4850 60 0000 C CNN
F 3 "" H 3700 4850 60 0000 C CNN
1 3700 4850
0 1 1 0
$EndComp
$Comp
L C C3
U 1 1 54CDA380
P 3600 5450
F 0 "C3" H 3600 5550 40 0000 L CNN
F 1 "0.68u" H 3606 5365 40 0000 L CNN
F 2 "" H 3638 5300 30 0000 C CNN
F 3 "" H 3600 5450 60 0000 C CNN
1 3600 5450
1 0 0 -1
$EndComp
Wire Wire Line
3600 4450 3600 5250
Wire Wire Line
3600 4950 3800 4950
$Comp
L GND #PWR07
U 1 1 54CDA4A6
P 3600 5750
F 0 "#PWR07" H 3600 5750 30 0001 C CNN
F 1 "GND" H 3600 5680 30 0001 C CNN
F 2 "" H 3600 5750 60 0000 C CNN
F 3 "" H 3600 5750 60 0000 C CNN
1 3600 5750
1 0 0 -1
$EndComp
Wire Wire Line
3600 5750 3600 5650
Text Label 3800 4350 2 60 ~ 0
A3
Text Label 3800 4250 2 60 ~ 0
A2
Wire Wire Line
3600 4450 3800 4450
Connection ~ 3600 4950
Wire Wire Line
3700 4850 3800 4850
Wire Wire Line
3750 5050 3800 5050
Wire Wire Line
2700 3000 2800 3000
Text Label 3800 4550 2 60 ~ 0
RST
Text Label 6400 4450 0 60 ~ 0
SWIM
Text Label 3800 5150 2 60 ~ 0
A1
Wire Wire Line
6400 5150 6750 5150
Wire Wire Line
6400 5050 6750 5050
Wire Wire Line
6400 4950 6750 4950
Wire Wire Line
6400 4850 6750 4850
$Comp
L CONN_2 P2
U 1 1 54E2B17F
P 1400 2950
F 0 "P2" V 1350 2950 40 0000 C CNN
F 1 "CONN_2" V 1450 2950 40 0000 C CNN
F 2 "" H 1400 2950 60 0000 C CNN
F 3 "" H 1400 2950 60 0000 C CNN
1 1400 2950
-1 0 0 1
$EndComp
$Comp
L GND #PWR08
U 1 1 54E2B1F6
P 1750 3200
F 0 "#PWR08" H 1750 3200 30 0001 C CNN
F 1 "GND" H 1750 3130 30 0001 C CNN
F 2 "" H 1750 3200 60 0000 C CNN
F 3 "" H 1750 3200 60 0000 C CNN
1 1750 3200
1 0 0 -1
$EndComp
Wire Wire Line
1750 3050 1750 3200
Text Label 1750 2850 0 60 ~ 0
VIN
Text Label 2700 3000 2 60 ~ 0
VIN
Text Label 4950 3300 3 60 ~ 0
VIN
$Comp
L GND #PWR09
U 1 1 54CD4689
P 5050 3450
F 0 "#PWR09" H 5050 3450 30 0001 C CNN
F 1 "GND" H 5050 3380 30 0001 C CNN
F 2 "" H 5050 3450 60 0000 C CNN
F 3 "" H 5050 3450 60 0000 C CNN
1 5050 3450
1 0 0 -1
$EndComp
$Comp
L R R3
U 1 1 54E2B6E2
P 2550 4450
F 0 "R3" V 2630 4450 40 0000 C CNN
F 1 "absent" V 2557 4451 40 0000 C CNN
F 2 "" V 2480 4450 30 0000 C CNN
F 3 "" H 2550 4450 30 0000 C CNN
1 2550 4450
1 0 0 -1
$EndComp
$Comp
L VCC #PWR010
U 1 1 54E2B7D6
P 2550 4100
F 0 "#PWR010" H 2550 4200 30 0001 C CNN
F 1 "VCC" H 2550 4200 30 0000 C CNN
F 2 "" H 2550 4100 60 0000 C CNN
F 3 "" H 2550 4100 60 0000 C CNN
1 2550 4100
1 0 0 -1
$EndComp
Wire Wire Line
2550 4100 2550 4200
$Comp
L R R2
U 1 1 54E2B804
P 2550 5050
F 0 "R2" V 2630 5050 40 0000 C CNN
F 1 "10k" V 2557 5051 40 0000 C CNN
F 2 "" V 2480 5050 30 0000 C CNN
F 3 "" H 2550 5050 30 0000 C CNN
1 2550 5050
1 0 0 -1
$EndComp
Wire Wire Line
2550 4800 2550 4700
$Comp
L C C4
U 1 1 54E2BAD0
P 2850 5100
F 0 "C4" H 2850 5200 40 0000 L CNN
F 1 "absent" H 2856 5015 40 0000 L CNN
F 2 "" H 2888 4950 30 0000 C CNN
F 3 "" H 2850 5100 60 0000 C CNN
1 2850 5100
1 0 0 -1
$EndComp
Text Label 6400 4250 0 60 ~ 0
AIN
Text Label 3000 4750 0 60 ~ 0
AIN
Connection ~ 2550 4750
Wire Wire Line
2550 5300 2850 5300
Wire Wire Line
2850 4900 2850 4750
Connection ~ 2850 4750
Wire Wire Line
2150 4750 3000 4750
Wire Wire Line
6400 4750 6850 4750
Wire Wire Line
6400 4650 6800 4650
Wire Wire Line
6400 4550 6750 4550
Wire Wire Line
6850 4750 6850 4550
Wire Wire Line
6850 4550 7000 4550
Wire Wire Line
6800 4650 6800 4450
Wire Wire Line
6800 4450 7000 4450
Wire Wire Line
6750 4550 6750 4350
Wire Wire Line
6750 4350 7000 4350
Wire Wire Line
6400 4450 6650 4450
Wire Wire Line
6650 4450 6650 4250
Wire Wire Line
6650 4250 7000 4250
$Comp
L R R1
U 1 1 54E2D592
P 2150 4400
F 0 "R1" V 2230 4400 40 0000 C CNN
F 1 "91k" V 2157 4401 40 0000 C CNN
F 2 "" V 2080 4400 30 0000 C CNN
F 3 "" H 2150 4400 30 0000 C CNN
1 2150 4400
1 0 0 -1
$EndComp
Wire Wire Line
2150 4750 2150 4650
Text Label 2150 4150 2 60 ~ 0
VIN
NoConn ~ 3800 4650
NoConn ~ 3800 4750
NoConn ~ 6400 4350
$Comp
L GND #PWR?
U 1 1 54E2711D
P 2700 5400
F 0 "#PWR?" H 2700 5400 30 0001 C CNN
F 1 "GND" H 2700 5330 30 0001 C CNN
F 2 "" H 2700 5400 60 0000 C CNN
F 3 "" H 2700 5400 60 0000 C CNN
1 2700 5400
1 0 0 -1
$EndComp
Wire Wire Line
2700 5400 2700 5300
Connection ~ 2700 5300
Text Notes 900 5000 0 60 ~ 0
Remove R2 & C4\nSolder R3: 4.7k\nInstead o9f R1 solder jumper
$Comp
L DS18x20 DD1
U 1 1 5526FD33
P 1050 2050
F 0 "DD1" H 1050 2500 60 0000 C CNN
F 1 "DS18x20" H 1050 2400 60 0000 C CNN
F 2 "" H 1050 2050 60 0000 C CNN
F 3 "" H 1050 2050 60 0000 C CNN
1 1050 2050
1 0 0 -1
$EndComp
Wire Wire Line
1750 2850 1750 2550
Wire Wire Line
1750 2550 1050 2550
Wire Wire Line
1050 2550 1050 2350
Wire Wire Line
1750 3150 950 3150
Wire Wire Line
950 3150 950 2350
Connection ~ 1750 3150
Wire Wire Line
1150 2350 2050 2350
$Comp
L VCC #PWR?
U 1 1 552709AA
P 2050 2350
F 0 "#PWR?" H 2050 2450 30 0001 C CNN
F 1 "VCC" H 2050 2450 30 0000 C CNN
F 2 "" H 2050 2350 60 0000 C CNN
F 3 "" H 2050 2350 60 0000 C CNN
1 2050 2350
1 0 0 -1
$EndComp
Text Notes 1600 2200 0 60 ~ 0
Solder this wire to Vcc
Text Notes 8100 4850 0 60 ~ 0
To attach keys solder wires to them directly to LED legs\nCapacitor (10nF) and resisror (47..56kOhm) solder on key
$Comp
L SW_PUSH SWN
U 1 1 552713A2
P 8400 5150
F 0 "SWN" H 8550 5260 50 0000 C CNN
F 1 "SW_PUSH" H 8400 5070 50 0000 C CNN
F 2 "" H 8400 5150 60 0000 C CNN
F 3 "" H 8400 5150 60 0000 C CNN
1 8400 5150
1 0 0 -1
$EndComp
Wire Wire Line
7150 5150 8100 5150
$Comp
L C CN
U 1 1 5527146F
P 9000 5150
F 0 "CN" H 9000 5250 40 0000 L CNN
F 1 "10n" H 9006 5065 40 0000 L CNN
F 2 "" H 9038 5000 30 0000 C CNN
F 3 "" H 9000 5150 60 0000 C CNN
1 9000 5150
0 1 1 0
$EndComp
$Comp
L R RN
U 1 1 55271518
P 8750 5400
F 0 "RN" V 8830 5400 40 0000 C CNN
F 1 "56k" V 8757 5401 40 0000 C CNN
F 2 "" V 8680 5400 30 0000 C CNN
F 3 "" H 8750 5400 30 0000 C CNN
1 8750 5400
0 1 1 0
$EndComp
Wire Wire Line
8000 5150 8000 5400
Wire Wire Line
8000 5400 8500 5400
Connection ~ 8000 5150
Wire Wire Line
8700 5150 8800 5150
$Comp
L GND #PWR?
U 1 1 552716D4
P 9450 5300
F 0 "#PWR?" H 9450 5300 30 0001 C CNN
F 1 "GND" H 9450 5230 30 0001 C CNN
F 2 "" H 9450 5300 60 0000 C CNN
F 3 "" H 9450 5300 60 0000 C CNN
1 9450 5300
1 0 0 -1
$EndComp
Wire Wire Line
9450 5300 9450 5150
Wire Wire Line
9450 5150 9200 5150
Wire Wire Line
9000 5400 9300 5400
Wire Wire Line
9300 5400 9300 5150
Connection ~ 9300 5150
$Comp
L SW_PUSH SWX
U 1 1 55283145
P 8350 3700
F 0 "SWX" H 8500 3810 50 0000 C CNN
F 1 "SW_PUSH" H 8350 3620 50 0000 C CNN
F 2 "" H 8350 3700 60 0000 C CNN
F 3 "" H 8350 3700 60 0000 C CNN
1 8350 3700
1 0 0 -1
$EndComp
$Comp
L DIODE D1
U 1 1 5528332E
P 9000 3700
F 0 "D1" H 9000 3800 40 0000 C CNN
F 1 "DIODE" H 9000 3600 40 0000 C CNN
F 2 "" H 9000 3700 60 0000 C CNN
F 3 "" H 9000 3700 60 0000 C CNN
1 9000 3700
1 0 0 -1
$EndComp
Wire Wire Line
9300 3700 9200 3700
Wire Wire Line
8650 3700 8800 3700
Text Label 9300 3700 0 60 ~ 0
A1
Wire Wire Line
7700 5150 7700 3700
Wire Wire Line
7700 3700 8050 3700
Connection ~ 7700 5150
Text Notes 8150 3450 0 60 ~ 0
Another variant of button's attaching:\nafter power off current digit we setup all segments pins\nas pullup inputs and turn current ditit's pin into 0\nif button pressed we get 0 at appropriate pin else we have 1\n\n!!! When digit is off set anode pin into input mode !!!
Wire Notes Line
8000 2800 8000 3900
Wire Notes Line
8000 3900 11050 3900
Wire Notes Line
11050 3900 11050 2800
Wire Notes Line
11050 2800 8000 2800
Wire Notes Line
7900 4500 7900 5550
Wire Notes Line
10850 4500 7900 4500
Wire Notes Line
10850 5550 10850 4500
Wire Notes Line
7900 5550 10850 5550
Text Notes 9300 3850 0 39 ~ 0
This variant lets us to connect 8 buttons to each digit!
$EndSCHEMATC

View File

@ -0,0 +1,33 @@
NAME=testproj
SDCC=sdcc
CCFLAGS=-DSTM8S003 -I../ -I../../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx -DBUTNS
LDFLAGS=-mstm8 --out-fmt-ihx -lstm8
FLASHFLAGS=-cstlinkv2 -pstm8s003
SRC=$(wildcard *.c)
OBJ=$(SRC:%.c=%.rel)
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
TRASH+=$(SRC:%.c=%.sym) $(NAME).lk $(NAME).map
INDEPENDENT_HEADERS=../stm8l.h Makefile
all: $(NAME).ihx
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
@touch $@
%.h: ;
clean:
rm -f $(TRASH)
load: $(NAME).ihx
stm8flash $(FLASHFLAGS) -w $(NAME).ihx
%.rel: %.c
$(SDCC) $(CCFLAGS) -c $<
$(NAME).ihx: $(OBJ)
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
.PHONY: all

View File

@ -0,0 +1,149 @@
/*
* interrupts.c
*
* Copyright 2015 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "stm8l.h"
#include "interrupts.h"
// Top Level Interrupt
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
// Auto Wake Up Interrupt
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
// Clock Controller Interrupt
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
// External Interrupt PORTA
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
// External Interrupt PORTB
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
// External Interrupt PORTC
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
// External Interrupt PORTD
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){}
// External Interrupt PORTE
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
#ifdef STM8S903
// External Interrupt PORTF
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
#endif // STM8S903
#if defined (STM8S208) || defined (STM8AF52Ax)
// CAN RX Interrupt routine.
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
// CAN TX Interrupt routine.
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
#endif // STM8S208 || STM8AF52Ax
// SPI Interrupt routine.
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
// Timer1 Update/Overflow/Trigger/Break Interrupt
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
if(TIM1_SR1 & TIM_SR1_UIF){ // update interrupt
Global_time++; // increase timer
}
TIM1_SR1 = 0; // clear all interrupt flags
}
// Timer1 Capture/Compare Interrupt routine.
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
#ifdef STM8S903
// Timer5 Update/Overflow/Break/Trigger Interrupt
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
// Timer5 Capture/Compare Interrupt
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
// Timer2 Update/Overflow/Break Interrupt
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){}
// Timer2 Capture/Compare Interrupt
// process soft I2C
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
}
#endif // STM8S903
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
// Timer3 Update/Overflow/Break Interrupt
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){}
// Timer3 Capture/Compare Interrupt
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
// UART1 TX Interrupt
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
// UART1 RX Interrupt
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
// I2C Interrupt
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
// UART2 TX interrupt
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
// UART2 RX interrupt
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){}
#endif // STM8S105 or STM8AF626x
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// UART3 TX interrupt
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
// UART3 RX interrupt
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// ADC2 interrupt
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
#else
// ADC1 interrupt
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
}
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#ifdef STM8S903
// Timer6 Update/Overflow/Trigger Interrupt
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
// Timer4 Update/Overflow Interrupt
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){}
#endif // STM8S903
// Eeprom EEC Interrupt
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}

View File

@ -0,0 +1,148 @@
/*
* interrupts.h
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __INTERRUPTS_H__
#define __INTERRUPTS_H__
#include "stm8l.h"
extern U8 ADC_ready; // flag: data ready
extern U32 Global_time; // global time in ms
extern int ADC_value; // value of last ADC measurement
// Top Level Interrupt
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
// Auto Wake Up Interrupt
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
// Clock Controller Interrupt
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
// External Interrupt PORTA
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
// External Interrupt PORTB
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
// External Interrupt PORTC
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
// External Interrupt PORTD
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
// External Interrupt PORTE
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
#ifdef STM8S903
// External Interrupt PORTF
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
#endif // STM8S903
#if defined (STM8S208) || defined (STM8AF52Ax)
// CAN RX Interrupt routine.
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
// CAN TX Interrupt routine.
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
#endif // STM8S208 || STM8AF52Ax
// SPI Interrupt routine.
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
// Timer1 Update/Overflow/Trigger/Break Interrupt
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
// Timer1 Capture/Compare Interrupt routine.
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
#ifdef STM8S903
// Timer5 Update/Overflow/Break/Trigger Interrupt
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
// Timer5 Capture/Compare Interrupt
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
// Timer2 Update/Overflow/Break Interrupt
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
// Timer2 Capture/Compare Interrupt
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
#endif // STM8S903
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
// Timer3 Update/Overflow/Break Interrupt
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
// Timer3 Capture/Compare Interrupt
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
// UART1 TX Interrupt
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
// UART1 RX Interrupt
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
// I2C Interrupt
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
// UART2 TX interrupt
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
// UART2 RX interrupt
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
#endif // STM8S105 or STM8AF626x
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// UART3 TX interrupt
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
// UART3 RX interrupt
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// ADC2 interrupt
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
// ADC1 interrupt
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#ifdef STM8S903
// Timer6 Update/Overflow/Trigger Interrupt
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
// Timer4 Update/Overflow Interrupt
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
#endif // STM8S903
// Eeprom EEC Interrupt
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
#endif // __INTERRUPTS_H__

View File

@ -0,0 +1,287 @@
/*
* led.c
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "stm8l.h"
#include "led.h"
/*
* bits no 7 6 5 4 3 2 1 0
* dec value 128 64 32 16 8 4 2 1
*/
/********** current variant **********/
/*
* One digit: TABLE:
* ***A*** 0 1 2 3 4 5 6 7 8 9 A B C D E F - h
* * * (F) PB4 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0
* F B (B) PB5 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1
* * * (A) PC3 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1
* ***G*** (G) PC7 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
* * * (C) PD1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0
* E C (DP)PC6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
* * * ** (D) PC5 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1
* ***D*** *DP* (E) PC4 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0
* **
*/
/*
* BUTTONS (if BUTNS defined)
* 0 - PB4, 1 - PB5, 2 - PD1, 3..7 - PC3..PC7
* or:
* 0 - F(10), 1 - B(7), 2 - C(4), 3 - A(11), 4 - E(1), 5 - D(2), 6 - DP(3), 7 - G(5)
*/
#ifdef BUTNS
volatile U8 buttons_state;
#endif
/*
* Number of digit on indicator with common anode
* digis 0..2: PA3, PD4, PD5
*/
#define CLEAR_ANODES() do{PD_ODR &= ~(0x30);PA_ODR &= ~(0x08);}while(0)
/************* arrays for ports *************/
// PB, mask: 0x30, PB4:0x10=16, PB5:0x20=32
#define PB_BLANK 0x30
static U8 PB_bits[18] = {0,16,16,16,0,32,32,16,0,0,0,32,32,16,32,32,48,32};
// PC, mask: 0xF8, PC3:0x08=8, PC4:0x10=16, PC5:0x20=32, PC6:0x40=64, PC7:0x80=128
#define PC_BLANK 0xF8
//static U8 PC_bits[18] = {128,184,0,16,56,16,0,176,0,16,32,8,128,8,0,32,56,40};
static U8 PC_bits[18] = {192,248,64,80,120,80,64,240,64,80,96,72,192,72,64,96,120,104};
// PD, mask: 0x02, PD1
static U8 PD_bits[18] = {0,0,2,0,0,0,0,0,0,0,0,0,2,0,2,2,2,0};
#define PD_BLANK 0x02
/*
********************* GPIO (page 111) ********************
* Px_ODR - Output data register bits
* Px_IDR - Pin input values
* Px_DDR - Data direction bits (1 - output)
* Px_CR1 - DDR=0: 0 - floating, 1 - pull-up input; DDR=1: 0 - pseudo-open-drain, 1 - push-pull output [not for "T"]
* Px_CR2 - DDR=0: 0/1 - EXTI disabled/enabled; DDR=1: 0/1 - 2/10MHz
*
*/
/**
* Setup for writing a letter
* @param ltr - letter (0..17 for 0..F, - or h | 0x80 for DP, any other value for 'space')
*/
void write_letter(U8 ltr){
U8 L = ltr & 0x7f;
// process buttons attached to A1 and cathodes
#ifdef BUTNS
if(PA_DDR & 0x08){ // first digit was lighten up
// convert all cathodes to pullup inputs (CR1 is already in ones)
PB_DDR &= ~PB_BLANK;
PC_DDR &= ~PC_BLANK;
PD_DDR &= ~PD_BLANK;
// and turn anode into zero
//PA_ODR &= ~0x08;
}
#endif
// first turn all off
CLEAR_ANODES();
// light up all segments
PB_ODR &= ~PB_BLANK;
PC_ODR &= ~PC_BLANK;
PD_ODR &= ~PD_BLANK;
// now clear spare segments
if(L < 18){ // letter
PB_ODR |= PB_bits[L];
PC_ODR |= PC_bits[L];
PD_ODR |= PD_bits[L];
}else{ // space - turn all OFF
PB_ODR |= PB_BLANK;
PC_ODR |= PC_BLANK;
PD_ODR |= PD_BLANK;
}
if(ltr & 0x80){ // DP
PC_ODR &= ~GPIO_PIN6;
}
#ifdef BUTNS
if(PA_DDR & 0x08){ // first digit was lighten up
// now check button states: 0 - PB4, 1 - PB5, 2 - PD1, 3..7 - PC3..PC7
buttons_state =
((PB_IDR & PB_BLANK) >> 4) |
((PD_IDR & PD_BLANK) << 1) |
(PC_IDR & PC_BLANK);
PA_DDR &= ~0x08; // switch first anode to input
// and switch cathodes to output
PB_DDR |= PB_BLANK;
PC_DDR |= PC_BLANK;
PD_DDR |= PD_BLANK;
}
#endif
}
/**
* Turn on anode power for digit N (0..2: PA3, PD4, PD5 -- A0x08, D0x10, D0x20)
* @param N - number of digit (0..2), if other - no action (display off)
* @return
*/
void light_up_digit(U8 N){
switch(N){
case 0:
#ifdef BUTNS
PA_DDR |= 0x08; // switch to output
#endif
PA_ODR |= 0x08;
break;
case 1:
PD_ODR |= 0x10;
break;
case 2:
PD_ODR |= 0x20;
break;
}
}
static U8 display_buffer[3] = {' ',' ',' '}; // blank by default
static U8 N_current = 0; // current digit to display
/**
* fills buffer to display
* @param str - string to display, contains "0..f" for digits, " " for space, "." for DP
* for example: " 1.22" or "h1ab" (something like "0...abc" equivalent to "0.abc"
* register independent!
* any other letter would be omitted
* if NULL - fill buffer with spaces
*/
void set_display_buf(char *str){
U8 B[3];
char ch, M = 0, i;
N_current = 0; // refresh current digit number
// empty buffer
for(i = 0; i < 3; i++)
display_buffer[i] = ' ';
if(!str) return;
i = 0;
for(;(ch = *str) && (i < 3); str++){
M = 0;
if(ch > '/' && ch < ':'){ // digit
M = '0';
}else if(ch > '`' & ch < 'g'){ // a..f
M = 'a' - 10;
}else if(ch > '@' & ch < 'G'){ // A..F
M = 'A' - 10;
}else if(ch == '-'){ // minus
M = '-' - 16;
}else if(ch == 'h'){ // hex
M = 'h' - 17;
}else if(ch == 'H'){ // hex
M = 'H' - 17;
}else if(ch == '.'){ // DP, set it to previous char
if(i == 0){ // word starts from '.' - make a space with point
B[0] = 0xff;
}else{ // set point for previous character
B[i-1] |= 0x80;
}
continue;
}else if(ch != ' '){ // bad character - continue
continue;
}
B[i] = ch - M;
i++;
}
// now make align to right
ch = 2;
for(M = i-1; M > -1; M--, ch--){
display_buffer[ch] = B[M];
}
}
/**
* Show Nth digit of buffer (function ran by timer)
* @param N - number of digit in buffer (0..3)
*/
void show_buf_digit(U8 N){
if(N > 2) return;
write_letter(display_buffer[N]);
light_up_digit(N);
}
/**
* Show next digit - function calls from main() by some system time value amount
*/
void show_next_digit(){
show_buf_digit(N_current++);
if(N_current > 2) N_current = 0;
}
/**
* Turn off current digit: to change display brightness
*/
void lights_off(){
U8 N;
if(N_current) N = N_current - 1;
else N = 2;
light_up_digit(N);
}
/**
* convert integer value i into string and display it
* @param i - value to display, -99 <= i <= 999, if wrong, displays "---E"
*/
void display_int(int I, char voltmeter){
int rem;
U8 pos = 0; //DP position
char N = 2, sign = 0, i;
if(I < -99 || I > 999){
set_display_buf("--E");
return;
}
// prepare buffer for voltmeter's values
if(voltmeter){
for(i = 0; i < 3; i++)
display_buffer[i] = 0;
if(I>999){
I /= 10;
pos = 1; // DP is in 2nd position - voltage more than 9.99V
}
}else{
for(i = 0; i < 3; i++)
display_buffer[i] = ' ';
}
if(I == 0){ // just show zero
display_buffer[2] = 0;
return;
}
if(I < 0){
sign = 1;
I *= -1;
}
do{
rem = I % 10;
display_buffer[N] = rem;
I /= 10;
}while(--N > -1 && I);
if(sign && N > -1) display_buffer[N] = 16; // minus sign
if(voltmeter) display_buffer[pos] |= 0x80;
}
/**
* displays digital point at position i
* @param i - position to display DP, concequent calls can light up many DPs
*/
void display_DP_at_pos(U8 i){
if(i > 2) return;
display_buffer[i] |= 0x80;
}

View File

@ -0,0 +1,47 @@
/*
* led.h
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __LED_H__
#define __LED_H__
#include "stm8l.h"
#ifdef BUTNS
extern volatile U8 buttons_state; // flags for button: 1 - pressed, 0 - not pressed
#endif
void set_display_buf(char *str);
void show_buf_digit(U8 N);
void show_next_digit();
void lights_off();
void display_int(int i, char voltmeter);
void display_DP_at_pos(U8 i);
/**
* Initialize ports
* PA3, PB4|5, PC3|4|5|6|7, PD1|4|5
*/
#define LED_init() do{ \
PA_DDR = 0x08; PB_DDR = 0x30; PC_DDR = 0xf8; PD_DDR = 0x32; \
PA_CR1 = 0x08; PB_CR1 = 0x30; PC_CR1 = 0xf8; PD_CR1 = 0x32; \
}while(0)
#endif // __LED_H__

View File

@ -0,0 +1,136 @@
/*
* main.c
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "main.h"
#include "interrupts.h"
#include "led.h"
/*
int temp;
#define PIX_SORT(a,b) { if ((a)>(b)) PIX_SWAP((a),(b)); }
#define PIX_SWAP(a,b) { temp=(a);(a)=(b);(b)=temp; }
int p[9]; // buffer for median filtering
int opt_med9(){
PIX_SORT(p[1], p[2]) ; PIX_SORT(p[4], p[5]) ; PIX_SORT(p[7], p[8]) ;
PIX_SORT(p[0], p[1]) ; PIX_SORT(p[3], p[4]) ; PIX_SORT(p[6], p[7]) ;
PIX_SORT(p[1], p[2]) ; PIX_SORT(p[4], p[5]) ; PIX_SORT(p[7], p[8]) ;
PIX_SORT(p[0], p[3]) ; PIX_SORT(p[5], p[8]) ; PIX_SORT(p[4], p[7]) ;
PIX_SORT(p[3], p[6]) ; PIX_SORT(p[1], p[4]) ; PIX_SORT(p[2], p[5]) ;
PIX_SORT(p[4], p[7]) ; PIX_SORT(p[4], p[2]) ; PIX_SORT(p[6], p[4]) ;
PIX_SORT(p[4], p[2]) ; return(p[4]) ;
}
*/
U32 Global_time = 0L; // global time in ms
// one digit emitting time
#define LED_delay 1
// pause between buttons actions
#define BTNS_delay 30
int main() {
U32 T_LED = 0L; // time of last digit update
U32 T_time = 0L; // timer
U32 T_btns = 0L; // buttons timer
U8 old_btns_state = 0;
//U8 tmpva = 0;
// int pidx = 0; // index in median buffer
// long cntrin = 0, cntrcap = 0; // counters for average
// Configure clocking
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
// Configure pins
CFG_GCR |= 1; // disable SWIM
LED_init();
CCR |= 0x28; // make shure that we are on level 3 - disabled SW priority
// Configure Timer1
// prescaler = f_{in}/f_{tim1} - 1
// set Timer1 to 1MHz: 16/1 - 1 = 15
TIM1_PSCRH = 0;
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
TIM1_ARRH = 0x03;
TIM1_ARRL = 0xE8;
// interrupts: update
TIM1_IER = TIM_IER_UIE;
// auto-reload + interrupt on overflow + enable
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
// enable all interrupts
enableInterrupts();
set_display_buf("abc");
// Loop
do {
// onse per 300ms refresh displayed value
if(((unsigned int)(Global_time - T_time) > 300) || (T_time > Global_time)){
T_time = Global_time;
// display_int((int)tmpva++,0);
// cntrin = 0;cntrcap = 0;voltagein = 0L;voltagecap = 0L;pidx = 0;
}
if((U8)(Global_time - T_LED) > LED_delay){
T_LED = Global_time;
show_next_digit();
/*if(buttons_state != old_btns_state){ // user has pressed or released any button
;
old_btns_state = buttons_state;
}*/
}
if((U8)(Global_time - T_btns) > BTNS_delay){
T_btns = Global_time;
if(old_btns_state != buttons_state){
U8 pressed = old_btns_state & ~buttons_state; // pressed buttons are ones
if(pressed){ // display
//display_int(pressed, 0);
display_int(buttons_state, 0);
}else{ // some buttons released
if(buttons_state == 0xff){ // all buttons released
set_display_buf("abc");
}else{
display_int(~old_btns_state & buttons_state, 0); // released are ones
}
old_btns_state = buttons_state;
}
}
}
} while(1);
}
/*
if(ADC_ready){
// prepare data for rounded output
p[pidx] = ADC_value;
if(++pidx == 9){ // buffer is ready
if(vcap){
voltagecap += (long)(opt_med9());
cntrcap++;
ADC_CSR = 0x24; // switch to ain
vcap = 0;
}else{
voltagein += (long)(opt_med9());
cntrin++;
ADC_CSR = 0x26; // switch to vcap
vcap = 1;
}
pidx = 0;
}
ADC_ready = 0;
}
*/

View File

@ -0,0 +1,30 @@
/*
* main.h
*
* Copyright 2015 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __MAIN_H__
#define __MAIN_H__
#include "stm8l.h"
#define CONCAT(a,b) a##_##b
#define PORT(a,b) CONCAT(a,b)
#endif // __MAIN_H__

View File

@ -0,0 +1,58 @@
:2080A000808080808080808080AE5255F644241B90CE000472A90001C60003A90097C60025
:1980C00002A9009590CF0004CF0002AE52557F808080808080808080805F
:208000008200808382000000820080A0820080A1820080A2820080A3820080A4820080A57E
:20802000820080A6820080A78200000082000000820080A8820080A9820080D0820080D1F1
:20804000820080D28200000082000000820080D3820080D4820080D58200000082000000C2
:20806000820080D6820080D7820080D88200000082000000820000008200000082000000EB
:1D808300AE00012707724F00005A26F9AE003E2709D68685D700015A26F7CC8080B1
:03808000CC80D9D8
:2080D900521D5F1F0C1F0A5F1F081F065F1F041F020F01AE50C67F72107F60AE5002A608B5
:2080F900F7AE5007A630F7AE500CA6F8F7AE5011A632F7AE5003A608F7AE5008A630F7AEFA
:20811900500DA6F8F7AE5012A632F7AE7F0AF6AA28F7AE52607FAE5261A60FF7AE5262A68B
:2081390003F7AE5263A6E8F7AE5254A601F7AE5250A685F79AAE822F1F1C1E1C89CD836D2C
:208159005B02CE000472F008C6000312076B19C600021206C600056B1790CE0003C60002B1
:208179006B14A3012C2211CE00041308C600031207C600021206240A17077B176B097B14D4
:208199006B06C60005887B0E6B14841013A101230D170B7B176B0D7B146B0ACD84BEC6007C
:2081B90005887B066B13841012A11E2395CE00041F04CE00021F027B01C100012603CC8163
:2081D9005BC600014314014D2711C60001974F954B0089CD84EC5B03CC815BC60001A1FFC7
:2081F900260A1E1C89CD836D5B02201F7B016B110F101E1053C600010F0E89140285979E45
:1A821900140E954B0089CD84EC5B03C600016B01CC815B5B1D81616263002B
:0486860000000000F0
:2082330052067B09A47F6B01AE5002F6A5082715AE5007F6A4CFF7AE500CF6A407F7AE50DC
:2082530011F6A4FDF7AE500FF6A4CFF7AE5000F6A4F7F7AE5005F6A4CFF7AE500AF6A4076D
:20827300F7AE500FF6A4FDF7AE5005F66B057B01A1122444AE00069F1B01979EA90095F681
:208293001A05AE5005F7AE500AF66B02AE00189F1B01979EA90095F61A02AE500AF7AE5044
:2082B3000FF66B04AE002A9F1B01979EA90095F61A04AE500FF720167B05AA30AE5005F78F
:2082D300AE500AF6AAF8F7AE500FF6AA02F77B09482407AE500AF6A4BFF7AE5002F69095E4
:2082F300A508273EAE5006F6A4304EA40F6B03AE5010F6A402481A036B06AE500BF6A4F801
:208313001A06C70001909EA4F7AE5002F7AE5007F6AA30F7AE500CF6AAF8F7AE5011F6AA8E
:2083330002F75B06817B03A100270E7B03A10127187B03A102271B2020AE5002F6AA08F75A
:20835300AE5000F6AA08F72010AE500FF6AA10F72007AE500FF6AA20F7815212725F003FA9
:20837300AE003C1F094F5F9772FB0988A620F7844CA1032FF11E152603CC849C965C5C1F8F
:20839300070F011615170B1E0BF66B06887B024A6B13844D2603CC84707B01A1032F03CC31
:2083B30084704F957B06A12F2D0C7B06A13A2E06A63095CC84557B06A1602C040F112004B2
:2083D300A6016B117B06A1672F034F2002A60114114D2706A65795CC84557B06A1402C042C
:2083F3000F102004A6016B107B06A1472F034F2002A60114104D2705A6379520457B06A1BC
:208413002D2605A61D95203A7B06A1682605A65795202F7B06A1482605A6379520247B06DD
:20843300A12E26180D0126071E07A6FFF720265F7B129772FB07F6AA80F720197B06A12051
:208453002613905F7B01909772F9077B068910018590F70C011E0B5C1F0BCC839A7B126B08
:20847300057B056B0FA6026B067B0FA1FF2D1A5F7B069772FB091F0D5F7B0F9772FB07F65D
:208493001E0DF70A0F0A0620E05B12817B03A1022218AE003C9F1B03979EA90095F688CDD0
:2084B3008233847B0388CD83388481C6003F95725C003F9E88CD849F84C6003FA1022304CD
:2084D300725F003F81725D003F2706C6003F4A2002A60288CD83388481520A0F030F011EF3
:2084F3000DA3FF9D2F131E0DA303E72C040F082004A6016B080D08270CAE85EF89CD836DEE
:208513005B02CC85D70D0F2729AE003C1F044F5F9772FB047F4CA1032FF50D0827294B0A47
:208533004B001E0F89CD86315B041F0DA6016B032015AE003C1F064F5F9772FB0688A620B9
:20855300F7844CA1032FF11E0D2607AE003E7FCC85D71E0DA300002E09A6016B011E0D50FF
:208573001F0DAE003C1F09A6026B024B0A4B001E0F89CD85F35B04905F7B02909772F90994
:208593009F90F74B0A4B001E0F89CD86315B041F0D0A027B02A1FF2C034F2002A6014D2759
:2085B300041E0D26C60D01270D4D270A5F7B029772FB09A610F70D0F270A5F7B039772FB09
:2085D300097999765B0A817B03A102220EAE003C9F1B03979EA90095799976812D2D4500FE
:20868A00001010100020201000000020201020203020C0F84050785040F040506048C048F0
:1A86AA004060786800000200000000000000000002000202020020202000CC
:2085F30052051E08A300002F040F012004A6016B010D0127051E085020021E081F041E0A8B
:20861300A300002E071E0A501F022004160A170216021E0465930D012701505B0581520886
:208633001E0BA300002F040F052004A6016B050D0527051E0B5020021E0B1F011E0DA300E9
:20865300002F040F062004A6016B060D0627107B0E406B044F120D6B0316031707200416B4
:138673000D170716071E01657B0518064D2701505B0881E1
:00000001FF

View File

@ -0,0 +1,100 @@
:2080A000808080808080808080AE5255F644241B90CE001A72A90001C60019A90097C600F9
:2080C00018A9009590CF001ACF0018AE52557F80808080808080AE5405F65F97CF0016AE10
:2080E0005404F65F9758585858585858589FCA0017979ECA001695CF001635010015AE5420
:0881000000F6A43FF780808027
:038B8C00000000E6
:208000008200808382000000820080A0820080A1820080A2820080A3820080A4820080A57E
:20802000820080A6820080A78200000082000000820080A8820080A9820080D0820080D1F1
:20804000820080D28200000082000000820080D3820080D4820080D58200000082000000C2
:20806000820080D6820081068200810782000000820000008200000082000000820000008B
:1D808300AE00142707724F00005A26F9AE00422709D68B8BD700145A26F7CC80807C
:03808000CC83634B
:208108005238AE00031F051E055C5C1F011E01FE160572A900041703160390FE171D131D81
:208128002D0FCF00011E01161DFF1E0390CE0001FF1E051C00081F1B1E1BFE160572A9006D
:208148000A1723162390FE172113212D0FCF00011E1B1621FF1E2390CE0001FF1E051C0047
:208168000E1F1F1E1FFE160572A900101719161990FE171713172D0FCF00011E1F1617FF70
:208188001E1990CE0001FF1E05FE160190FE171513152D0FCF00011E051615FF1E0190CE52
:2081A8000001FF1E051C00061F131E13FE161B90FE171113112D0FCF00011E131611FF1E85
:2081C8001B90CE0001FF1E051C000C1F0F1E0FFE161F90FE170D130D2D0FCF00011E0F1624
:2081E8000DFF1E1F90CE0001FF1E01FE160390FE170B130B2D0FCF00011E01160BFF1E0360
:2082080090CE0001FF1E1BFE162390FE170913092D0FCF00011E1B1609FF1E2390CE0001BB
:20822800FF1E1FFE161990FE170713072D0FCF00011E1F1607FF1E1990CE0001FF1E05FEEC
:20824800161390FE173713372D0FCF00011E051637FF1E1390CE0001FF1E23FE161990FEC1
:20826800173513352D0FCF00011E231635FF1E1990CE0001FF1E1BFE161F90FE17331333AC
:208288002D0FCF00011E1B1633FF1E1F90CE0001FF1E13FE160F90FE173113312D0FCF0035
:2082A800011E131631FF1E0F90CE0001FF1E01FE161B90FE172F132F2D0FCF00011E01160E
:2082C8002FFF1E1B90CE0001FF1E03FE162390FE172D132D2D0FCF00011E03162DFF1E23B7
:2082E80090CE0001FF1E1BFE161F90FE172B132B2D0FCF00011E1B162BFF1E1F90CE00017D
:20830800FF1E1BFE160390FE172913292D0FCF00011E1B1629FF1E0390CE0001FF1E0FFECF
:20832800161B90FE172713272D0FCF00011E0F1627FF1E1B90CE0001FF1E1BFE160390FE14
:20834800172513252D0FCF00011E1B1625FF1E0390CE0001FF1E1BFE5B388152215F1F0D5A
:208368001F0B5F1F091F075F1F055F1F201F1E5F1F031F01AE50C67F72107F60AE5002A6D5
:208388000AF7AE5007A630F7AE500CA6F8F7AE5011A652F7AE5003A60AF7AE5008A630F7EA
:2083A800AE500DA6F8F7AE5012A652F7AE7F0AF6AA28F7AE52607FAE5261A60FF7AE5262D2
:2083C800A603F7AE5263A6E8F7AE5254A601F7AE5250A685F7AE5400A623F7AE5407A60830
:2083E800F7AE5402A608F7AE5401A673F7AE5401A673F79AAE84FC89CD85DE5B02CE001AE9
:2084080072F009C6001912086B1BC600181207A3012C2211CE001A1309C600191208C600AD
:208428001812072449CE001A1F09CE00181F071E03891E03891E24891E2489CD883D5B089B
:208448008990894BE44B0C5F89CD89CE5B08A60A4D27069057564A26FA4B0189CD875E5BCA
:20846800035F1F031F015F1F201F1E5F1F05C6001B887B0F6B1A841019A1012203CC8405B1
:20848800725D0015275BAE00031F171E055872FB1790CE0016FF1E055C1F051E05A30009A3
:2084A800263BCD81089F905F5D2A02905A9772FB20909F191F6B14909E191E1F206B1E7B4A
:2084C800146B1F1E031C00017B02A9006B107B01A9001F036B017B106B025F1F05725F0018
:1984E80015CE001A1F0DCE00181F0BCD8730CC84055B21812045302000B7
:048B8F0000000000E2
:2085010052047B07A47F6B01AE500FF6A4ADF7AE5000F6A4F7F7AE5000F6A4FDF7AE500593
:20852100F6A4CFF7AE500AF6A407F7AE5000F66B047B01A1122444AE001C9F1B01979EA9DD
:208541000095F61A04AE5000F7AE5005F66B03AE002E9F1B01979EA90095F61A03AE5005F5
:20856100F7AE500AF66B02AE00409F1B01979EA90095F61A02AE500AF720167B04AA02AE5C
:208581005000F7AE5005F6AA30F7AE500AF6AAF8F77B07482407AE500AF6A4DFF75B0481E5
:2085A1007B03A10027147B03A10127177B03A102271A7B03A103271D2022AE5000F6AA0852
:2085C100F72019AE500FF6AA40F72010AE500FF6AA10F72007AE500FF6AA02F7815213727D
:2085E1005F0056AE00521F0A4F5F9772FB0A88A620F7844CA1042FF11E162603CC870E96B2
:208601001C00041F080F011616170C1E0CF66B03887B024A6B14844D2603CC86E27B01A10C
:20862100042F03CC86E24F957B03A12F2D0C7B03A13A2E06A63095CC86C77B03A1602C04A4
:208641000F122004A6016B127B03A1672F034F2002A60114124D2706A65795CC86C77B0317
:20866100A1402C040F112004A6016B117B03A1472F034F2002A60114114D2705A6379520A1
:20868100457B03A12D2605A61D95203A7B03A1682605A65795202F7B03A1482605A63795D4
:2086A10020247B03A12E26180D0126071E08A6FFF720265F7B139772FB08F6AA80F720195E
:2086C1007B03A1202613905F7B01909772F9087B038910018590F70C011E0C5C1F0CCC86E8
:2086E1000C7B136B027B026B10A6036B037B10A1FF2D1A5F7B039772FB0A1F0E5F7B109758
:2087010072FB08F61E0EF70A100A0320E05B13817B03A1032218AE00529F1B03979EA900BD
:2087210095F688CD8501847B0388CD85A18481C6005695725C00569E88CD871184C6005650
:20874100A1032304725F005681725D00562706C600564A2002A60388CD85A1848152040F3D
:20876100011E07A3FC192F071E07A3270F2D0CAE883889CD85DE5B02CC8820AE00521F0393
:208781001E03A620F70D092713A6015F9772FB0388A620F7844CA1042FF1200DA6015F97F9
:2087A10072FB037F4CA1042FF51E0726091E031C00037FCC88201E07A300002E09A6016B1C
:2087C100011E07501F07A6036B024B0A4B001E0989CD89905B04905F7B02909772F9039FB1
:2087E10090F74B0A4B001E0989CD8B375B041F070A027B02A1FF2C034F2002A6014D2704A5
:208801001E0726C60D01270D4D270A5F7B029772FB03A610F70D0927061E035C7999765B53
:1C88210004817B03A103220EAE00529F1B03979EA90095799976812D2D2D45005F
:208B93000002020200000002000000000002000002000020000020101000000000301020F6
:1B8BB3001010303028E830A0E0A020E820A0602038203070F0602020202000B7
:20883D00521E1E23A300007B22A2007B21A2002F040F112004A6016B110D1127151E2350C5
:20885D004F12226B1C4F12211F146B127B1C6B13200816231714162117121614171916123C
:20887D0017171E27A300007B26A2007B25A2002F040F162004A6016B160D16271E7B284051
:20889D006B104F12276B0F4F12266B0E4F12256B0D160F170B160D170920081627170B1619
:2088BD00251709160B170716091E078990891E1D891E1D89CD88F15B0817017B1118164DE1
:2088DD00270D504F120290974F12019095200216015B1E8152125F1F051F03A6206B027BFC
:2088FD0015484F496B0116171E1590585917171F157B036B0F1E04887B076B13840812595E
:20891D00090F1F047B126B067B0F6B030D01271A7B06AA016B0A7B056B097B046B087B03B5
:20893D006B0716091705160717031E05131B7B04121A7B031219252B160572F21B7B041216
:20895D001A6B0C7B03121917056B037B0C6B047B18AA0190977B1790957B16977B159517C0
:20897D00171F150A020D022703CC88FC1E1716155B128152051E08A300002F040F01200425
:20899D00A6016B010D0127051E085020021E081F041E0AA300002E071E0A501F02200416B9
:2089BD000A170216021E0465930D012701505B058152409096905C961C00431F051E05E618
:2089DD0003961C00471F0B1E0B1F0D1E0D1F3F1E3F88E60197844290FF72A900021E05E698
:2089FD00031E0B1F071E071F091E091F0F1E0F88E60397844290FF965C1F151E15F66B170B
:208A1D001E05F697160B90E603429F1B171E15F71E15F66B1C1E05E60197160B90E6024286
:208A3D009F1B1C1E15F79096905C93FE1F1D1E05E6011E0B1F231E231F251E251F271E2772
:208A5D0088E60397844272FB1D90FF93FE1F291E05E6021E0B1F2B1E2B1F2D1E2D1F311E6D
:208A7D003188E60297844272FB2990FF16051E05E6021E0B1F331E331F351E351F371E3772
:208A9D0088E6019784429F90F71E055C1F391E05E60290971E0BE60390421E39FF160B1E45
:208ABD0005E6031E0B1F3D1E3D1F2F1E2F88F69784429F90F71E0B5C1F3B1E05E60390971D
:208ADD001E0BE60290421E3BFF1E0B1C00037F1E051C00037F965CE6036B14E6026B13E610
:208AFD00016B12F616431718164572F9131721887B13191A6B218419186B1F1621EF0216FA
:208B1D001FFFE603E602FE16491E4772F9219F1920979E191F95515B408152081E0BA3008E
:208B3D00002F040F052004A6016B050D0527051E0B5020021E0B1F011E0DA300002F040F64
:208B5D00062004A6016B060D0627107B0E406B044F120D6B03160317072004160D170716A6
:0F8B7D00071E01657B0518064D2701505B088117
:00000001FF

View File

@ -0,0 +1,107 @@
:2080A000808080808080808080AE5255F644241B90CE000E72A90001C6000DA90097C60011
:2080C0000CA9009590CF000ECF000CAE52557F808080AE5304F6A5012710A4FEAE5304F744
:1180E000C600074CC70007CD843180808080808080A6
:208000008200808382000000820080A0820080A1820080A2820080A3820080A4820080A57E
:20802000820080A6820080A78200000082000000820080A8820080A9820080D0820080D1F1
:20804000820080D28200000082000000820080EB820080EC820080ED82000000820000007A
:20806000820080EE820080EF820080F08200000082000000820000008200000082000000A3
:1D808300AE000B2707724F00005A26F9AE004A2709D68C38D7000B5A26F7CC8080D8
:03808000CC81B4FC
:2080F10088AE5064A6AEF7AE5064A656F7AE505FF6A50826034F20280F017B01110824104C
:2081110016045F7B019772FB06F690F70C0120EAAE505FF6A50427F8A4F7AE505FF7A6010A
:208131005B0181520C965C90AE1234FF965C1F0B1E0B5C5C6F0390AE008CEF017F1E0B1C91
:20815100000690AED3F8EF0290AE0001FFCE0010FEA31234273A160BCE00104B0A908989B4
:20817100CD80F15B054D2716CE0010E6059097E6049095EE0290CF0003CF0001202235E747
:20819100000435030003725F0002725F00012010725F0004725F0003725F0002725F00016C
:2081B1005B0C8152275F1F031F015F1F081F065F1F261F240F05AE50C67F72107F60AE5064
:2081D10002A60EF7AE5007A630F7AE500CA678F7AE5011A63CF7AE5003A60EF7AE5008A6B0
:2081F10030F7AE500DA678F7AE5012A63CF7AE7F0AF6AA28F7AE52607FAE5261A60FF7AEAE
:208211005262A603F7AE5263A6E8F7AE5254A601F7AE5250A685F7CD8134CD83564B1C4BD3
:20823100D0CD83C95B029AAE834A89CD87035B02CE000E72F008C6000D12076B21C6000C05
:208251001206A3012C2211CE000E1308C6000D1207C6000C12062444CE000E1F08CE000CE0
:208271001F06C60013A102260BAE835089CD87035B0220287B056B1F0F1E5F161E908989A9
:208291001E2A891E2A89CD8AA85B084B01899089CD88815B050F055F1F261F24C6000F884D
:2082B1007B056B1C84101BA1012203CC8241C60013A1042658C6000BA480974F950F180FFF
:2082D100175D26491E17264590CE0009C60008974F9590CF000ACF0008C6000B97C6000AE2
:2082F10095C60009A4036B144F887B156B118472FB26887B1119266B0D8419241F266B2489
:208311007B0C6B257B054C6B0A7B0A6B05CE000E1F03CE000C1F01CD8853C60013A10226BD
:208331000C4B1C4BD0CD83C95B02CC82414BD0CD840684CC82415B27812D2D2D2D2D002010
:05835100454545200038
:068C3900000000004000F5
:20835600AE5011F6AA02F77217500C7217500DAE530E7FAE5303A601F7AE5300F6AA84F748
:20837600AE530F7FAE5310A60AF78152027B050F01AE530FF77B06954F979EAE5310F75B37
:20839600028135010013725F0012725F0007725F0019725F0018725F0017725F0016725FCD
:2083B600000B725F000A725F0009725F00087210530081725D00122707AE5300F644240446
:2083D600A601202B7B03A4FE6B035F7B039758585858585858585D26070D0426034F20029E
:2083F600A60197494FA20095CF0005CD83984F81725D00122707AE5300F6442404A6012095
:20841600197B03AA016B035F7B03975858585858585858CF0005CD83984F815206725D00AF
:2084360012271572115300AE500FF6AA02F7AE500AF6AA80F7CC861BC6000744446B020D01
:2084560002262BC60007A1012709C60007A103270B2010AE500AF6A47FF72007AE500FF6FF
:20847600A4FDF7725F001535800014CC861B7B026B050F041E045A4B094B0089CD8BFB5BE0
:2084960004C60007A4036B017B01A1002606A6016B0620020F067B01A1012606A6016B03EB
:2084B60020020F039FA108264F7B02A1092604A60120014F0D0626070D032621CC85FBAEBC
:2084D600500A88F695844D270A9EAA80AE500AF7CC85FB9EA47FAE500AF7CC85FB4D260382
:2084F600CC85FBAE500AF6482503CC85FB3501001235020013CC861BCE0014262ECE001845
:208516002629CE001626240D032720AE500AF6AA80F7350100124F95C60005A401975D279B
:2085360006350400132004350300130D012654CE00142603CC85FBC60015C4000695C60085
:2085560014C40005975D27047217500ACE001454CF0014A300802703CC85FB4F95C60005C5
:20857600A401975D2603CC85FB725F0015725F001435400019725F0018725F0017725F00DC
:208596001620620D03275ECE001426594F95C60005A401975D274E90CE001872A20001C629
:2085B6000017A20097C60016A2009590CF0018CF001690CE000ACE000890585990CF000AFE
:2085D600CF0008AE500BF648241BC6000BAA019097C6000A9095C6000997C600089590CF68
:2085F600000ACF00080D0626087B01A103270B2014AE500FF6AA02F7200B7217500AAE500B
:088616000FF6A4FDF75B0681DD
:088C3F0001010000000000002B
:20861E0052047B07A47F6B01AE500FF6A4C3F7AE5000F6A4F7F7AE5000F6A4F9F7AE500563
:20863E00F6A4CFF7AE500AF6A487F7AE5000F66B027B01A1122444AE001A9F1B01979EA943
:20865E000095F61A02AE5000F7AE5005F66B04AE002C9F1B01979EA90095F61A04AE5005D9
:20867E00F7AE500AF66B03AE003E9F1B01979EA90095F61A03AE500AF720167B02AA06AE3C
:20869E005000F7AE5005F6AA30F7AE500AF6AA78F77B07482407AE5000F6A4FDF75B048133
:2086BE007B03A104223E5F7B039758DE86CDFC86D786E086E986F286FBAE500FF6AA10F741
:2086DE002022AE500FF6AA20F72019AE5000F6AA08F72010AE500FF6AA04F72007AE500F94
:2086FE00F6AA08F7815214725F0055AE00501F0D4F5F9772FB0D88A620F7844CA1052FF1EC
:20871E001E172603CC8831965C1F130F06161717111E11F66B08887B074A6B11844D260368
:20873E00CC88057B06A1052F03CC88054F957B08A12F2D0C7B08A13A2E06A63095CC87EA66
:20875E007B08A1602C040F0F2004A6016B0F7B08A1672F034F2002A601140F4D2706A65775
:20877E0095CC87EA7B08A1402C040F0C2004A6016B0C7B08A1472F034F2002A601140C4DF6
:20879E002705A6379520457B08A12D2605A61D95203A7B08A1682605A65795202F7B08A1CE
:2087BE00482605A6379520247B08A12E26180D0626071E13A6FFF720265F7B109772FB138E
:2087DE00F6AA80F720197B08A1202613905F7B06909772F9137B088910018590F70C061E40
:2087FE00115C1F11CC872F7B106B077B076B0BA6046B087B0BA1FF2D1A5F7B089772FB0DCA
:20881E001F095F7B0B9772FB13F61E09F70A0B0A0820E05B14817B03A1042218AE00509FF1
:20883E001B03979EA90095F688CD861E847B0388CD86BE8481C6005595725C00559E88CD34
:20885E00883484C60055A1042304725F005581725D00552706C600554A2002A60488CD86CF
:20887E00BE8481520A0F065F1F091E0FA3D8F17B0EA2FF7B0DA2FF2F0EAE869F130FA6015A
:20889E00120E4F120D2E0CAE897A89CD87035B02CC89620D112705AE89801F091E0989CDA7
:2088BE0087035B021E0F260B1E0D2607AE00547FCC89621E0FA300007B0EA2007B0DA200A0
:2088DE002E14A6016B06160F90504F120E974F120D95170F1F0DAE00501F07A6046B014B3B
:2088FE000A5F894B001E13891E1389CD89865B081F045F7B019772FB077B05F74B0A5F89AD
:20891E004B001E13891E1389CD8AA85B081F0F170D0A017B01A1FF2C034F2002A6014D27E4
:20893E00081E0F26BA1E0D26B60D06270D4D270A5F7B019772FB07A610F70D1127061E0735
:20895E005C7999765B0A817B03A104220EAE00509F1B03979EA90095799976812D2D2D2DF1
:08897E004500203030303000CC
:208C4700060602020202020602020202060202020202000010000020200000000020300039
:1C8C670030303020007820285808003800081040006000107850202020202000B9
:20898600521D1E22A300007B21A2007B20A2002F040F0D2004A6016B0D0D0D27151E22508C
:2089A6004F12216B1B4F12201F186B167B1B6B1720081622171816201716161817141616E1
:2089C60017121E26A300007B25A2007B24A2002E1E7B27406B114F12266B104F12256B0F52
:2089E6004F12246B0E1610170B160E170920081626170B16241709160B170716091E0789FB
:208A060090891E18891E1889CD8A2B5B0817010D0D270D504F120290974F120190952002EB
:208A260016015B1D8152040F020F017B0B484F494D262E160D1E0B905859170D1F0B1E09A0
:208A4600130D7B08120C7B07120B240D160D1E0B549056170D1F0B20080C017B016B02206D
:208A6600CA7B026B041E09130D7B08120C7B07120B2513160972F20D7B08120C977B07121F
:208A86000B9517091F07160D1E0B549056170D1F0B7B046B030A040D0326CA1E0916075B7C
:208AA6000481521E1E23A300007B22A2007B21A2002F040F112004A6016B110D1127151E48
:208AC60023504F12226B1C4F12211F146B127B1C6B13200816231714162117121614171986
:208AE600161217171E27A300007B26A2007B25A2002F040F162004A6016B160D16271E7B26
:208B060028406B104F12276B0F4F12266B0E4F12256B0D160F170B160D1709200816271766
:208B26000B16251709160B170716091E078990891E1D891E1D89CD8B5C5B0817017B111849
:208B4600164D270D504F120290974F12019095200216015B1E8152125F1F051F03A6206BAA
:208B6600027B15484F496B0116171E1590585917171F157B036B0F1E04887B076B138408E0
:208B86001259090F1F047B126B067B0F6B030D01271A7B06AA016B0A7B056B097B046B085D
:208BA6007B036B0716091705160717031E05131B7B04121A7B031219252B160572F21B7B43
:208BC60004121A6B0C7B03121917056B037B0C6B047B18AA0190977B1790957B16977B15EB
:208BE6009517171F150A020D022703CC8B671E1716155B128152051E08A300002F040F01C4
:208C06002004A6016B010D0127051E085020021E081F041E0AA300002E071E0A501F022043
:138C260004160A170216021E0465930D012701505B058165
:00000001FF