@ -0,0 +1,4 @@ | |||
\relax | |||
\@writefile{toc}{\contentsline {section}{\numberline {1}Attiny Solar Energy Harvest Tests}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Micro Considerations}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Energy Storage}{1}} |
@ -0,0 +1,275 @@ | |||
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 23 MAR 2020 00:41 | |||
entering extended mode | |||
restricted \write18 enabled. | |||
%&-line parsing enabled. | |||
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/ | |||
Attiny_Solar_Energy_Harvest/docs/1.tex | |||
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/A | |||
ttiny_Solar_Energy_Harvest/docs/1.tex | |||
LaTeX2e <2017/01/01> patch level 3 | |||
Babel <3.9r> and hyphenation patterns for 3 language(s) loaded. | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||
) | |||
\c@part=\count79 | |||
\c@section=\count80 | |||
\c@subsection=\count81 | |||
\c@subsubsection=\count82 | |||
\c@paragraph=\count83 | |||
\c@subparagraph=\count84 | |||
\c@figure=\count85 | |||
\c@table=\count86 | |||
\abovecaptionskip=\skip41 | |||
\belowcaptionskip=\skip42 | |||
\bibindent=\dimen102 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||
Package: keyval 2014/10/28 v1.15 key=value parser (DPC) | |||
\KV@toks@=\toks14 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||
Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||
Package: trig 2016/01/03 v1.10 sin cos tan (DPC) | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg | |||
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration | |||
) | |||
Package graphics Info: Driver file: pdftex.def on input line 99. | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def | |||
File: pdftex.def 2017/01/12 v0.06k Graphics/color for pdfTeX | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) | |||
) | |||
\Gread@gobject=\count87 | |||
)) | |||
\Gin@req@height=\dimen103 | |||
\Gin@req@width=\dimen104 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||
Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||
Package: caption3 2016/05/22 v1.7-166 caption3 kernel (AR) | |||
Package caption3 Info: TeX engine: e-TeX on input line 67. | |||
\captionmargin=\dimen105 | |||
\captionmargin@=\dimen106 | |||
\captionwidth=\dimen107 | |||
\caption@tempdima=\dimen108 | |||
\caption@indent=\dimen109 | |||
\caption@parindent=\dimen110 | |||
\caption@hangindent=\dimen111 | |||
) | |||
\c@ContinuedFloat=\count88 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty | |||
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg | |||
File: color.cfg 2016/01/02 v1.6 sample color configuration | |||
) | |||
Package xcolor Info: Driver file: pdftex.def on input line 225. | |||
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348. | |||
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352. | |||
Package xcolor Info: Model `RGB' extended on input line 1364. | |||
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366. | |||
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367. | |||
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368. | |||
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369. | |||
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370. | |||
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty | |||
Package: geometry 2010/09/12 v5.6 Page Geometry | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||
Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty | |||
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO) | |||
Package ifvtex Info: VTeX not detected. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty | |||
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional | |||
) | |||
\Gm@cnth=\count89 | |||
\Gm@cntv=\count90 | |||
\c@Gm@tempcnt=\count91 | |||
\Gm@bindingoffset=\dimen112 | |||
\Gm@wd@mp=\dimen113 | |||
\Gm@odd@mp=\dimen114 | |||
\Gm@even@mp=\dimen115 | |||
\Gm@layoutwidth=\dimen116 | |||
\Gm@layoutheight=\dimen117 | |||
\Gm@layouthoffset=\dimen118 | |||
\Gm@layoutvoffset=\dimen119 | |||
\Gm@dimlist=\toks15 | |||
) (./1.aux) | |||
\openout1 = `1.aux'. | |||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii | |||
[Loading MPS to PDF converter (version 2006.09.02).] | |||
\scratchcounter=\count92 | |||
\scratchdimen=\dimen120 | |||
\scratchbox=\box26 | |||
\nofMPsegments=\count93 | |||
\nofMParguments=\count94 | |||
\everyMPshowfont=\toks16 | |||
\MPscratchCnt=\count95 | |||
\MPscratchDim=\dimen121 | |||
\MPnumerator=\count96 | |||
\makeMPintoPDFobject=\count97 | |||
\everyMPtoPDFconversion=\toks17 | |||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||
Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) | |||
Package ifluatex Info: LuaTeX not detected. | |||
) | |||
Package pdftexcmds Info: LuaTeX not detected. | |||
Package pdftexcmds Info: \pdf@primitive is available. | |||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||
Package pdftexcmds Info: \pdfdraftmode found. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||
Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO) | |||
)) | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO) | |||
Package etexcmds Info: Could not find \expanded. | |||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||
(etexcmds) that some package has redefined \expanded. | |||
(etexcmds) In the latter case, load this package earlier. | |||
))) | |||
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 | |||
38. | |||
Package grfext Info: Graphics extension search list: | |||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||
G,.JBIG2,.JB2,.eps] | |||
(grfext) \AppendGraphicsExtensions on input line 456. | |||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||
e | |||
)) | |||
Package caption Info: Begin \AtBeginDocument code. | |||
Package caption Info: End \AtBeginDocument code. | |||
*geometry* detected driver: dvips | |||
*geometry* verbose mode - [ preamble ] result: | |||
* driver: dvips | |||
* paper: custom | |||
* layout: <same size as paper> | |||
* layoutoffset:(h,v)=(0.0pt,0.0pt) | |||
* vratio: 1:1 | |||
* modes: | |||
* h-part:(L,W,R)=(54.2025pt, 325.215pt, 54.2025pt) | |||
* v-part:(T,H,B)=(79.49689pt, 491.43622pt, 79.49689pt) | |||
* \paperwidth=433.62pt | |||
* \paperheight=650.43pt | |||
* \textwidth=325.215pt | |||
* \textheight=491.43622pt | |||
* \oddsidemargin=-18.06749pt | |||
* \evensidemargin=-18.06749pt | |||
* \topmargin=-29.7731pt | |||
* \headheight=12.0pt | |||
* \headsep=25.0pt | |||
* \topskip=11.0pt | |||
* \footskip=30.0pt | |||
* \marginparwidth=59.0pt | |||
* \marginparsep=10.0pt | |||
* \columnsep=10.0pt | |||
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt | |||
* \hoffset=0.0pt | |||
* \voffset=0.0pt | |||
* \mag=1000 | |||
* \@twocolumnfalse | |||
* \@twosidefalse | |||
* \@mparswitchfalse | |||
* \@reversemarginfalse | |||
* (1in=72.27pt=25.4mm, 1cm=28.453pt) | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <12> on input line 14. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <8> on input line 14. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <6> on input line 14. | |||
LaTeX Font Info: Try loading font information for OMS+cmr on input line 22. | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd | |||
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions | |||
) | |||
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available | |||
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 22. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <10.95> on input line 33. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <9> on input line 33. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <5> on input line 33. | |||
[1 | |||
Non-PDF special ignored! | |||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||
[2] (./1.aux) ) | |||
Here is how much of TeX's memory you used: | |||
3529 strings out of 494945 | |||
53620 string characters out of 6181032 | |||
118045 words of memory out of 5000000 | |||
6806 multiletter control sequences out of 15000+600000 | |||
9722 words of font info for 34 fonts, out of 8000000 for 9000 | |||
14 hyphenation exceptions out of 8191 | |||
39i,8n,38p,487b,189s stack positions out of 5000i,500n,10000p,200000b,80000s | |||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||
bx12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pf | |||
b></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr | |||
/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/t | |||
exlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/t | |||
exmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dis | |||
t/fonts/type1/public/amsfonts/cm/cmsy10.pfb> | |||
Output written on 1.pdf (2 pages, 78034 bytes). | |||
PDF statistics: | |||
39 PDF objects out of 1000 (max. 8388607) | |||
27 compressed objects within 1 object stream | |||
0 named destinations out of 1000 (max. 500000) | |||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||
@ -0,0 +1,38 @@ | |||
\documentclass[11pt]{article} | |||
%Gummi|065|=) | |||
\usepackage{graphicx} | |||
\usepackage{caption} | |||
\usepackage{xcolor} | |||
\usepackage[vcentering,dvips]{geometry} | |||
\geometry{papersize={6in,9in},total={4.5in,6.8in}} | |||
\title{\textbf{Door Alarm}} | |||
\author{Steak Electronics} | |||
\date{} | |||
\begin{document} | |||
\maketitle | |||
%\tableofcontents | |||
\textcolor{green!60!blue!70}{ | |||
\section{Attiny Solar Energy Harvest Tests}} | |||
I have the following: | |||
\begin{itemize} | |||
\item Solar panels | |||
\item Attiny 10 | |||
\end{itemize} | |||
To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. | |||
\subsection{Micro Considerations} | |||
The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. | |||
For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. | |||
\subsection{Energy Storage} | |||
I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} | |||
\end{document} | |||
@ -0,0 +1,126 @@ | |||
\documentclass[11pt]{article} | |||
%Gummi|065|=) | |||
\usepackage{graphicx} | |||
\usepackage{caption} | |||
\usepackage{xcolor} | |||
\usepackage[vcentering,dvips]{geometry} | |||
\geometry{papersize={6in,9in},total={4.5in,6.8in}} | |||
\title{\textbf{Door Alarm}} | |||
\author{Steak Electronics} | |||
\date{} | |||
\begin{document} | |||
\maketitle | |||
%\tableofcontents | |||
\textcolor{green!60!blue!70}{ | |||
\section{Door Chime}} | |||
Client wants a door alarm. Let's do a few transistors, an audio amplifier board, a magnet and magnetic reed switch, along with a light switch. | |||
Functionality req'd: | |||
\\ | |||
\\ | |||
Makes noise when door opened. | |||
\\ | |||
\\ | |||
Able to be shut off with light switch. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{BOM}} | |||
Any audio amplifier loud enough will work. I'm going to use this one: | |||
\\ | |||
\\ | |||
IS31AP4088A-QFLS2-EB | |||
\\ | |||
\\ | |||
I think I have speakers and transistors. I'll need a magnetic reed switch and magnet. They should be black, as the door is black. | |||
\\ | |||
\\ | |||
MS-324-3-3-0500 | |||
\\ | |||
\\ | |||
let's also try 59140-1-S-03-A,\footnote{A and F ending letters on this, A is tinned, F untinned leads} as first co. doesn't make the matched magnets... | |||
\\ | |||
\\ | |||
and the magnet, | |||
57140-000 | |||
A speaker, although I have plenty in my junk bin. | |||
AS07708PS-2-WR-R | |||
\\ | |||
\\ | |||
That's a start. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Work Log: LM324, LM555, TIP120,125}} | |||
I spent a bit on this during the evening. I tried first with a LM324, in falstad (sim software) to see if I could make a function gen, out of 3 op amps. I was unable to get the sim to work, although reportedly the circuit works online (ref: https://www.eevblog.com/forum/beginners/simple-analog-function-generator-design/msg1174548/\#msg1174548) | |||
I decided instead, to simulate a triple 5 with a LM324, to finally a transistor output, and this worked in sim. I breadboarded the circuit however, the output was not switching correctly. It turned out later, that I had not read my TIP125 close enough - it is a PNP. Oops. | |||
Before realizing this error, I breadboarded two op amps, (ref: https://electronics.stackexchange.com/questions/311648/obtaining-a-triangle-wave-from-a-square-wave-using-a-lm324n-op-amp) and these were able to make the square / triangle wave without issue. Not practical in this situation however, as the freq. is low. I tried adjusting via the R between output 1 and inverting input for op amp 2, but this did not work as expected. I had long leads with a variable resistance box. Most likely, the issue. | |||
Next, I will breadboard the triple 5 with the LM324 (which may be optional) and use that. I will throw in an Arduino to switch the triple 5 on/off via the RST pin. This will allow for some adjustment of tone.\footnote{I could just use the tone() function on the Uno, and have a transistor handle the output, but the goal of this project was to lean more towards the analog.} Future improvements would be to get some way of removing the Arduino from the project. I would need a solution that will adjust how often the RST pin is switched, for some short period of time while the door magnet switch is active. | |||
I might end up just using tone, if the 555 doesn't sound good. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Door Magnet Reed Sensor}} | |||
I tried buying one from mouser,digikey but they are all small. Seems the standard is 28mm by 10mm or so. I didn't realize it until I purchased it, but it looks quite a bit smaller than I am used to. Not acceptable. | |||
I spent some time looking at all the options. I was unable to find the bigger size. Even the imports from Sparkfun and Adafruit were small. There was a nice screw terminal omrom option but it was \$30. I opted for ebay where there were some used, brand name, sensors in the US. I found some for about \$5 each, including magnet AND the sensor (on mouser/digikey, you often have to get them separately). | |||
\textcolor{green!60!blue!70}{ | |||
\subsubsection{Buzzer or Bell}} | |||
I thought about a buzzer. Like, a ringer from a telephone. I didn't find them on mouser/digikey, but I did see a lot of piezo buzzers. Need to look again. Even better would be a bell, but that requires an actuator or a motor. I don't want to deal with moving parts, it will be more likely to break. Let's put that idea aside for another day. | |||
Still, I like the idea of a bell, and an actuator to ring it... | |||
I tried one on ebay. If that doesn't work there is this one: | |||
https://www.allelectronics.com/item/sol-154/12vdc-push-type-solenoid/1.html | |||
per this discussion: https://forum.sparkfun.com/viewtopic.php?t=10308 | |||
As for the bell, I will hold off until I know how the solenoid works. | |||
\footnote{I decided that the sound of the bell is worth the risk of using moving parts.} | |||
\textcolor{green!60!blue!70}{ | |||
\subsubsection{Signal Mosfets for Actuator}} | |||
I have a solenoid, from ebay (actuator) and I've got a bell\footnote{I ring it in the morning... I ring it in the evening...}. | |||
I tried some 2n7000 signal mosfets (to-92), and I am unable to get it to work. I think it's due to current limits (200mA). These, the 2n7000 have protection diodes built in, according to data sheet image. | |||
In any case, I set up the small npn transistor with 1k to base (grounded) and a 12V battery, with the motor on the collector/drain side. What happens is that it doesn't switch (as it shouldn't) when base is grounded, but float the base, and it switches on, sometimes. Eventually, it will just turn on no matter what, whether base is grounded or not. As I mentioned, these to-92's can't handle the actuator. | |||
I could always use a relay, but that wasn't the point. I'm trying to get the transistors to work. I also tried a TIP120, NPN, darlington mosfet, but this didn't work on the perf board, and I moved to the 2n7000. | |||
EDIT: I was able to get expected results from the 2N7000, by not forgetting the diode across the motor. Put gate low, it is off. Put gate high, it is on. However, it latches. I have to put the gate low again in order to get it to turn off... | |||
A solution to rememdy this is to hold the base/gate at ground with a 2.2K R, then short the base HI (12V here) to turn it on (quickly, and shortly) before letting it go back to ground. Seems to work with no ringing at GND after coil is off. Or, just use an arduino and wire to IO. | |||
Also, I definitely did blow some of the Mosfets, without the diode on the motor. They have their own protection, but that isn't enough by itself. | |||
In other news, the bell is looking like a better solution than the speaker I considered before. More moving parts, but worth it. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Basic Circuit Ready}} | |||
I have built the circuit with a to220 mosfet, with 12V on the source, and powered by a 5V IO from an Arduino uno going through a 1K resistor before hitting the gate. It hits the gate at 1.3V about. Around 1Volt, it lightly sets off the actuator, 1.06V the actuator is fully activated. | |||
Wanted to use a 555, but no time for that today. Next step is to build the enclosure around everything, so the bell is hit correctly. Wood may be too much of a fire hazard. Need to think about this. Looking up building materials that are resilient to fire comes up with stone, basically. Glass, concrete, stucco, gypsum, and brick. I like the glass option. I think I will go with that. Not going to be easy, but fireproof. I have a lot of glass hanging around after demoing some windows. Another option might be to use some drywall, and build something with joint compound. A type of wall box... Hm... Easier than glass. Either that or a plastic box, larger than I have. Or, metal box. | |||
\textcolor{green!60!blue!70}{ | |||
\subsubsection{Breaking the Actuator}} | |||
Actuators are like brushed motors, in that there is a connection from the coil. I have a jigsaw with two brushes on the side. They are these carbon blocks. Actuators are the same, yet the spring is the brush. | |||
Today I was assembling everything for final deployment, and I accidentally hit the spring with a screwdriver. The spring broke, and I was unable to find a replacement in my box of springs. | |||
Replacement part needed. It also turns out that the actuator wasn't really loud enough. I'm goint to spec one that is a bit stronger. I've purchased a 1Amp rated one, instead of a 300mA rated one. | |||
Other than that, everything is built. | |||
\\ | |||
\includegraphics[scale=0.4]{../pics/DSCN2702.JPG} | |||
\captionof{figure}{Early build.} | |||
\end{document} | |||
@ -0,0 +1,5 @@ | |||
\relax | |||
\@writefile{toc}{\contentsline {section}{\numberline {1}Attiny Solar Energy Harvest Tests}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Micro Considerations}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Energy Storage}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Make parts, not scrap}{1}} |
@ -0,0 +1,272 @@ | |||
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 23 MAR 2020 00:43 | |||
entering extended mode | |||
restricted \write18 enabled. | |||
%&-line parsing enabled. | |||
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/ | |||
Attiny_Solar_Energy_Harvest/docs/2.tex | |||
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/A | |||
ttiny_Solar_Energy_Harvest/docs/2.tex | |||
LaTeX2e <2017/01/01> patch level 3 | |||
Babel <3.9r> and hyphenation patterns for 3 language(s) loaded. | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||
) | |||
\c@part=\count79 | |||
\c@section=\count80 | |||
\c@subsection=\count81 | |||
\c@subsubsection=\count82 | |||
\c@paragraph=\count83 | |||
\c@subparagraph=\count84 | |||
\c@figure=\count85 | |||
\c@table=\count86 | |||
\abovecaptionskip=\skip41 | |||
\belowcaptionskip=\skip42 | |||
\bibindent=\dimen102 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||
Package: keyval 2014/10/28 v1.15 key=value parser (DPC) | |||
\KV@toks@=\toks14 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||
Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||
Package: trig 2016/01/03 v1.10 sin cos tan (DPC) | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg | |||
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration | |||
) | |||
Package graphics Info: Driver file: pdftex.def on input line 99. | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def | |||
File: pdftex.def 2017/01/12 v0.06k Graphics/color for pdfTeX | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) | |||
) | |||
\Gread@gobject=\count87 | |||
)) | |||
\Gin@req@height=\dimen103 | |||
\Gin@req@width=\dimen104 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||
Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||
Package: caption3 2016/05/22 v1.7-166 caption3 kernel (AR) | |||
Package caption3 Info: TeX engine: e-TeX on input line 67. | |||
\captionmargin=\dimen105 | |||
\captionmargin@=\dimen106 | |||
\captionwidth=\dimen107 | |||
\caption@tempdima=\dimen108 | |||
\caption@indent=\dimen109 | |||
\caption@parindent=\dimen110 | |||
\caption@hangindent=\dimen111 | |||
) | |||
\c@ContinuedFloat=\count88 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty | |||
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg | |||
File: color.cfg 2016/01/02 v1.6 sample color configuration | |||
) | |||
Package xcolor Info: Driver file: pdftex.def on input line 225. | |||
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348. | |||
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352. | |||
Package xcolor Info: Model `RGB' extended on input line 1364. | |||
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366. | |||
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367. | |||
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368. | |||
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369. | |||
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370. | |||
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty | |||
Package: geometry 2010/09/12 v5.6 Page Geometry | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||
Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty | |||
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO) | |||
Package ifvtex Info: VTeX not detected. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty | |||
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional | |||
) | |||
\Gm@cnth=\count89 | |||
\Gm@cntv=\count90 | |||
\c@Gm@tempcnt=\count91 | |||
\Gm@bindingoffset=\dimen112 | |||
\Gm@wd@mp=\dimen113 | |||
\Gm@odd@mp=\dimen114 | |||
\Gm@even@mp=\dimen115 | |||
\Gm@layoutwidth=\dimen116 | |||
\Gm@layoutheight=\dimen117 | |||
\Gm@layouthoffset=\dimen118 | |||
\Gm@layoutvoffset=\dimen119 | |||
\Gm@dimlist=\toks15 | |||
) (./2.aux) | |||
\openout1 = `2.aux'. | |||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii | |||
[Loading MPS to PDF converter (version 2006.09.02).] | |||
\scratchcounter=\count92 | |||
\scratchdimen=\dimen120 | |||
\scratchbox=\box26 | |||
\nofMPsegments=\count93 | |||
\nofMParguments=\count94 | |||
\everyMPshowfont=\toks16 | |||
\MPscratchCnt=\count95 | |||
\MPscratchDim=\dimen121 | |||
\MPnumerator=\count96 | |||
\makeMPintoPDFobject=\count97 | |||
\everyMPtoPDFconversion=\toks17 | |||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||
Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) | |||
Package ifluatex Info: LuaTeX not detected. | |||
) | |||
Package pdftexcmds Info: LuaTeX not detected. | |||
Package pdftexcmds Info: \pdf@primitive is available. | |||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||
Package pdftexcmds Info: \pdfdraftmode found. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||
Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO) | |||
)) | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO) | |||
Package etexcmds Info: Could not find \expanded. | |||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||
(etexcmds) that some package has redefined \expanded. | |||
(etexcmds) In the latter case, load this package earlier. | |||
))) | |||
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 | |||
38. | |||
Package grfext Info: Graphics extension search list: | |||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||
G,.JBIG2,.JB2,.eps] | |||
(grfext) \AppendGraphicsExtensions on input line 456. | |||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||
e | |||
)) | |||
Package caption Info: Begin \AtBeginDocument code. | |||
Package caption Info: End \AtBeginDocument code. | |||
*geometry* detected driver: dvips | |||
*geometry* verbose mode - [ preamble ] result: | |||
* driver: dvips | |||
* paper: custom | |||
* layout: <same size as paper> | |||
* layoutoffset:(h,v)=(0.0pt,0.0pt) | |||
* vratio: 1:1 | |||
* modes: | |||
* h-part:(L,W,R)=(54.2025pt, 325.215pt, 54.2025pt) | |||
* v-part:(T,H,B)=(79.49689pt, 491.43622pt, 79.49689pt) | |||
* \paperwidth=433.62pt | |||
* \paperheight=650.43pt | |||
* \textwidth=325.215pt | |||
* \textheight=491.43622pt | |||
* \oddsidemargin=-18.06749pt | |||
* \evensidemargin=-18.06749pt | |||
* \topmargin=-29.7731pt | |||
* \headheight=12.0pt | |||
* \headsep=25.0pt | |||
* \topskip=11.0pt | |||
* \footskip=30.0pt | |||
* \marginparwidth=59.0pt | |||
* \marginparsep=10.0pt | |||
* \columnsep=10.0pt | |||
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt | |||
* \hoffset=0.0pt | |||
* \voffset=0.0pt | |||
* \mag=1000 | |||
* \@twocolumnfalse | |||
* \@twosidefalse | |||
* \@mparswitchfalse | |||
* \@reversemarginfalse | |||
* (1in=72.27pt=25.4mm, 1cm=28.453pt) | |||
LaTeX Font Info: Try loading font information for OMS+cmr on input line 22. | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd | |||
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions | |||
) | |||
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available | |||
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 22. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <10.95> on input line 34. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <8> on input line 34. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <6> on input line 34. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <9> on input line 34. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <5> on input line 34. | |||
[1 | |||
Non-PDF special ignored! | |||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||
(./2.aux) ) | |||
Here is how much of TeX's memory you used: | |||
3522 strings out of 494945 | |||
53529 string characters out of 6181032 | |||
118046 words of memory out of 5000000 | |||
6801 multiletter control sequences out of 15000+600000 | |||
8501 words of font info for 30 fonts, out of 8000000 for 9000 | |||
14 hyphenation exceptions out of 8191 | |||
39i,8n,38p,487b,151s stack positions out of 5000i,500n,10000p,200000b,80000s | |||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12 | |||
.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></ | |||
usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/shar | |||
e/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texliv | |||
e/texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf- | |||
dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb> | |||
Output written on 2.pdf (1 page, 69012 bytes). | |||
PDF statistics: | |||
32 PDF objects out of 1000 (max. 8388607) | |||
22 compressed objects within 1 object stream | |||
0 named destinations out of 1000 (max. 500000) | |||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||
@ -0,0 +1,41 @@ | |||
\documentclass[11pt]{article} | |||
%Gummi|065|=) | |||
\usepackage{graphicx} | |||
\usepackage{caption} | |||
\usepackage{xcolor} | |||
\usepackage[vcentering,dvips]{geometry} | |||
\geometry{papersize={6in,9in},total={4.5in,6.8in}} | |||
%\title{\textbf{Door Alarm}} | |||
\author{Steak Electronics} | |||
\date{} | |||
\begin{document} | |||
%\maketitle | |||
%\tableofcontents | |||
\textcolor{green!60!blue!70}{ | |||
\section{Attiny Solar Energy Harvest Tests}} | |||
I have the following: | |||
\begin{itemize} | |||
\item Solar panels | |||
\item Attiny 10 | |||
\end{itemize} | |||
To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Micro Considerations}} | |||
The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. | |||
For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Energy Storage}} | |||
I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Make parts, not scrap}} | |||
I will want to make sure that all parts I build are perf board parts, not breadboard scrap (to be torn down and rebuilt again). This is an Attiny, so no need to test much, yet. | |||
\end{document} | |||
@ -0,0 +1,38 @@ | |||
\documentclass[11pt]{article} | |||
%Gummi|065|=) | |||
\usepackage{graphicx} | |||
\usepackage{caption} | |||
\usepackage{xcolor} | |||
\usepackage[vcentering,dvips]{geometry} | |||
\geometry{papersize={6in,9in},total={4.5in,6.8in}} | |||
\title{\textbf{Door Alarm}} | |||
\author{Steak Electronics} | |||
\date{} | |||
\begin{document} | |||
\maketitle | |||
%\tableofcontents | |||
\textcolor{green!60!blue!70}{ | |||
\section{Attiny Solar Energy Harvest Tests}} | |||
I have the following: | |||
\begin{itemize} | |||
\item Solar panels | |||
\item Attiny 10 | |||
\end{itemize} | |||
To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. | |||
\subsection{Micro Considerations} | |||
The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. | |||
For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. | |||
\subsection{Energy Storage} | |||
I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} | |||
\end{document} | |||
@ -0,0 +1,6 @@ | |||
\relax | |||
\@writefile{toc}{\contentsline {section}{\numberline {1}Attiny Solar Energy Harvest Tests}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Micro Considerations}{1}} | |||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}Micro Notes}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Energy Storage}{1}} | |||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Make parts, not scrap}{2}} |
@ -0,0 +1,283 @@ | |||
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 23 MAR 2020 00:46 | |||
entering extended mode | |||
restricted \write18 enabled. | |||
%&-line parsing enabled. | |||
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/ | |||
Attiny_Solar_Energy_Harvest/docs/3.tex | |||
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/A | |||
ttiny_Solar_Energy_Harvest/docs/3.tex | |||
LaTeX2e <2017/01/01> patch level 3 | |||
Babel <3.9r> and hyphenation patterns for 3 language(s) loaded. | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||
) | |||
\c@part=\count79 | |||
\c@section=\count80 | |||
\c@subsection=\count81 | |||
\c@subsubsection=\count82 | |||
\c@paragraph=\count83 | |||
\c@subparagraph=\count84 | |||
\c@figure=\count85 | |||
\c@table=\count86 | |||
\abovecaptionskip=\skip41 | |||
\belowcaptionskip=\skip42 | |||
\bibindent=\dimen102 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||
Package: keyval 2014/10/28 v1.15 key=value parser (DPC) | |||
\KV@toks@=\toks14 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||
Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||
Package: trig 2016/01/03 v1.10 sin cos tan (DPC) | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg | |||
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration | |||
) | |||
Package graphics Info: Driver file: pdftex.def on input line 99. | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def | |||
File: pdftex.def 2017/01/12 v0.06k Graphics/color for pdfTeX | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) | |||
) | |||
\Gread@gobject=\count87 | |||
)) | |||
\Gin@req@height=\dimen103 | |||
\Gin@req@width=\dimen104 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||
Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) | |||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||
Package: caption3 2016/05/22 v1.7-166 caption3 kernel (AR) | |||
Package caption3 Info: TeX engine: e-TeX on input line 67. | |||
\captionmargin=\dimen105 | |||
\captionmargin@=\dimen106 | |||
\captionwidth=\dimen107 | |||
\caption@tempdima=\dimen108 | |||
\caption@indent=\dimen109 | |||
\caption@parindent=\dimen110 | |||
\caption@hangindent=\dimen111 | |||
) | |||
\c@ContinuedFloat=\count88 | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty | |||
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK) | |||
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg | |||
File: color.cfg 2016/01/02 v1.6 sample color configuration | |||
) | |||
Package xcolor Info: Driver file: pdftex.def on input line 225. | |||
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348. | |||
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352. | |||
Package xcolor Info: Model `RGB' extended on input line 1364. | |||
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366. | |||
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367. | |||
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368. | |||
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369. | |||
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370. | |||
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty | |||
Package: geometry 2010/09/12 v5.6 Page Geometry | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||
Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty | |||
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO) | |||
Package ifvtex Info: VTeX not detected. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty | |||
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional | |||
) | |||
\Gm@cnth=\count89 | |||
\Gm@cntv=\count90 | |||
\c@Gm@tempcnt=\count91 | |||
\Gm@bindingoffset=\dimen112 | |||
\Gm@wd@mp=\dimen113 | |||
\Gm@odd@mp=\dimen114 | |||
\Gm@even@mp=\dimen115 | |||
\Gm@layoutwidth=\dimen116 | |||
\Gm@layoutheight=\dimen117 | |||
\Gm@layouthoffset=\dimen118 | |||
\Gm@layoutvoffset=\dimen119 | |||
\Gm@dimlist=\toks15 | |||
) (./3.aux) | |||
\openout1 = `3.aux'. | |||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 12. | |||
LaTeX Font Info: ... okay on input line 12. | |||
(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii | |||
[Loading MPS to PDF converter (version 2006.09.02).] | |||
\scratchcounter=\count92 | |||
\scratchdimen=\dimen120 | |||
\scratchbox=\box26 | |||
\nofMPsegments=\count93 | |||
\nofMParguments=\count94 | |||
\everyMPshowfont=\toks16 | |||
\MPscratchCnt=\count95 | |||
\MPscratchDim=\dimen121 | |||
\MPnumerator=\count96 | |||
\makeMPintoPDFobject=\count97 | |||
\everyMPtoPDFconversion=\toks17 | |||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||
Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) | |||
Package ifluatex Info: LuaTeX not detected. | |||
) | |||
Package pdftexcmds Info: LuaTeX not detected. | |||
Package pdftexcmds Info: \pdf@primitive is available. | |||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||
Package pdftexcmds Info: \pdfdraftmode found. | |||
) | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||
Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO) | |||
)) | |||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO) | |||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO) | |||
Package etexcmds Info: Could not find \expanded. | |||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||
(etexcmds) that some package has redefined \expanded. | |||
(etexcmds) In the latter case, load this package earlier. | |||
))) | |||
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 | |||
38. | |||
Package grfext Info: Graphics extension search list: | |||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||
G,.JBIG2,.JB2,.eps] | |||
(grfext) \AppendGraphicsExtensions on input line 456. | |||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||
e | |||
)) | |||
Package caption Info: Begin \AtBeginDocument code. | |||
Package caption Info: End \AtBeginDocument code. | |||
*geometry* detected driver: dvips | |||
*geometry* verbose mode - [ preamble ] result: | |||
* driver: dvips | |||
* paper: custom | |||
* layout: <same size as paper> | |||
* layoutoffset:(h,v)=(0.0pt,0.0pt) | |||
* vratio: 1:1 | |||
* modes: | |||
* h-part:(L,W,R)=(54.2025pt, 325.215pt, 54.2025pt) | |||
* v-part:(T,H,B)=(79.49689pt, 491.43622pt, 79.49689pt) | |||
* \paperwidth=433.62pt | |||
* \paperheight=650.43pt | |||
* \textwidth=325.215pt | |||
* \textheight=491.43622pt | |||
* \oddsidemargin=-18.06749pt | |||
* \evensidemargin=-18.06749pt | |||
* \topmargin=-29.7731pt | |||
* \headheight=12.0pt | |||
* \headsep=25.0pt | |||
* \topskip=11.0pt | |||
* \footskip=30.0pt | |||
* \marginparwidth=59.0pt | |||
* \marginparsep=10.0pt | |||
* \columnsep=10.0pt | |||
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt | |||
* \hoffset=0.0pt | |||
* \voffset=0.0pt | |||
* \mag=1000 | |||
* \@twocolumnfalse | |||
* \@twosidefalse | |||
* \@mparswitchfalse | |||
* \@reversemarginfalse | |||
* (1in=72.27pt=25.4mm, 1cm=28.453pt) | |||
LaTeX Font Info: Try loading font information for OMS+cmr on input line 22. | |||
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd | |||
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions | |||
) | |||
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available | |||
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 22. | |||
Underfull \hbox (badness 10000) in paragraph at lines 34--37 | |||
[] | |||
Underfull \hbox (badness 10000) in paragraph at lines 34--37 | |||
[] | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <10.95> on input line 41. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <8> on input line 41. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <6> on input line 41. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <9> on input line 41. | |||
LaTeX Font Info: External font `cmex10' loaded for size | |||
(Font) <5> on input line 41. | |||
[1 | |||
Non-PDF special ignored! | |||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||
[2] (./3.aux) ) | |||
Here is how much of TeX's memory you used: | |||
3524 strings out of 494945 | |||
53553 string characters out of 6181032 | |||
118046 words of memory out of 5000000 | |||
6802 multiletter control sequences out of 15000+600000 | |||
8809 words of font info for 31 fonts, out of 8000000 for 9000 | |||
14 hyphenation exceptions out of 8191 | |||
39i,8n,38p,487b,200s stack positions out of 5000i,500n,10000p,200000b,80000s | |||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p | |||
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us | |||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/ | |||
texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/ | |||
texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-di | |||
st/fonts/type1/public/amsfonts/cm/cmsy10.pfb> | |||
Output written on 3.pdf (2 pages, 80459 bytes). | |||
PDF statistics: | |||
39 PDF objects out of 1000 (max. 8388607) | |||
27 compressed objects within 1 object stream | |||
0 named destinations out of 1000 (max. 500000) | |||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||
@ -0,0 +1,48 @@ | |||
\documentclass[11pt]{article} | |||
%Gummi|065|=) | |||
\usepackage{graphicx} | |||
\usepackage{caption} | |||
\usepackage{xcolor} | |||
\usepackage[vcentering,dvips]{geometry} | |||
\geometry{papersize={6in,9in},total={4.5in,6.8in}} | |||
%\title{\textbf{Door Alarm}} | |||
\author{Steak Electronics} | |||
\date{} | |||
\begin{document} | |||
%\maketitle | |||
%\tableofcontents | |||
\textcolor{green!60!blue!70}{ | |||
\section{Attiny Solar Energy Harvest Tests}} | |||
I have the following: | |||
\begin{itemize} | |||
\item Solar panels | |||
\item Attiny 10 | |||
\end{itemize} | |||
To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Micro Considerations}} | |||
The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. | |||
For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. | |||
\textcolor{green!60!blue!70}{ | |||
\subsubsection{Micro Notes}} | |||
Must run at 1.8V / 1MHz per front page of data sheet, for 200uA draw in active mode. | |||
\\ | |||
\\ | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Energy Storage}} | |||
I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Make parts, not scrap}} | |||
I will want to make sure that all parts I build are perf board parts, not breadboard scrap (to be torn down and rebuilt again). This is an Attiny, so no need to test much, yet. | |||
\end{document} | |||
@ -0,0 +1,41 @@ | |||
\documentclass[11pt]{article} | |||
%Gummi|065|=) | |||
\usepackage{graphicx} | |||
\usepackage{caption} | |||
\usepackage{xcolor} | |||
\usepackage[vcentering,dvips]{geometry} | |||
\geometry{papersize={6in,9in},total={4.5in,6.8in}} | |||
%\title{\textbf{Door Alarm}} | |||
\author{Steak Electronics} | |||
\date{} | |||
\begin{document} | |||
%\maketitle | |||
%\tableofcontents | |||
\textcolor{green!60!blue!70}{ | |||
\section{Attiny Solar Energy Harvest Tests}} | |||
I have the following: | |||
\begin{itemize} | |||
\item Solar panels | |||
\item Attiny 10 | |||
\end{itemize} | |||
To this list, I will add a supercap, and an energy harvesting IC. The goal being to load the super cap during the day, and to run 24/7. I will need an exceptionally low power micro. The super cap will need to be about 3.3V or 5V. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Micro Considerations}} | |||
The Arduino Atmega328P is not an option. I'm looking to have a current draw of only 1mA max, (ideally 500uA) when active. Moteino is also not an option for this. Those are made for batteries. I want to be battery free. A super cap, however can be used to store energy. I'll get to that shortly. | |||
For micros, I have some Attiny10 on hand, and these have a reasonably low power pull in active mode. Let's build those up first. What will the micro do? No idea. I haven't a clue. | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Energy Storage}} | |||
I don't want a battery. Let's go with a super cap. The solar panels will only be active some of the time, so I will want to harvest energy with some kind of IC into the cap when the sun is out.\footnote{Reference: www.analog.com/media/en/technical-documentation/technical-articles/solarenergyharvesting.pdf is a start. I'll need to do more research.} | |||
\textcolor{green!60!blue!70}{ | |||
\subsection{Make parts, not scrap}} | |||
I will want to make sure that all parts I build are perf board parts, not breadboard scrap (to be torn down and rebuilt again). This is an Attiny, so no need to test much, yet. | |||
\end{document} | |||
@ -0,0 +1,894 @@ | |||
/************************************************** | |||
* TPI programmer for ATtiny4/5/9/10/20/40 | |||
* | |||
* Make the connections as shown below. | |||
* | |||
* To use: | |||
***** Buad rate must be set to 9600 **** | |||
* | |||
* - Upload to arduino and power off | |||
* - Connect ATtiny10 as shown | |||
* - Power on and open the serial monitor | |||
* - If things are working so far you should | |||
* see "NVM enabled" and "ATtiny10/20/40 connected". | |||
* - Input one-letter commands via serial monitor: | |||
* | |||
* D = dump memory. Displays all current memory | |||
* on the chip | |||
* | |||
* E = erase chip. Erases all program memory | |||
* automatically done at time of programming | |||
* | |||
* P = write program. After sending this, paste | |||
* the program from the hex file into the | |||
* serial monitor. | |||
* | |||
* S = set fuse. follow the instructions to set | |||
* one of the three fuses. | |||
* | |||
* C = clear fuse. follow the instructions to clear | |||
* one of the three fuses. | |||
* | |||
* L = Set Lock Bits No further programming & verification | |||
* possible | |||
* | |||
* H = Toggle High Voltage Programming | |||
* | |||
* T = Toggle +12v enabled by High, or Low | |||
* | |||
* R/r = Quick reset | |||
* | |||
* - Finally, power off the arduino and remove the | |||
* Attiny10/20/40 | |||
* | |||
* | |||
* Arduino ATtiny10 * | |||
* ----------+ +---------------- * | |||
* (SS#) 10 |--[R]-----| 6 (RESET#/PB3) * | |||
* | | * | |||
* (MOSI) 11 |--[R]--+--| 1 (TPIDATA/PB0) * | |||
* | | | * | |||
* (MISO) 12 |--[R]--+ | * | |||
* | | * | |||
* (SCK) 13 |--[R]-----| 3 (TPICLK/PB1) * | |||
* ----------+ +---------------- * | |||
* * | |||
* ----------+ +---------------- * | |||
* (HVP) 9 |--- | 6 (RESET#/PB3) * | |||
* | | * | |||
* * | |||
* -[R]- = a 220 - 1K Ohm resistor * | |||
* * | |||
* this picture : 2011/12/08 by pcm1723 * | |||
* modified :2015/02/27 by KD * | |||
* * | |||
* thanks to pcm1723 for tpitest.pde upon which * | |||
* this is based * | |||
************************************************** | |||
Updates: | |||
Apr 02, 2018: Ksdsksd@gmail.com | |||
* Added Lock bit setting to main menu | |||
Jan 23, 2017: Ksdsksd@gmail.com | |||
* Thanks to InoueTaichi Fixed incorrect #define Tiny40 | |||
Mar 05, 2015: Ksdsksd@gamil.com | |||
* Added notifications to setting and clearing the system flags. | |||
Feb 23, 2015: Ksdsksd@gamil.com | |||
* Changed the programmer Diagram, This is the config I use, and get a sucessful programming of a tiny10 at 9600 baud. | |||
Mar 22, 2014: Ksdsksd@gmail.com | |||
* Added the quick reset to high before resetting the device. | |||
* Added code to stop the SPI and float the pins for testing the device while connected. | |||
Mar 20, 2014: Ksdsksd@gmail.com | |||
* Added a quick reset by sending 'r' or 'R' via the serial monitor. | |||
* Added a High voltage programming option from pin 9, toggled by 'H' | |||
* Added a High/low option for providing 12v to the reset pin, toggled by 'T' | |||
Mar 17, 2014: Ksdsksd@gmail.com | |||
* Had some trouble with the nibbles being swapped when programming on the 10 & 20, | |||
added b1,b2 to hold the serial data before calling byteval() | |||
* Added Nat Blundell's patch to the code | |||
Apr 10, 2013: Ksdsksd@gmail.com | |||
* Applied Fix for setting and clearing flags | |||
Feb 7, 2013: Ksdsksd@gmail.com | |||
* Fixed programming timer, had intitial start at zero instead of current time. | |||
Dec 11, 2012: Ksdsksd@gmail.com | |||
* Added detect and programming for 4/5/9 | |||
Dec 5-6, 2012: Ksdsksd@gmail.com | |||
* Incorperated read, and verify into program. Now have no program size limitation by using 328p. | |||
* Changed the outHex routines consolidated them into 1, number to be printed, and number of nibbles | |||
* Added a type check to distinguish between Tiny10/20/40 | |||
* Added an auto word size check to ensure that there is the proper amount of words written for a 10/20/40 | |||
* Removed Read program, Verify, and Finish from options | |||
* Changed baud rate to 19200 for delay from data written to the chip, to prevent serial buffer overrun. | |||
Oct 5, 2012: Ksdsksd@gmail.com | |||
*** Noticed that when programming, the verification fails | |||
at times by last 1-2 bytes programmed, and the Tiny would act erratic. | |||
Quick fix was adding 3 NOP's to the end the Tiny's code, and ignoring the errors, the Tiny then performed as expected. | |||
Oct 4, 2012: Ksdsksd@gmail.com | |||
* Moved all Serial printed strings to program space | |||
* Added code to detect Tiny20 | |||
*/ | |||
#include <SPI.h> | |||
#include "pins_arduino.h" | |||
// define the instruction set bytes | |||
#define SLD 0x20 | |||
#define SLDp 0x24 | |||
#define SST 0x60 | |||
#define SSTp 0x64 | |||
#define SSTPRH 0x69 | |||
#define SSTPRL 0x68 | |||
// see functions below //////////////////////////////// | |||
// SIN 0b0aa1aaaa replace a with 6 address bits | |||
// SOUT 0b1aa1aaaa replace a with 6 address bits | |||
// SLDCS 0b1000aaaa replace a with address bits | |||
// SSTCS 0b1100aaaa replace a with address bits | |||
/////////////////////////////////////////////////////// | |||
#define SKEY 0xE0 | |||
#define NVM_PROGRAM_ENABLE 0x1289AB45CDD888FFULL // the ULL means unsigned long long | |||
#define NVMCMD 0x33 | |||
#define NVMCSR 0x32 | |||
#define NVM_NOP 0x00 | |||
#define NVM_CHIP_ERASE 0x10 | |||
#define NVM_SECTION_ERASE 0x14 | |||
#define NVM_WORD_WRITE 0x1D | |||
#define HVReset 9 | |||
#define Tiny4_5 10 | |||
#define Tiny9 1 | |||
#define Tiny10 1 | |||
#define Tiny20 2 | |||
#define Tiny40 4 | |||
#define TimeOut 1 | |||
#define HexError 2 | |||
#define TooLarge 3 | |||
// represents the current pointer register value | |||
unsigned short adrs = 0x0000; | |||
// used for storing a program file | |||
uint8_t data[16]; //program data | |||
unsigned int progSize = 0; //program size in bytes | |||
// used for various purposes | |||
long startTime; | |||
int timeout; | |||
uint8_t b, b1, b2, b3; | |||
boolean idChecked; | |||
boolean correct; | |||
char type; // type of chip connected 1 = Tiny10, 2 = Tiny20 | |||
char HVP = 0; | |||
char HVON = 0; | |||
void setup(){ | |||
// set up serial | |||
Serial.begin(9600); // you cant increase this, it'll overrun the buffer | |||
// set up SPI | |||
/* SPI.begin(); | |||
SPI.setBitOrder(LSBFIRST); | |||
SPI.setDataMode(SPI_MODE0); | |||
SPI.setClockDivider(SPI_CLOCK_DIV32); | |||
*/ start_tpi(); | |||
pinMode(HVReset, OUTPUT); | |||
// initialize memory pointer register | |||
setPointer(0x0000); | |||
timeout = 20000; | |||
idChecked = false; | |||
} // end setup() | |||
void hvserial() | |||
{ | |||
if(HVP) | |||
Serial.println(F("***High Voltage Programming Enabled***")); | |||
else | |||
Serial.println(F("High Voltage Programming Disabled")); | |||
Serial.print(F("Pin 9 ")); | |||
Serial.print(HVON?F("HIGH"):F("LOW")); | |||
Serial.print(F(" supplies 12v")); | |||
} | |||
void hvReset(char highLow) | |||
{ | |||
if(HVP) | |||
{ | |||
if(HVON) //if high enables 12v | |||
highLow = !highLow; // invert the typical reset | |||
digitalWrite(HVReset, highLow); | |||
} | |||
else | |||
digitalWrite(SS, highLow); | |||
} | |||
void quickReset() | |||
{ | |||
digitalWrite(SS,HIGH); | |||
delay(1); | |||
digitalWrite(SS,LOW); | |||
delay(10); | |||
digitalWrite(SS,HIGH); | |||
} | |||
void start_tpi() { | |||
SPI.begin(); | |||
SPI.setBitOrder(LSBFIRST); | |||
SPI.setDataMode(SPI_MODE0); | |||
SPI.setClockDivider(SPI_CLOCK_DIV32); | |||
// enter TPI programming mode | |||
hvReset(LOW); | |||
// digitalWrite(SS, LOW); // assert RESET on tiny | |||
delay(1); // t_RST min = 400 ns @ Vcc = 5 V | |||
SPI.transfer(0xff); // activate TPI by emitting | |||
SPI.transfer(0xff); // 16 or more pulses on TPICLK | |||
SPI.transfer(0xff); // while holding TPIDATA to "1" | |||
writeCSS(0x02, 0x04); // TPIPCR, guard time = 8bits (default=128) | |||
send_skey(NVM_PROGRAM_ENABLE); // enable NVM interface | |||
// wait for NVM to be enabled | |||
while((readCSS(0x00) & 0x02) < 1){ | |||
// wait | |||
} | |||
Serial.println(F("NVM enabled")); | |||
} | |||
void setLockBits(){ | |||
Serial.print(F("Locking... Are you sure? Y/N")); | |||
while(Serial.available() < 1); | |||
char yn = Serial.read(); | |||
if(yn == 'n' || yn == 'N') | |||
return; | |||
setPointer(0x3F00); | |||
writeIO(NVMCMD, NVM_WORD_WRITE); | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0); | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xFF); | |||
while((readIO(NVMCSR) & (1<<7)) != 0x00); | |||
Serial.print(F("Locked...")); | |||
} | |||
void loop(){ | |||
if(!idChecked){ | |||
// start_tpi(); | |||
checkID(); | |||
idChecked = true; | |||
finish(); | |||
} | |||
// when ready, send ready signal '.' and wait | |||
Serial.print(F("\n>")); | |||
while(Serial.available() < 1){ | |||
// wait | |||
} | |||
start_tpi(); | |||
// the first byte is a command | |||
//** 'P' = program the ATtiny using the read program | |||
//** 'D' = dump memory to serial monitor | |||
//** 'E' = erase chip. erases current program memory.(done automatically by 'P') | |||
//** 'S' = set fuse | |||
//** 'C' = clear fuse | |||
//** 'L' = Set Lock Bits | |||
char comnd = Sread(); | |||
switch( comnd ){ | |||
case 'r': | |||
case'R': | |||
quickReset(); | |||
break; | |||
case 'D': | |||
dumpMemory(); | |||
break; | |||
case 'H': | |||
HVP = !HVP; | |||
hvserial(); | |||
break; | |||
case 'T': | |||
HVON = !HVON; | |||
hvserial(); | |||
break; | |||
case 'P': | |||
if(!writeProgram()){ | |||
startTime = millis(); | |||
while(millis()-startTime < 8000) | |||
Serial.read();// if exited due to error, disregard all other serial data | |||
} | |||
break; | |||
case 'E': | |||
eraseChip(); | |||
break; | |||
case 'S': | |||
setConfig(true); | |||
break; | |||
case 'C': | |||
setConfig(false); | |||
break; | |||
case 'L': | |||
setLockBits(); | |||
break; | |||
default: | |||
Serial.println(F("Received unknown command")); | |||
} | |||
finish(); | |||
} | |||
void ERROR_pgmSize(void) | |||
{ | |||
Serial.println(F("program size is 0??")); | |||
} | |||
void ERROR_data(char i) | |||
{ | |||
Serial.println(F("couldn't receive data:")); | |||
switch(i){ | |||
case TimeOut: | |||
Serial.println(F("timed out")); | |||
break; | |||
case HexError: | |||
Serial.println(F("hex file format error")); | |||
break; | |||
case TooLarge: | |||
Serial.println(F("program is too large")); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
// print the register, SRAM, config and signature memory | |||
void dumpMemory(){ | |||
unsigned int len; | |||
uint8_t i; | |||
// initialize memory pointer register | |||
setPointer(0x0000); | |||
Serial.println(F("Current memory state:")); | |||
if(type != Tiny4_5) | |||
len = 0x400 * type; //the memory length for a 10/20/40 is 1024/2048/4096 | |||
else | |||
len = 0x200; //tiny 4/5 has 512 bytes | |||
len += 0x4000; | |||
while(adrs < len){ | |||
// read the byte at the current pointer address | |||
// and increment address | |||
tpi_send_byte(SLDp); | |||
b = tpi_receive_byte(); // get data byte | |||
// read all the memory, but only print | |||
// the register, SRAM, config and signature memory | |||
if ((0x0000 <= adrs && adrs <= 0x005F) // register/SRAM | |||
|(0x3F00 <= adrs && adrs <= 0x3F01) // NVM lock bits | |||
|(0x3F40 <= adrs && adrs <= 0x3F41) // config | |||
|(0x3F80 <= adrs && adrs <= 0x3F81) // calibration | |||
|(0x3FC0 <= adrs && adrs <= 0x3FC3) // ID | |||
|(0x4000 <= adrs && adrs <= len-1) ) { // program | |||
// print +number along the top | |||
if ((0x00 == adrs) | |||
|(0x3f00 == adrs) // NVM lock bits | |||
|(0x3F40 == adrs) // config | |||
|(0x3F80 == adrs) // calibration | |||
|(0x3FC0 == adrs) // ID | |||
|(0x4000 == adrs) ) { | |||
Serial.println(); | |||
if(adrs == 0x0000){ Serial.print(F("registers, SRAM")); } | |||
if(adrs == 0x3F00){ Serial.print(F("NVM lock")); } | |||
if(adrs == 0x3F40){ Serial.print(F("configuration")); } | |||
if(adrs == 0x3F80){ Serial.print(F("calibration")); } | |||
if(adrs == 0x3FC0){ Serial.print(F("device ID")); } | |||
if(adrs == 0x4000){ Serial.print(F("program")); } | |||
Serial.println(); | |||
for (i = 0; i < 5; i++) | |||
Serial.print(F(" ")); | |||
for (i = 0; i < 16; i++) { | |||
Serial.print(F(" +")); | |||
Serial.print(i, HEX); | |||
} | |||
} | |||
// print number on the left | |||
if (0 == (0x000f & adrs)) { | |||
Serial.println(); | |||
outHex(adrs, 4); | |||
Serial.print(F(": ")); // delimiter | |||
} | |||
outHex(b, 2); | |||
Serial.print(F(" ")); | |||
} | |||
adrs++; // increment memory address | |||
if(adrs == 0x0060){ | |||
// skip reserved memory | |||
setPointer(0x3F00); | |||
} | |||
} | |||
Serial.println(F(" ")); | |||
} // end dumpMemory() | |||
// receive and translate the contents of a hex file, Program and verify on the fly | |||
boolean writeProgram(){ | |||
char datlength[] = "00"; | |||
char addr[] = "0000"; | |||
char something[] = "00"; | |||
char chksm[] = "00"; | |||
unsigned int currentByte = 0; | |||
progSize = 0; | |||
uint8_t linelength = 0; | |||
boolean fileEnd = false; | |||
unsigned short tadrs; | |||
tadrs = adrs = 0x4000; | |||
correct = true; | |||
unsigned long pgmStartTime = millis(); | |||
eraseChip(); // erase chip | |||
char words = (type!=Tiny4_5?type:1); | |||
char b1, b2; | |||
// read in the data and | |||
while(!fileEnd){ | |||
startTime = millis(); | |||
while(Serial.available() < 1){ | |||
if(millis()-startTime > timeout){ | |||
ERROR_data(TimeOut); | |||
return false; | |||
} | |||
if(pgmStartTime == 0) | |||
pgmStartTime = millis(); | |||
} | |||
if(Sread() != ':'){ // maybe it was a newline?? | |||
if(Sread() != ':'){ | |||
ERROR_data(HexError); | |||
return false; | |||
} | |||
} | |||
// read data length | |||
datlength[0] = Sread(); | |||
datlength[1] = Sread(); | |||
linelength = byteval(datlength[0], datlength[1]); | |||
// read address. if "0000" currentByte = 0 | |||
addr[0] = Sread(); | |||
addr[1] = Sread(); | |||
addr[2] = Sread(); | |||
addr[3] = Sread(); | |||
if(linelength != 0x00 && addr[0]=='0' && addr[1]=='0' && addr[2]=='0' && addr[3]=='0') | |||
currentByte = 0; | |||
// read type thingy. "01" means end of file | |||
something[0] = Sread(); | |||
something[1] = Sread(); | |||
if(something[1] == '1'){ | |||
fileEnd = true; | |||
} | |||
if(something[1] == '2'){ | |||
for (int i = 0; i<=linelength; i++){ | |||
Sread(); | |||
Sread(); | |||
} | |||
} | |||
else{ | |||
// read in the data | |||
for(int k=0; k<linelength; k++){ | |||
while(Serial.available() < 1){ | |||
if(millis()-startTime > timeout){ | |||
ERROR_data(TimeOut); | |||
return false; | |||
} | |||
} | |||
b1=Sread(); | |||
b2=Sread(); | |||
data[currentByte] = byteval(b1, b2); | |||
currentByte++; | |||
progSize++; | |||
if(progSize > (type!=Tiny4_5?type*1024:512)){ | |||
ERROR_data(TooLarge); | |||
return 0; | |||
} | |||
if(fileEnd) //has the end of the file been reached? | |||
while(currentByte < 2 * words){// append zeros to align the word count to program | |||
data[currentByte] = 0; | |||
currentByte++; | |||
} | |||
if( currentByte == 2 * words ){// is the word/Dword/Qword here? | |||
currentByte = 0; // yes, reset counter | |||
setPointer(tadrs); // point to the address to program | |||
writeIO(NVMCMD, NVM_WORD_WRITE); | |||
for(int i = 0; i<2 * words; i+=2){// loop for each word size depending on micro | |||
// now write a word to program memory | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(data[i]); // LSB first | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(data[i+1]); // then MSB | |||
SPI.transfer(0xff); //send idle between words | |||
SPI.transfer(0xff); //send idle between words | |||
} | |||
while((readIO(NVMCSR) & (1<<7)) != 0x00){} // wait for write to finish | |||
writeIO(NVMCMD, NVM_NOP); | |||
SPI.transfer(0xff); | |||
SPI.transfer(0xff); | |||
//verify written words | |||
setPointer(tadrs); | |||
for (int c = 0; c < 2 * words; c++){ | |||
tpi_send_byte(SLDp); | |||
b = tpi_receive_byte(); // get data byte | |||
if(b != data[c]){ | |||
correct = false; | |||
Serial.println(F("program error:")); | |||
Serial.print(F("byte ")); | |||
outHex(adrs, 4); | |||
Serial.print(F(" expected ")); | |||
outHex(data[c],2); | |||
Serial.print(F(" read ")); | |||
outHex(b,2); | |||
Serial.println(); | |||
if(!correct) | |||
return false; | |||
} | |||
} | |||
tadrs += 2 * words; | |||
} | |||
} | |||
// read in the checksum. | |||
startTime = millis(); | |||
while(Serial.available() == 0){ | |||
if(millis()-startTime > timeout){ | |||
ERROR_data(TimeOut); | |||
return false; | |||
} | |||
} | |||
chksm[0] = Sread(); | |||
chksm[1] = Sread(); | |||
} | |||
} | |||
// the program was successfully written | |||
Serial.print(F("Successfully wrote program: ")); | |||
Serial.print(progSize, DEC); | |||
Serial.print(F(" of ")); | |||
if(type != Tiny4_5) | |||
Serial.print(1024 * type, DEC); | |||
else | |||
Serial.print(512, DEC); | |||
Serial.print(F(" bytes\n in ")); | |||
Serial.print((millis()-pgmStartTime)/1000.0,DEC); | |||
Serial.print(F(" Seconds")); | |||
// digitalWrite(SS, HIGH); // release RESET | |||
return true; | |||
} | |||
void eraseChip(){ | |||
// initialize memory pointer register | |||
setPointer(0x4001); // need the +1 for chip erase | |||
// erase the chip | |||
writeIO(NVMCMD, NVM_CHIP_ERASE); | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xAA); | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xAA); | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xAA); | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xAA); | |||
while((readIO(NVMCSR) & (1<<7)) != 0x00){ | |||
// wait for erasing to finish | |||
} | |||
Serial.println(F("chip erased")); | |||
} | |||
void setConfig(boolean val){ | |||
// get current config byte | |||
setPointer(0x3F40); | |||
tpi_send_byte(SLD); | |||
b = tpi_receive_byte(); | |||
Serial.println(F("input one of these letters")); | |||
Serial.println(F("c = system clock output")); | |||
Serial.println(F("w = watchdog timer on")); | |||
Serial.println(F("r = disable reset")); | |||
Serial.println(F("x = cancel. don't change anything")); | |||
while(Serial.available() < 1){ | |||
// wait | |||
} | |||
char comnd = Serial.read(); | |||
setPointer(0x3F40); | |||
writeIO(NVMCMD, (val ? NVM_WORD_WRITE : NVM_SECTION_ERASE) ); | |||
if(comnd == 'c'){ | |||
tpi_send_byte(SSTp); | |||
if(val){ | |||
tpi_send_byte(b & 0b11111011); | |||
}else{ | |||
tpi_send_byte(b | 0x04); | |||
} | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xFF); | |||
}else if(comnd == 'w'){ | |||
tpi_send_byte(SSTp); | |||
if(val){ | |||
tpi_send_byte(b & 0b11111101); | |||
}else{ | |||
tpi_send_byte(b | 0x02); | |||
} | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xFF); | |||
}else if(comnd == 'r'){ | |||
tpi_send_byte(SSTp); | |||
if(val){ | |||
tpi_send_byte(b & 0b11111110); | |||
}else{ | |||
tpi_send_byte(b | 0x01); | |||
} | |||
tpi_send_byte(SSTp); | |||
tpi_send_byte(0xFF); | |||
}else if(comnd == 'x'){ | |||
// do nothing | |||
}else{ | |||
Serial.println(F("received unknown command. Cancelling")); | |||
} | |||
while((readIO(NVMCSR) & (1<<7)) != 0x00){ | |||
// wait for write to finish | |||
} | |||
writeIO(NVMCMD, NVM_NOP); | |||
SPI.transfer(0xff); | |||
SPI.transfer(0xff); | |||
if(comnd != 'x'){ | |||
Serial.print(F("\n\nSuccessfully ")); | |||
if(val) | |||
Serial.print(F("Set ")); | |||
else | |||
Serial.print(F("Cleared ")); | |||
Serial.print(F("\"")); | |||
if(comnd == 'w') | |||
Serial.print(F("Watchdog")); | |||
else if(comnd == 'c') | |||
Serial.print(F("Clock Output")); | |||
else if(comnd == 'r') | |||
Serial.print(F("Reset")); | |||
Serial.println(F("\" Flag\n")); | |||
} | |||
} | |||
void finish(){ | |||
writeCSS(0x00, 0x00); | |||
SPI.transfer(0xff); | |||
SPI.transfer(0xff); | |||
hvReset(HIGH); | |||
// digitalWrite(SS, HIGH); // release RESET | |||
delay(1); // t_RST min = 400 ns @ Vcc = 5 V | |||
SPI.end(); | |||
DDRB &= 0b11000011; //tri-state spi so target can be tested | |||
PORTB &= 0b11000011; | |||
} | |||
void checkID(){ | |||
// check the device ID | |||
uint8_t id1, id2, id3; | |||
setPointer(0x3FC0); | |||
tpi_send_byte(SLDp); | |||
id1 = tpi_receive_byte(); | |||
tpi_send_byte(SLDp); | |||
id2 = tpi_receive_byte(); | |||
tpi_send_byte(SLDp); | |||
id3 = tpi_receive_byte(); | |||
if(id1==0x1E && id2==0x8F && id3==0x0A){ | |||
Serial.print(F("ATtiny4")); | |||
type = Tiny4_5; | |||
}else if(id1==0x1E && id2==0x8F && id3==0x09){ | |||
Serial.print(F("ATtiny5")); | |||
type = Tiny4_5; | |||
}else if(id1==0x1E && id2==0x90 && id3==0x08){ | |||
Serial.print(F("ATtiny9")); | |||
type = Tiny9; | |||
}else if(id1==0x1E && id2==0x90 && id3==0x03){ | |||
Serial.print(F("ATtiny10")); | |||
type = Tiny10; | |||
}else if(id1==0x1E && id2==0x91 && id3==0x0f){ | |||
Serial.print(F("ATtiny20")); | |||
type = Tiny20; | |||
}else if(id1==0x1E && id2==0x92 && id3==0x0e){ | |||
Serial.print(F("ATtiny40")); | |||
type = Tiny40; | |||
}else{ | |||
Serial.print(F("Unknown chip")); | |||
} | |||
Serial.println(F(" connected")); | |||
} | |||
/* | |||
* send a byte in one TPI frame (12 bits) | |||
* (1 start + 8 data + 1 parity + 2 stop) | |||
* using 2 SPI data bytes (2 x 8 = 16 clocks) | |||
* (with 4 extra idle bits) | |||
*/ | |||
void tpi_send_byte( uint8_t data ){ | |||
// compute partiy bit | |||
uint8_t par = data; | |||
par ^= (par >> 4); // b[7:4] (+) b[3:0] | |||
par ^= (par >> 2); // b[3:2] (+) b[1:0] | |||
par ^= (par >> 1); // b[1] (+) b[0] | |||
// REMEMBER: this is in LSBfirst mode and idle is high | |||
// (2 idle) + (1 start bit) + (data[4:0]) | |||
SPI.transfer(0x03 | (data << 3)); | |||
// (data[7:5]) + (1 parity) + (2 stop bits) + (2 idle) | |||
SPI.transfer(0xf0 | (par << 3) | (data >> 5)); | |||
} // end tpi_send_byte() | |||
/* | |||
* receive TPI 12-bit format byte data | |||
* via SPI 2 bytes (16 clocks) or 3 bytes (24 clocks) | |||
*/ | |||
uint8_t tpi_receive_byte( void ){ | |||
//uint8_t b1, b2, b3; | |||
// keep transmitting high(idle) while waiting for a start bit | |||
do { | |||
b1 = SPI.transfer(0xff); | |||
} while (0xff == b1); | |||
// get (partial) data bits | |||
b2 = SPI.transfer(0xff); | |||
// if the first byte(b1) contains less than 4 data bits | |||
// we need to get a third byte to get the parity and stop bits | |||
if (0x0f == (0x0f & b1)) { | |||
b3 = SPI.transfer(0xff); | |||
} | |||
// now shift the bits into the right positions | |||
// b1 should hold only idle and start bits = 0b01111111 | |||
while (0x7f != b1) { // data not aligned | |||
b2 <<= 1; // shift left data bits | |||
if (0x80 & b1) { // carry from 1st byte | |||
b2 |= 1; // set bit | |||
} | |||
b1 <<= 1; | |||
b1 |= 0x01; // fill with idle bit (1) | |||
} | |||
// now the data byte is stored in b2 | |||
return( b2 ); | |||
} // end tpi_receive_byte() | |||
// send the 64 bit NVM key | |||
void send_skey(uint64_t nvm_key){ | |||
tpi_send_byte(SKEY); | |||
while(nvm_key){ | |||
tpi_send_byte(nvm_key & 0xFF); | |||
nvm_key >>= 8; | |||
} | |||
} // end send_skey() | |||
// sets the pointer address | |||
void setPointer(unsigned short address){ | |||
adrs = address; | |||
tpi_send_byte(SSTPRL); | |||
tpi_send_byte(address & 0xff); | |||
tpi_send_byte(SSTPRH); | |||
tpi_send_byte((address>>8) & 0xff); | |||
} | |||
// writes using SOUT | |||
void writeIO(uint8_t address, uint8_t value){ | |||
// SOUT 0b1aa1aaaa replace a with 6 address bits | |||
tpi_send_byte(0x90 | (address & 0x0F) | ((address & 0x30) << 1)); | |||
tpi_send_byte(value); | |||
} | |||
// reads using SIN | |||
uint8_t readIO(uint8_t address){ | |||
// SIN 0b0aa1aaaa replace a with 6 address bits | |||
tpi_send_byte(0x10 | (address & 0x0F) | ((address & 0x30) << 1)); | |||
return tpi_receive_byte(); | |||
} | |||
// writes to CSS | |||
void writeCSS(uint8_t address, uint8_t value){ | |||
tpi_send_byte(0xC0 | address); | |||
tpi_send_byte(value); | |||
} | |||
// reads from CSS | |||
uint8_t readCSS(uint8_t address){ | |||
tpi_send_byte(0x80 | address); | |||
return tpi_receive_byte(); | |||
} | |||
// converts two chars to one byte | |||
// c1 is MS, c2 is LS | |||
uint8_t byteval(char c1, char c2){ | |||
uint8_t by; | |||
if(c1 <= '9'){ | |||
by = c1-'0'; | |||
}else{ | |||
by = c1-'A'+10; | |||
} | |||
by = by << 4; | |||
if(c2 <= '9'){ | |||
by += c2-'0'; | |||
}else{ | |||
by += c2-'A'+10; | |||
} | |||
return by; | |||
} | |||
char Sread(void){ | |||
while(Serial.available()<1){} | |||
return Serial.read(); | |||
} | |||
void outHex(unsigned int n, char l){ // call with the number to be printed, and # of nibbles expected. | |||
for(char count = l-1; count > 0;count--){ // quick and dirty to add zeros to the hex value | |||
if(((n >> (count*4)) & 0x0f) == 0) // if MSB is 0 | |||
Serial.print(F("0")); //prepend a 0 | |||
else | |||
break; //exit the for loop | |||
} | |||
Serial.print(n, HEX); | |||
} | |||
// end of file |
@ -0,0 +1,73 @@ | |||
; | |||
; tinyblink | |||
; Blinks an LED on pin 4 (PB2) | |||
; | |||
.DEVICE ATtiny10 | |||
; variables | |||
.EQU delayMult1 = 0xff ; the delay is delay3*delaymult2*delaymult1 | |||
.EQU delayMult2 = 0xff | |||
.EQU delayMult3 = 0x0f | |||
.CSEG ; code section | |||
.ORG $0000 ; the starting address | |||
main: | |||
; set up the stack | |||
ldi r16, high(RAMEND) | |||
out SPH, r16 | |||
ldi r16, low(RAMEND) | |||
out SPL, r16 | |||
; set clock divider | |||
ldi r16, 0x00 ; clock divided by 1 | |||
ldi r17, 0xD8 ; the key for CCP | |||
out CCP, r17 ; Configuration Change Protection, allows protected changes | |||
out CLKPSR, r16 ; sets the clock divider | |||
; initialize port | |||
ldi r16, 1<<PB2 ; sets pin 4 (PB2) to putput | |||
out DDRB, r16 ; data direction | |||
ldi r16, 0x00 ; sets all pins low | |||
out PORTB, r16 | |||
; nop for sync | |||
nop | |||
loop: | |||
; turn on and delay | |||
ldi r16, (1<<PB2) | |||
out PORTB, r16 | |||
rcall delay | |||
; turn off and delay | |||
ldi r16, 0x00 | |||
out PORTB, r16 | |||
rcall delay | |||
rjmp loop | |||
delay: | |||
; not really needed, but keep r16-r18 | |||
push r16 | |||
push r17 | |||
push r18 | |||
ldi r16, delayMult1 | |||
ldi r17, delayMult2 | |||
ldi r18, delayMult3 | |||
; start delay loop | |||
delayLoop: | |||
subi r16, 1 ; subtract 1 | |||
sbci r17, 0 ; if r16 was 0, subtract 1 | |||
sbci r18, 0 ; if r17 was 0, subtract 1 | |||
brne delayLoop ; while r18 is not 0, loop | |||
; end delay loop | |||
pop r17 | |||
pop r16 | |||
pop r18 | |||
ret | |||