commit b34bb297544ccf88682cf951526e59ac7470e770 parent bc6cbf59b727923f884167b262002bdce3d852f4 Author: Christos Margiolis <christos@margiolis.net> Date: Sat, 22 Jan 2022 00:01:40 +0200 finally something interesting Diffstat:
A | c_embedded/schem/fp-info-cache | | | 1 | + |
A | c_embedded/schem/layout.kicad_wks | | | 18 | ++++++++++++++++++ |
A | c_embedded/schem/pic-cache.lib | | | 277 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | c_embedded/schem/pic.kicad_pcb | | | 1 | + |
A | c_embedded/schem/pic.pro | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | c_embedded/schem/pic.sch | | | 367 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | c_embedded/schem/pic.sch-bak | | | 367 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | c_embedded/schem/schem.pdf | | | 0 | |
A | c_embedded/src/Makefile | | | 7 | +++++++ |
A | c_embedded/src/main.c | | | 33 | +++++++++++++++++++++++++++++++++ |
10 files changed, 1114 insertions(+), 0 deletions(-)
diff --git a/c_embedded/schem/fp-info-cache b/c_embedded/schem/fp-info-cache @@ -0,0 +1 @@ +0 diff --git a/c_embedded/schem/layout.kicad_wks b/c_embedded/schem/layout.kicad_wks @@ -0,0 +1,18 @@ +(page_layout + (setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15) + (left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10)) + (rect (name rect1:Rect) (start 0 0 ltcorner) (end 0 0) (repeat 2) (incrx 2) (incry 2)) + (line (name segm1:Line) (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50)) + (tbtext 1 (name text1:Text) (pos 25 1 ltcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50)) + (line (name segm2:Line) (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50)) + (tbtext 1 (name text2:Text) (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50)) + (line (name segm3:Line) (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50)) + (tbtext A (name text3:Text) (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50)) + (line (name segm4:Line) (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50)) + (tbtext A (name text4:Text) (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50)) + (tbtext %Y (name text5:Text) (pos 109 20) (font bold)) + (tbtext %C0 (name text6:Text) (pos 109 23)) + (tbtext %C1 (name text7:Text) (pos 109 26)) + (tbtext %C2 (name text8:Text) (pos 109 29)) + (tbtext %C3 (name text9:Text) (pos 109 32)) +) diff --git a/c_embedded/schem/pic-cache.lib b/c_embedded/schem/pic-cache.lib @@ -0,0 +1,277 @@ +EESchema-LIBRARY Version 2.4 +#encoding utf-8 +# +# Device_C_Small +# +DEF Device_C_Small C 0 10 N N 1 F N +F0 "C" 10 70 50 H V L CNN +F1 "Device_C_Small" 10 -80 50 H V L CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + C_* +$ENDFPLIST +DRAW +P 2 0 1 13 -60 -20 60 -20 N +P 2 0 1 12 -60 20 60 20 N +X ~ 1 0 100 80 D 50 50 1 1 P +X ~ 2 0 -100 80 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# Device_Crystal +# +DEF Device_Crystal Y 0 40 N N 1 F N +F0 "Y" 0 150 50 H V C CNN +F1 "Device_Crystal" 0 -150 50 H V C CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + Crystal* +$ENDFPLIST +DRAW +S -45 100 45 -100 0 1 12 N +P 2 0 1 0 -100 0 -75 0 N +P 2 0 1 20 -75 -50 -75 50 N +P 2 0 1 20 75 -50 75 50 N +P 2 0 1 0 100 0 75 0 N +X 1 1 -150 0 50 R 50 50 1 1 P +X 2 2 150 0 50 L 50 50 1 1 P +ENDDRAW +ENDDEF +# +# Device_LED +# +DEF Device_LED D 0 40 N N 1 F N +F0 "D" 0 100 50 H V C CNN +F1 "Device_LED" 0 -100 50 H V C CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + LED* + LED_SMD:* + LED_THT:* +$ENDFPLIST +DRAW +P 2 0 1 10 -50 -50 -50 50 N +P 2 0 1 0 -50 0 50 0 N +P 4 0 1 10 50 -50 50 50 -50 0 50 -50 N +P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N +P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N +X K 1 -150 0 100 R 50 50 1 1 P +X A 2 150 0 100 L 50 50 1 1 P +ENDDRAW +ENDDEF +# +# Device_R_POT_US +# +DEF Device_R_POT_US RV 0 40 Y N 1 F N +F0 "RV" -175 0 50 V V C CNN +F1 "Device_R_POT_US" -100 0 50 V V C CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + Potentiometer* +$ENDFPLIST +DRAW +P 2 0 1 0 0 -90 0 -100 N +P 2 0 1 0 0 100 0 90 N +P 2 0 1 0 100 0 60 0 N +P 4 0 1 0 45 0 90 20 90 -20 45 0 F +P 5 0 1 0 0 -30 40 -45 0 -60 -40 -75 0 -90 N +P 5 0 1 0 0 30 40 15 0 0 -40 -15 0 -30 N +P 5 0 1 0 0 90 40 75 0 60 -40 45 0 30 N +X 1 1 0 150 50 D 50 50 1 1 P +X 2 2 150 0 50 L 50 50 1 1 P +X 3 3 0 -150 50 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# Device_R_US +# +DEF Device_R_US R 0 0 N Y 1 F N +F0 "R" 100 0 50 V V C CNN +F1 "Device_R_US" -100 0 50 V V C CNN +F2 "" 40 -10 50 V I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + R_* +$ENDFPLIST +DRAW +P 2 0 1 0 0 -90 0 -100 N +P 2 0 1 0 0 90 0 100 N +P 5 0 1 0 0 -30 40 -45 0 -60 -40 -75 0 -90 N +P 5 0 1 0 0 30 40 15 0 0 -40 -15 0 -30 N +P 5 0 1 0 0 90 40 75 0 60 -40 45 0 30 N +X ~ 1 0 150 50 D 50 50 1 1 P +X ~ 2 0 -150 50 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# Display_Character_NHD-0420H1Z +# +DEF Display_Character_NHD-0420H1Z U 0 20 Y Y 1 F N +F0 "U" -250 750 50 H V C CNN +F1 "Display_Character_NHD-0420H1Z" 200 750 50 H V L CNN +F2 "Display:NHD-0420H1Z" 0 -900 50 H I C CNN +F3 "" 100 -100 50 H I C CNN +$FPLIST + NHD*0420H1Z* +$ENDFPLIST +DRAW +S -300 700 300 -700 0 1 10 f +X VSS 1 0 -800 100 U 50 50 1 1 W +X DB3 10 -400 -200 100 R 50 50 1 1 B +X DB4 11 -400 -300 100 R 50 50 1 1 B +X DB5 12 -400 -400 100 R 50 50 1 1 B +X DB6 13 -400 -500 100 R 50 50 1 1 B +X DB7 14 -400 -600 100 R 50 50 1 1 B +X A 15 400 -300 100 L 50 50 1 1 P +X K 16 400 -200 100 L 50 50 1 1 P +X VDD 2 0 800 100 D 50 50 1 1 W +X VO 3 100 800 100 D 50 50 1 1 W +X RS 4 -400 600 100 R 50 50 1 1 I +X R/W 5 -400 500 100 R 50 50 1 1 I +X E 6 -400 400 100 R 50 50 1 1 I +X DB0 7 -400 100 100 R 50 50 1 1 B +X DB1 8 -400 0 100 R 50 50 1 1 B +X DB2 9 -400 -100 100 R 50 50 1 1 B +ENDDRAW +ENDDEF +# +# MCU_Microchip_PIC16_PIC16F877A-IP +# +DEF MCU_Microchip_PIC16_PIC16F877A-IP U 0 40 Y Y 1 F N +F0 "U" 200 1400 50 H V L CNN +F1 "MCU_Microchip_PIC16_PIC16F877A-IP" 200 1300 50 H V L CNN +F2 "" 0 0 50 H I C CIN +F3 "" 0 0 50 H I C CNN +ALIAS PIC16F877A-IP +$FPLIST + DIP* + PDIP* +$ENDFPLIST +DRAW +S -750 1250 750 -1350 0 1 10 f +X ~MCLR~/Vpp 1 -900 1100 150 R 50 50 1 1 I +X RE2/~CS~/AN7 10 -900 -700 150 R 50 50 1 1 B +X VDD 11 0 1400 150 D 50 50 1 1 W +X VSS 12 0 -1500 150 U 50 50 1 1 W +X OSC1/CLKI 13 -900 800 150 R 50 50 1 1 I +X OSC2/CLKO 14 -900 600 150 R 50 50 1 1 O +X T1OSO/T1CKI/RC0 15 900 -500 150 L 50 50 1 1 B +X T1OSI/CCP2/RC1 16 900 -600 150 L 50 50 1 1 B +X CCP1/RC2 17 900 -700 150 L 50 50 1 1 B +X SCK/SCL/RC3 18 900 -800 150 L 50 50 1 1 B +X RD0/PSP0 19 -900 400 150 R 50 50 1 1 B +X AN0/RA0 2 900 1100 150 L 50 50 1 1 B +X RD1/PSP1 20 -900 300 150 R 50 50 1 1 B +X RD2/PSP2 21 -900 200 150 R 50 50 1 1 B +X RD3/PSP3 22 -900 100 150 R 50 50 1 1 B +X SDI/SDA/RC4 23 900 -900 150 L 50 50 1 1 B +X SDO/RC5 24 900 -1000 150 L 50 50 1 1 B +X CK/TX/RC6 25 900 -1100 150 L 50 50 1 1 B +X DT/RX/RC7 26 900 -1200 150 L 50 50 1 1 B +X RD4/PSP4 27 -900 0 150 R 50 50 1 1 B +X RD5/PSP5 28 -900 -100 150 R 50 50 1 1 B +X RD6/PSP6 29 -900 -200 150 R 50 50 1 1 B +X AN1/RA1 3 900 1000 150 L 50 50 1 1 B +X RD7/PSP7 30 -900 -300 150 R 50 50 1 1 B +X VSS 31 100 -1500 150 U 50 50 1 1 W +X VDD 32 100 1400 150 D 50 50 1 1 W +X INT/RB0 33 900 400 150 L 50 50 1 1 B +X RB1 34 900 300 150 L 50 50 1 1 B +X RB2 35 900 200 150 L 50 50 1 1 B +X PGM/RB3 36 900 100 150 L 50 50 1 1 B +X RB4 37 900 0 150 L 50 50 1 1 B +X RB5 38 900 -100 150 L 50 50 1 1 B +X PGC/RB6 39 900 -200 150 L 50 50 1 1 B +X CVref/Vref-/AN2/RA2 4 900 900 150 L 50 50 1 1 B +X PGD/RB7 40 900 -300 150 L 50 50 1 1 B +X Vref+/AN3/RA3 5 900 800 150 L 50 50 1 1 B +X C1OUT/T0CKI/RA4 6 900 700 150 L 50 50 1 1 B +X ~SS~/C2OUT/AN4/RA5 7 900 600 150 L 50 50 1 1 B +X RE0/~RD~/AN5 8 -900 -500 150 R 50 50 1 1 B +X RE1/~WR~/AN6 9 -900 -600 150 R 50 50 1 1 B +ENDDRAW +ENDDEF +# +# Sensor_BME280 +# +DEF Sensor_BME280 U 0 20 Y Y 1 F N +F0 "U" -350 450 50 H V C CNN +F1 "Sensor_BME280" 300 450 50 H V C CNN +F2 "Package_LGA:Bosch_LGA-8_2.5x2.5mm_P0.65mm_ClockwisePinNumbering" 1500 -450 50 H I C CNN +F3 "" 0 -200 50 H I C CNN +$FPLIST + *LGA*2.5x2.5mm*P0.65mm*Clockwise* +$ENDFPLIST +DRAW +S -400 400 400 -400 0 1 10 f +X GND 1 -100 -600 200 U 50 50 1 1 W +X CSB 2 600 -300 200 L 50 50 1 1 I +X SDI 3 600 -100 200 L 50 50 1 1 B +X SCK 4 600 100 200 L 50 50 1 1 I +X SDO 5 600 300 200 L 50 50 1 1 B +X VDDIO 6 -100 600 200 D 50 50 1 1 W +X GND 7 100 -600 200 U 50 50 1 1 W +X VDD 8 100 600 200 D 50 50 1 1 W +ENDDRAW +ENDDEF +# +# Simulation_SPICE_VDC +# +DEF Simulation_SPICE_VDC V 0 1 N Y 1 F N +F0 "V" 100 100 50 H V L CNN +F1 "Simulation_SPICE_VDC" 100 0 50 H V L CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +F4 "Y" 0 0 50 H I L CNN "Spice_Netlist_Enabled" +F5 "V" 0 0 50 H I L CNN "Spice_Primitive" +F6 "dc(1)" 100 -100 50 H V L CNN "Spice_Model" +DRAW +C 0 0 100 0 1 10 f +T 0 0 75 50 0 0 0 + Normal 0 C C +P 2 0 0 0 -50 10 50 10 N +P 2 0 0 0 -30 -10 -50 -10 N +P 2 0 0 0 10 -10 -10 -10 N +P 2 0 0 0 50 -10 30 -10 N +X ~ 1 0 200 100 D 50 50 1 1 P +X ~ 2 0 -200 100 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# Switch_SW_Push +# +DEF Switch_SW_Push SW 0 40 N N 1 F N +F0 "SW" 50 100 50 H V L CNN +F1 "Switch_SW_Push" 0 -60 50 H V C CNN +F2 "" 0 200 50 H I C CNN +F3 "" 0 200 50 H I C CNN +DRAW +C -80 0 20 0 1 0 N +C 80 0 20 0 1 0 N +P 2 0 1 0 0 50 0 120 N +P 2 0 1 0 100 50 -100 50 N +X 1 1 -200 0 100 R 50 50 0 1 P +X 2 2 200 0 100 L 50 50 0 1 P +ENDDRAW +ENDDEF +# +# power_GNDREF +# +DEF power_GNDREF #PWR 0 0 Y Y 1 F P +F0 "#PWR" 0 -250 50 H I C CNN +F1 "power_GNDREF" 0 -150 50 H V C CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +DRAW +P 2 0 1 0 -25 -75 25 -75 N +P 2 0 1 0 -5 -100 5 -100 N +P 2 0 1 0 0 -50 0 0 N +P 2 0 1 0 50 -50 -50 -50 N +X GNDREF 1 0 0 0 D 50 50 1 1 W N +ENDDRAW +ENDDEF +# +#End Library diff --git a/c_embedded/schem/pic.kicad_pcb b/c_embedded/schem/pic.kicad_pcb @@ -0,0 +1 @@ +(kicad_pcb (version 4) (host kicad "dummy file") ) diff --git a/c_embedded/schem/pic.pro b/c_embedded/schem/pic.pro @@ -0,0 +1,43 @@ +update=Fri Jan 21 13:58:09 2022 +version=1 +last_client=kicad +[general] +version=1 +RootSch= +BoardNm= +[pcbnew] +version=1 +LastNetListRead= +UseCmpFile=1 +PadDrill=0.600000000000 +PadDrillOvalY=0.600000000000 +PadSizeH=1.500000000000 +PadSizeV=1.500000000000 +PcbTextSizeV=1.500000000000 +PcbTextSizeH=1.500000000000 +PcbTextThickness=0.300000000000 +ModuleTextSizeV=1.000000000000 +ModuleTextSizeH=1.000000000000 +ModuleTextSizeThickness=0.150000000000 +SolderMaskClearance=0.000000000000 +SolderMaskMinWidth=0.000000000000 +DrawSegmentWidth=0.200000000000 +BoardOutlineThickness=0.100000000000 +ModuleOutlineThickness=0.150000000000 +[cvpcb] +version=1 +NetIExt=net +[eeschema] +version=1 +LibDir= +[eeschema/libraries] +[schematic_editor] +version=1 +PageLayoutDescrFile=layout.kicad_wks +PlotDirectoryName=/home/christos/ +SubpartIdSeparator=0 +SubpartFirstId=65 +NetFmtName= +SpiceAjustPassiveValues=0 +LabSize=50 +ERC_TestSimilarLabels=1 diff --git a/c_embedded/schem/pic.sch b/c_embedded/schem/pic.sch @@ -0,0 +1,367 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Device:LED LED1 +U 1 1 61E8F822 +P 9350 5200 +F 0 "LED1" H 9343 5325 50 0000 C CNN +F 1 "LED" H 9343 5326 50 0001 C CNN +F 2 "" H 9350 5200 50 0001 C CNN +F 3 "~" H 9350 5200 50 0001 C CNN + 1 9350 5200 + 1 0 0 -1 +$EndComp +$Comp +L Device:R_US R1 +U 1 1 61EA1FDB +P 5300 3000 +F 0 "R1" H 5368 3046 50 0000 L CNN +F 1 "10kΩ" H 5368 2955 50 0000 L CNN +F 2 "" V 5340 2990 50 0001 C CNN +F 3 "~" H 5300 3000 50 0001 C CNN + 1 5300 3000 + 0 -1 -1 0 +$EndComp +$Comp +L power:GNDREF GND +U 1 1 61EB279A +P 5450 2150 +F 0 "GND" H 5538 2113 50 0000 L CNN +F 1 "GNDREF" H 5455 1977 50 0001 C CNN +F 2 "" H 5450 2150 50 0001 C CNN +F 3 "" H 5450 2150 50 0001 C CNN + 1 5450 2150 + -1 0 0 1 +$EndComp +$Comp +L Device:R_US R2 +U 1 1 61ECA8DC +P 4100 5950 +F 0 "R2" H 4168 5996 50 0000 L CNN +F 1 "330Ω" H 4168 5905 50 0000 L CNN +F 2 "" V 4140 5940 50 0001 C CNN +F 3 "~" H 4100 5950 50 0001 C CNN + 1 4100 5950 + 1 0 0 -1 +$EndComp +$Comp +L Device:C_Small C1 +U 1 1 61E97CC0 +P 4100 3750 +F 0 "C1" H 4192 3796 50 0000 L CNN +F 1 "22pF" H 4192 3705 50 0000 L CNN +F 2 "" H 4100 3750 50 0001 C CNN +F 3 "~" H 4100 3750 50 0001 C CNN + 1 4100 3750 + -1 0 0 -1 +$EndComp +$Comp +L power:GNDREF GND +U 1 1 61EE8AF0 +P 4300 3900 +F 0 "GND" H 4388 3863 50 0000 L CNN +F 1 "GNDREF" H 4305 3727 50 0001 C CNN +F 2 "" H 4300 3900 50 0001 C CNN +F 3 "" H 4300 3900 50 0001 C CNN + 1 4300 3900 + 1 0 0 -1 +$EndComp +$Comp +L Device:C_Small C2 +U 1 1 61ECA409 +P 4500 3750 +F 0 "C2" H 4592 3796 50 0000 L CNN +F 1 "22pF" H 4592 3705 50 0000 L CNN +F 2 "" H 4500 3750 50 0001 C CNN +F 3 "~" H 4500 3750 50 0001 C CNN + 1 4500 3750 + 1 0 0 -1 +$EndComp +$Comp +L Device:Crystal OSC1 +U 1 1 61EB43E4 +P 4300 3550 +F 0 "OSC1" H 4300 3818 50 0000 C CNN +F 1 "8MHz" H 4300 3727 50 0000 C CNN +F 2 "" H 4300 3550 50 0001 C CNN +F 3 "~" H 4300 3550 50 0001 C CNN + 1 4300 3550 + 1 0 0 -1 +$EndComp +$Comp +L MCU_Microchip_PIC16:PIC16F877A-IP PIC16F877A-IP1 +U 1 1 61E8B28E +P 6550 4100 +F 0 "PIC16F877A-IP1" H 6550 5589 50 0000 C CNN +F 1 "PIC16F877A-IP" H 6550 5590 50 0001 C CNN +F 2 "" H 6550 4100 50 0001 C CIN +F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf" H 6550 4100 50 0001 C CNN + 1 6550 4100 + 1 0 0 -1 +$EndComp +Wire Wire Line + 4100 3300 4100 3550 +Wire Wire Line + 4150 3550 4100 3550 +Connection ~ 4100 3550 +Wire Wire Line + 4100 3550 4100 3650 +Wire Wire Line + 4500 3500 4500 3550 +Wire Wire Line + 4450 3550 4500 3550 +Connection ~ 4500 3550 +Wire Wire Line + 4500 3550 4500 3650 +Wire Wire Line + 4300 3900 4100 3900 +Wire Wire Line + 4100 3900 4100 3850 +Wire Wire Line + 4300 3900 4500 3900 +Wire Wire Line + 4500 3900 4500 3850 +Connection ~ 4300 3900 +$Comp +L Simulation_SPICE:VDC V1 +U 1 1 61F2BB51 +P 6000 1550 +F 0 "V1" H 6130 1596 50 0001 L CNN +F 1 "5V" H 5870 1550 50 0000 R CNN +F 2 "" H 6000 1550 50 0001 C CNN +F 3 "~" H 6000 1550 50 0001 C CNN +F 4 "Y" H 6000 1550 50 0001 L CNN "Spice_Netlist_Enabled" +F 5 "V" H 6000 1550 50 0001 L CNN "Spice_Primitive" +F 6 "dc(1)" H 6130 1459 50 0001 L CNN "Spice_Model" + 1 6000 1550 + -1 0 0 1 +$EndComp +$Comp +L power:GNDREF GND +U 1 1 61F5552B +P 6550 6300 +F 0 "GND" H 6638 6263 50 0000 L CNN +F 1 "GNDREF" H 6555 6127 50 0001 C CNN +F 2 "" H 6550 6300 50 0001 C CNN +F 3 "" H 6550 6300 50 0001 C CNN + 1 6550 6300 + 1 0 0 -1 +$EndComp +Wire Wire Line + 5450 3000 5650 3000 +Wire Wire Line + 6000 2450 6550 2450 +Wire Wire Line + 6550 2450 6550 2700 +Wire Wire Line + 5150 3000 4900 3000 +$Comp +L Switch:SW_Push RSTB1 +U 1 1 61FC0519 +P 5150 2500 +F 0 "RSTB1" H 5150 2693 50 0000 C CNN +F 1 "SW_Push" H 5150 2694 50 0001 C CNN +F 2 "" H 5150 2700 50 0001 C CNN +F 3 "~" H 5150 2700 50 0001 C CNN + 1 5150 2500 + 1 0 0 -1 +$EndComp +Wire Wire Line + 4900 2500 4950 2500 +Wire Wire Line + 4900 2500 4900 2650 +Wire Wire Line + 5450 2150 5450 2500 +Wire Wire Line + 5450 2500 5350 2500 +Wire Wire Line + 4900 2650 5850 2650 +Wire Wire Line + 5850 2650 5850 2450 +Wire Wire Line + 5850 2450 6000 2450 +Connection ~ 4900 2650 +Wire Wire Line + 4900 2650 4900 3000 +Connection ~ 6000 2450 +Wire Wire Line + 6650 2450 6550 2450 +Connection ~ 6550 2450 +$Comp +L Sensor:BME280 BME280 +U 1 1 61E953D6 +P 8600 3250 +F 0 "BME280" H 8171 3296 50 0000 R CNN +F 1 "BME280" H 8171 3205 50 0001 R CNN +F 2 "Package_LGA:Bosch_LGA-8_2.5x2.5mm_P0.65mm_ClockwisePinNumbering" H 10100 2800 50 0001 C CNN +F 3 "https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280-DS002.pdf" H 8600 3050 50 0001 C CNN + 1 8600 3250 + -1 0 0 -1 +$EndComp +Wire Wire Line + 8000 3150 7800 3150 +Wire Wire Line + 7800 3150 7800 4900 +Wire Wire Line + 6650 2700 6650 2450 +$Comp +L Display_Character:NHD-0420H1Z LCD +U 1 1 61E937A6 +P 4400 5200 +F 0 "LCD" V 4400 4356 50 0000 R CNN +F 1 "NHD-0420H1Z" H 4400 4220 50 0001 C CNN +F 2 "Display:NHD-0420H1Z" H 4400 4300 50 0001 C CNN +F 3 "http://www.newhavendisplay.com/specs/NHD-0420H1Z-FSW-GBW-33V3.pdf" H 4500 5100 50 0001 C CNN + 1 4400 5200 + 0 1 1 0 +$EndComp +Wire Wire Line + 4100 3300 5650 3300 +Wire Wire Line + 4500 3500 5650 3500 +Wire Wire Line + 5000 4800 5000 3700 +Wire Wire Line + 5000 3700 5650 3700 +Wire Wire Line + 4900 4800 4900 3800 +Wire Wire Line + 4900 3800 5650 3800 +Wire Wire Line + 4800 4800 4800 3900 +Wire Wire Line + 4800 3900 5650 3900 +Wire Wire Line + 5650 4000 4100 4000 +Wire Wire Line + 4100 4000 4100 4800 +Wire Wire Line + 5650 4100 4000 4100 +Wire Wire Line + 4000 4100 4000 4800 +Wire Wire Line + 5650 4200 3900 4200 +Wire Wire Line + 3900 4200 3900 4800 +Wire Wire Line + 5650 4300 3800 4300 +Wire Wire Line + 3800 4300 3800 4800 +Wire Wire Line + 3600 5200 3350 5200 +Wire Wire Line + 4100 5600 4100 5800 +Wire Wire Line + 6000 1950 3200 1950 +Wire Wire Line + 3200 1950 3200 6250 +Wire Wire Line + 3200 6250 4100 6250 +Wire Wire Line + 4100 6250 4100 6100 +Connection ~ 6000 1950 +Wire Wire Line + 6000 1950 6000 2450 +Wire Wire Line + 6550 5600 6550 5700 +Connection ~ 6550 5700 +Wire Wire Line + 5200 5200 5400 5200 +Wire Wire Line + 5400 5200 5400 6250 +Connection ~ 4100 6250 +Wire Wire Line + 4200 5600 4200 5700 +Wire Wire Line + 4200 5700 5050 5700 +Wire Wire Line + 4100 6250 5050 6250 +$Comp +L Device:R_POT_US POT1 +U 1 1 6208C3F4 +P 5050 5950 +F 0 "POT1" H 4983 5996 50 0000 R CNN +F 1 "10kΩ" H 4983 5905 50 0000 R CNN +F 2 "" H 5050 5950 50 0001 C CNN +F 3 "~" H 5050 5950 50 0001 C CNN + 1 5050 5950 + 1 0 0 -1 +$EndComp +Wire Wire Line + 5200 5950 5300 5950 +Wire Wire Line + 5300 5950 5300 5300 +Wire Wire Line + 5300 5300 5200 5300 +Wire Wire Line + 5050 5800 5050 5700 +Connection ~ 5050 5700 +Wire Wire Line + 5050 5700 6550 5700 +Wire Wire Line + 5050 6100 5050 6250 +Connection ~ 5050 6250 +Wire Wire Line + 5050 6250 5400 6250 +Wire Wire Line + 3350 6150 6550 6150 +Wire Wire Line + 3350 5200 3350 6150 +Connection ~ 6550 6150 +Wire Wire Line + 6550 6150 6550 6300 +Wire Wire Line + 7800 4900 7450 4900 +Wire Wire Line + 7450 5000 7900 5000 +Wire Wire Line + 7900 5000 7900 3350 +Wire Wire Line + 7900 3350 8000 3350 +Wire Wire Line + 8000 2950 7700 2950 +Wire Wire Line + 7700 2950 7700 5100 +Wire Wire Line + 7700 5100 7450 5100 +Wire Wire Line + 6000 1750 6000 1950 +Wire Wire Line + 6550 5700 6550 6150 +Wire Wire Line + 6650 5600 6650 5700 +Wire Wire Line + 6650 5700 6550 5700 +$Comp +L Switch:SW_Push BTN1 +U 1 1 620E2C06 +P 9800 5200 +F 0 "BTN1" H 9800 5393 50 0000 C CNN +F 1 "SW_Push" H 9800 5394 50 0001 C CNN +F 2 "" H 9800 5400 50 0001 C CNN +F 3 "~" H 9800 5400 50 0001 C CNN + 1 9800 5200 + 1 0 0 -1 +$EndComp +Wire Wire Line + 8500 3850 8500 6150 +Wire Wire Line + 8500 6150 6550 6150 +Wire Wire Line + 8500 2650 8500 1950 +Wire Wire Line + 8500 1950 6000 1950 +$EndSCHEMATC diff --git a/c_embedded/schem/pic.sch-bak b/c_embedded/schem/pic.sch-bak @@ -0,0 +1,367 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Device:LED LED +U 1 1 61E8F822 +P 8100 4650 +F 0 "LED" H 8093 4775 50 0000 C CNN +F 1 "LED" H 8093 4776 50 0001 C CNN +F 2 "" H 8100 4650 50 0001 C CNN +F 3 "~" H 8100 4650 50 0001 C CNN + 1 8100 4650 + 1 0 0 -1 +$EndComp +$Comp +L Device:R_US R1 +U 1 1 61EA1FDB +P 4050 2450 +F 0 "R1" H 4118 2496 50 0000 L CNN +F 1 "10kΩ" H 4118 2405 50 0000 L CNN +F 2 "" V 4090 2440 50 0001 C CNN +F 3 "~" H 4050 2450 50 0001 C CNN + 1 4050 2450 + 0 -1 -1 0 +$EndComp +$Comp +L power:GNDREF GND +U 1 1 61EB279A +P 4200 1600 +F 0 "GND" H 4288 1563 50 0000 L CNN +F 1 "GNDREF" H 4205 1427 50 0001 C CNN +F 2 "" H 4200 1600 50 0001 C CNN +F 3 "" H 4200 1600 50 0001 C CNN + 1 4200 1600 + -1 0 0 1 +$EndComp +$Comp +L Device:R_US R2 +U 1 1 61ECA8DC +P 2850 5400 +F 0 "R2" H 2918 5446 50 0000 L CNN +F 1 "330Ω" H 2918 5355 50 0000 L CNN +F 2 "" V 2890 5390 50 0001 C CNN +F 3 "~" H 2850 5400 50 0001 C CNN + 1 2850 5400 + 1 0 0 -1 +$EndComp +$Comp +L Device:C_Small C1 +U 1 1 61E97CC0 +P 2850 3200 +F 0 "C1" H 2942 3246 50 0000 L CNN +F 1 "22pF" H 2942 3155 50 0000 L CNN +F 2 "" H 2850 3200 50 0001 C CNN +F 3 "~" H 2850 3200 50 0001 C CNN + 1 2850 3200 + -1 0 0 -1 +$EndComp +$Comp +L power:GNDREF GND +U 1 1 61EE8AF0 +P 3050 3350 +F 0 "GND" H 3138 3313 50 0000 L CNN +F 1 "GNDREF" H 3055 3177 50 0001 C CNN +F 2 "" H 3050 3350 50 0001 C CNN +F 3 "" H 3050 3350 50 0001 C CNN + 1 3050 3350 + 1 0 0 -1 +$EndComp +$Comp +L Device:C_Small C2 +U 1 1 61ECA409 +P 3250 3200 +F 0 "C2" H 3342 3246 50 0000 L CNN +F 1 "22pF" H 3342 3155 50 0000 L CNN +F 2 "" H 3250 3200 50 0001 C CNN +F 3 "~" H 3250 3200 50 0001 C CNN + 1 3250 3200 + 1 0 0 -1 +$EndComp +$Comp +L Device:Crystal OSC +U 1 1 61EB43E4 +P 3050 3000 +F 0 "OSC" H 3050 3268 50 0000 C CNN +F 1 "8MHz" H 3050 3177 50 0000 C CNN +F 2 "" H 3050 3000 50 0001 C CNN +F 3 "~" H 3050 3000 50 0001 C CNN + 1 3050 3000 + 1 0 0 -1 +$EndComp +$Comp +L MCU_Microchip_PIC16:PIC16F877A-IP PIC16F877A-IP +U 1 1 61E8B28E +P 5300 3550 +F 0 "PIC16F877A-IP" H 5300 5039 50 0000 C CNN +F 1 "PIC16F877A-IP" H 5300 5040 50 0001 C CNN +F 2 "" H 5300 3550 50 0001 C CIN +F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf" H 5300 3550 50 0001 C CNN + 1 5300 3550 + 1 0 0 -1 +$EndComp +Wire Wire Line + 2850 2750 2850 3000 +Wire Wire Line + 2900 3000 2850 3000 +Connection ~ 2850 3000 +Wire Wire Line + 2850 3000 2850 3100 +Wire Wire Line + 3250 2950 3250 3000 +Wire Wire Line + 3200 3000 3250 3000 +Connection ~ 3250 3000 +Wire Wire Line + 3250 3000 3250 3100 +Wire Wire Line + 3050 3350 2850 3350 +Wire Wire Line + 2850 3350 2850 3300 +Wire Wire Line + 3050 3350 3250 3350 +Wire Wire Line + 3250 3350 3250 3300 +Connection ~ 3050 3350 +$Comp +L Simulation_SPICE:VDC V +U 1 1 61F2BB51 +P 4750 1000 +F 0 "V" H 4880 1046 50 0001 L CNN +F 1 "5V" H 4620 1000 50 0000 R CNN +F 2 "" H 4750 1000 50 0001 C CNN +F 3 "~" H 4750 1000 50 0001 C CNN +F 4 "Y" H 4750 1000 50 0001 L CNN "Spice_Netlist_Enabled" +F 5 "V" H 4750 1000 50 0001 L CNN "Spice_Primitive" +F 6 "dc(1)" H 4880 909 50 0001 L CNN "Spice_Model" + 1 4750 1000 + -1 0 0 1 +$EndComp +$Comp +L power:GNDREF GND? +U 1 1 61F5552B +P 5300 5750 +F 0 "GND?" H 5388 5713 50 0000 L CNN +F 1 "GNDREF" H 5305 5577 50 0001 C CNN +F 2 "" H 5300 5750 50 0001 C CNN +F 3 "" H 5300 5750 50 0001 C CNN + 1 5300 5750 + 1 0 0 -1 +$EndComp +Wire Wire Line + 4200 2450 4400 2450 +Wire Wire Line + 4750 1900 5300 1900 +Wire Wire Line + 5300 1900 5300 2150 +Wire Wire Line + 3900 2450 3650 2450 +$Comp +L Switch:SW_Push RSTB +U 1 1 61FC0519 +P 3900 1950 +F 0 "RSTB" H 3900 2143 50 0000 C CNN +F 1 "SW_Push" H 3900 2144 50 0001 C CNN +F 2 "" H 3900 2150 50 0001 C CNN +F 3 "~" H 3900 2150 50 0001 C CNN + 1 3900 1950 + 1 0 0 -1 +$EndComp +Wire Wire Line + 3650 1950 3700 1950 +Wire Wire Line + 3650 1950 3650 2100 +Wire Wire Line + 4200 1600 4200 1950 +Wire Wire Line + 4200 1950 4100 1950 +Wire Wire Line + 3650 2100 4600 2100 +Wire Wire Line + 4600 2100 4600 1900 +Wire Wire Line + 4600 1900 4750 1900 +Connection ~ 3650 2100 +Wire Wire Line + 3650 2100 3650 2450 +Connection ~ 4750 1900 +Wire Wire Line + 5400 1900 5300 1900 +Connection ~ 5300 1900 +$Comp +L Sensor:BME280 BME280 +U 1 1 61E953D6 +P 7350 2700 +F 0 "BME280" H 6921 2746 50 0000 R CNN +F 1 "BME280" H 6921 2655 50 0001 R CNN +F 2 "Package_LGA:Bosch_LGA-8_2.5x2.5mm_P0.65mm_ClockwisePinNumbering" H 8850 2250 50 0001 C CNN +F 3 "https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280-DS002.pdf" H 7350 2500 50 0001 C CNN + 1 7350 2700 + -1 0 0 -1 +$EndComp +Wire Wire Line + 6750 2600 6550 2600 +Wire Wire Line + 6550 2600 6550 4350 +Wire Wire Line + 5400 2150 5400 1900 +$Comp +L Display_Character:NHD-0420H1Z LCD +U 1 1 61E937A6 +P 3150 4650 +F 0 "LCD" V 3150 3806 50 0000 R CNN +F 1 "NHD-0420H1Z" H 3150 3670 50 0001 C CNN +F 2 "Display:NHD-0420H1Z" H 3150 3750 50 0001 C CNN +F 3 "http://www.newhavendisplay.com/specs/NHD-0420H1Z-FSW-GBW-33V3.pdf" H 3250 4550 50 0001 C CNN + 1 3150 4650 + 0 1 1 0 +$EndComp +Wire Wire Line + 2850 2750 4400 2750 +Wire Wire Line + 3250 2950 4400 2950 +Wire Wire Line + 3750 4250 3750 3150 +Wire Wire Line + 3750 3150 4400 3150 +Wire Wire Line + 3650 4250 3650 3250 +Wire Wire Line + 3650 3250 4400 3250 +Wire Wire Line + 3550 4250 3550 3350 +Wire Wire Line + 3550 3350 4400 3350 +Wire Wire Line + 4400 3450 2850 3450 +Wire Wire Line + 2850 3450 2850 4250 +Wire Wire Line + 4400 3550 2750 3550 +Wire Wire Line + 2750 3550 2750 4250 +Wire Wire Line + 4400 3650 2650 3650 +Wire Wire Line + 2650 3650 2650 4250 +Wire Wire Line + 4400 3750 2550 3750 +Wire Wire Line + 2550 3750 2550 4250 +Wire Wire Line + 2350 4650 2100 4650 +Wire Wire Line + 2850 5050 2850 5250 +Wire Wire Line + 4750 1400 1950 1400 +Wire Wire Line + 1950 1400 1950 5700 +Wire Wire Line + 1950 5700 2850 5700 +Wire Wire Line + 2850 5700 2850 5550 +Connection ~ 4750 1400 +Wire Wire Line + 4750 1400 4750 1900 +Wire Wire Line + 5300 5050 5300 5150 +Connection ~ 5300 5150 +Wire Wire Line + 3950 4650 4150 4650 +Wire Wire Line + 4150 4650 4150 5700 +Connection ~ 2850 5700 +Wire Wire Line + 2950 5050 2950 5150 +Wire Wire Line + 2950 5150 3800 5150 +Wire Wire Line + 2850 5700 3800 5700 +$Comp +L Device:R_POT_US POT +U 1 1 6208C3F4 +P 3800 5400 +F 0 "POT" H 3733 5446 50 0000 R CNN +F 1 "10kΩ" H 3733 5355 50 0000 R CNN +F 2 "" H 3800 5400 50 0001 C CNN +F 3 "~" H 3800 5400 50 0001 C CNN + 1 3800 5400 + 1 0 0 -1 +$EndComp +Wire Wire Line + 3950 5400 4050 5400 +Wire Wire Line + 4050 5400 4050 4750 +Wire Wire Line + 4050 4750 3950 4750 +Wire Wire Line + 3800 5250 3800 5150 +Connection ~ 3800 5150 +Wire Wire Line + 3800 5150 5300 5150 +Wire Wire Line + 3800 5550 3800 5700 +Connection ~ 3800 5700 +Wire Wire Line + 3800 5700 4150 5700 +Wire Wire Line + 2100 5600 5300 5600 +Wire Wire Line + 2100 4650 2100 5600 +Connection ~ 5300 5600 +Wire Wire Line + 5300 5600 5300 5750 +Wire Wire Line + 6550 4350 6200 4350 +Wire Wire Line + 6200 4450 6650 4450 +Wire Wire Line + 6650 4450 6650 2800 +Wire Wire Line + 6650 2800 6750 2800 +Wire Wire Line + 6750 2400 6450 2400 +Wire Wire Line + 6450 2400 6450 4550 +Wire Wire Line + 6450 4550 6200 4550 +Wire Wire Line + 4750 1200 4750 1400 +Wire Wire Line + 5300 5150 5300 5600 +Wire Wire Line + 5400 5050 5400 5150 +Wire Wire Line + 5400 5150 5300 5150 +$Comp +L Switch:SW_Push BTN +U 1 1 620E2C06 +P 8550 4650 +F 0 "BTN" H 8550 4843 50 0000 C CNN +F 1 "SW_Push" H 8550 4844 50 0001 C CNN +F 2 "" H 8550 4850 50 0001 C CNN +F 3 "~" H 8550 4850 50 0001 C CNN + 1 8550 4650 + 1 0 0 -1 +$EndComp +Wire Wire Line + 7250 3300 7250 5600 +Wire Wire Line + 7250 5600 5300 5600 +Wire Wire Line + 7250 2100 7250 1400 +Wire Wire Line + 7250 1400 4750 1400 +$EndSCHEMATC diff --git a/c_embedded/schem/schem.pdf b/c_embedded/schem/schem.pdf Binary files differ. diff --git a/c_embedded/src/Makefile b/c_embedded/src/Makefile @@ -0,0 +1,7 @@ +all: + sdcc --use-non-free -mpic14 -p16f877a main.c + pk2cmd -P PIC16F877A -E + pk2cmd -P PIC16F877A -X -M -F main.hex + +clean: + rm -f *.asm *.cod *.hex *.lst *.o diff --git a/c_embedded/src/main.c b/c_embedded/src/main.c @@ -0,0 +1,33 @@ +#define NO_BIT_DEFINES +#include <pic14regs.h> +#include <stdint.h> + +static __code uint16_t __at (_CONFIG) __configword = + _FOSC_HS & _WDTE_OFF & _LVP_OFF & _WRT_OFF & _BOREN_OFF; + +#define LED_PORT PORTBbits.RB0 +#define LED_TRIS TRISBbits.TRISB0 + +#define _XTAL_FREQ 16000000 + +void +delay(uint16_t iter) +{ + uint16_t i; + + for (i = 0; i < iter; i++) + __asm nop __endasm; +} + +void main(void) +{ + LED_TRIS = 0; /* Pin as output */ + LED_PORT = 0; /* LED off */ + + while (1) { + LED_PORT = 1; /* LED on */ + delay(30000); /* ~500ms @ 4MHz */ + LED_PORT = 0; /* LED off */ + delay(30000); + } +}