Browse Source

gitup

master
Your Name 8 months ago
parent
commit
79b18960e8
38 changed files with 3860 additions and 2 deletions
  1. +1
    -1
      60hz_Divider/docs/15.log
  2. BIN
      60hz_Divider/docs/15.pdf
  3. +15
    -0
      60hz_Divider/docs/16.aux
  4. +295
    -0
      60hz_Divider/docs/16.log
  5. BIN
      60hz_Divider/docs/16.pdf
  6. +140
    -0
      60hz_Divider/docs/16.tex
  7. +122
    -0
      60hz_Divider/docs/16.tex~
  8. +12
    -0
      60hz_Divider/docs/16.toc
  9. +15
    -0
      60hz_Divider/docs/17.aux
  10. +311
    -0
      60hz_Divider/docs/17.log
  11. BIN
      60hz_Divider/docs/17.pdf
  12. +191
    -0
      60hz_Divider/docs/17.tex
  13. +140
    -0
      60hz_Divider/docs/17.tex~
  14. +12
    -0
      60hz_Divider/docs/17.toc
  15. +15
    -0
      60hz_Divider/docs/18.aux
  16. +311
    -0
      60hz_Divider/docs/18.log
  17. BIN
      60hz_Divider/docs/18.pdf
  18. +195
    -0
      60hz_Divider/docs/18.tex
  19. +191
    -0
      60hz_Divider/docs/18.tex~
  20. +12
    -0
      60hz_Divider/docs/18.toc
  21. +15
    -0
      60hz_Divider/docs/19.aux
  22. +311
    -0
      60hz_Divider/docs/19.log
  23. BIN
      60hz_Divider/docs/19.pdf
  24. +195
    -0
      60hz_Divider/docs/19.tex
  25. +195
    -0
      60hz_Divider/docs/19.tex~
  26. +12
    -0
      60hz_Divider/docs/19.toc
  27. +15
    -0
      60hz_Divider/docs/20.aux
  28. +310
    -0
      60hz_Divider/docs/20.log
  29. BIN
      60hz_Divider/docs/20.pdf
  30. +195
    -0
      60hz_Divider/docs/20.tex
  31. +195
    -0
      60hz_Divider/docs/20.tex~
  32. +12
    -0
      60hz_Divider/docs/20.toc
  33. +1
    -1
      Log_Viewer/docs/5.log
  34. BIN
      Log_Viewer/docs/5.pdf
  35. +6
    -0
      Log_Viewer/docs/6.aux
  36. +329
    -0
      Log_Viewer/docs/6.log
  37. BIN
      Log_Viewer/docs/6.pdf
  38. +91
    -0
      Log_Viewer/docs/6.tex

+ 1
- 1
60hz_Divider/docs/15.log View File

@ -1,4 +1,4 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 3 AUG 2020 03:08
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 24 AUG 2020 01:03
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.

BIN
60hz_Divider/docs/15.pdf View File


+ 15
- 0
60hz_Divider/docs/16.aux View File

@ -0,0 +1,15 @@
\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}60Hz Divider}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Overview}{1}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces 60 Hz Logic Divider to 1Hz\relax }}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Initial Notes: Counting the Hz}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}MAX7219 8 digit 7 LED segment Display Driver}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.4}CPLD Programming}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.1}6KHz clock}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.2}UART output}{3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5}Divide by N Counters}{4}}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.\relax }}{4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.6}Attiny 6KHz Clock}{4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.7}Parsing of CPLD UART Stream}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8}Max7219 8 digit 7-Segment Display}{6}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Project Rev A Complete}{6}}

+ 295
- 0
60hz_Divider/docs/16.log View File

@ -0,0 +1,295 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 24 AUG 2020 01:50
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/
60hz_Divider/docs/16.tex
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/6
0hz_Divider/docs/16.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
) (./16.aux)
\openout1 = `16.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)
(./16.toc
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 2.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 2.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 2.
)
\tf@toc=\write3
\openout3 = `16.toc'.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <9> on input line 24.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 24.
<../pics/DSCN2964.JPG, id=1, 1003.75pt x 752.8125pt>
File: ../pics/DSCN2964.JPG Graphic file (type jpg)
<use ../pics/DSCN2964.JPG>
Package pdftex.def Info: ../pics/DSCN2964.JPG used on input line 26.
(pdftex.def) Requested size: 150.556pt x 112.91699pt.
[1
Non-PDF special ignored!
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map} <../pics/DSCN2964.JPG>]
Overfull \hbox (88.69052pt too wide) in paragraph at lines 65--65
[] \OT1/cmtt/m/n/10.95 ***** These pin numbers will probably not work with your
hardware *****[]
[]
[2] <../pics/DSCN2958.JPG, id=17, 1003.75pt x 752.8125pt>
File: ../pics/DSCN2958.JPG Graphic file (type jpg)
<use ../pics/DSCN2958.JPG>
Package pdftex.def Info: ../pics/DSCN2958.JPG used on input line 88.
(pdftex.def) Requested size: 200.74644pt x 150.55983pt.
[3] [4 <../pics/DSCN2958.JPG>] [5]
Overfull \hbox (13.65749pt too wide) in paragraph at lines 127--128
\OT1/cmr/m/n/10.95 Reference: http://maxembedded.com/2011/06/port-operations-in
-avr/
[]
[6] (./16.aux) )
Here is how much of TeX's memory you used:
3528 strings out of 494945
53560 string characters out of 6181032
118035 words of memory out of 5000000
6801 multiletter control sequences out of 15000+600000
8977 words of font info for 32 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
39i,8n,39p,694b,267s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/c
mbx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.
pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></u
sr/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-d
ist/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on 16.pdf (6 pages, 488191 bytes).
PDF statistics:
53 PDF objects out of 1000 (max. 8388607)
35 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
11 words of extra memory for PDF output out of 10000 (max. 10000000)

BIN
60hz_Divider/docs/16.pdf View File


+ 140
- 0
60hz_Divider/docs/16.tex View File

@ -0,0 +1,140 @@
\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{}}
\author{Steak Electronics}
\date{}
\begin{document}
%\maketitle
\tableofcontents
\textcolor{green!60!blue!70}{
\section{60Hz Divider}}
\subsection{Overview}
Let's count. There is a schematic in Practical Electronics For Beginners 4th edition. I've built that up, and will add some CPLD counter logic, along with a micro to output the SPI to a 7seg counter module.
The goal is relative accuracy. Not absolute. No GPS here. I'm going from 60 to 6,000 cycles.\footnote{Due to limitations of CPLD} This is just meant to be fun.
\begin{center}
\includegraphics[scale=0.15]{../pics/DSCN2964.JPG}
\captionof{figure}{60 Hz Logic Divider to 1Hz}
\end{center}
\subsection{Initial Notes: Counting the Hz}
pseudo code goal:
\begin{verbatim}
Using 1Hz signal
Start counting 1MHz every 1Hz
when next cycle is received,
display count
start counting again
\end{verbatim}
That's all the objective is here. Easy with a micro, but goal is to complete using cmos or 74 logic.
4553 x 5
74hct132
1MHz clock (or 6MHz clock), or some variation thereof
jk flip flop
74376 - quad jk flip flop
7476 - jk flip flop
1mhz clk will be main counter,
6 hz or 1 hz will be latch / reset
I ended up skipping the 74 CMOS, in favor of a CPLD. Practical Electronics also mentions this approach as favored. Even a micro alone could be used. Schematic entry in the CPLD could also be used.
\subsection{MAX7219 8 digit 7 LED segment Display Driver}
Basic code tested with this was the LedControl arduino library.
\begin{verbatim}
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
\end{verbatim}
Some of the lines have to be edited to allow for all digits to be read, and
also to lower intensity of display. I think also a component package (dark
grey clear plastic bag) in front of the leds with intensity 1 is about right.
\subsection{CPLD Programming}
Using the XC9500XL series. This chip has some limitations - which are good.
As you get faster clocks, you need bigger registers to handle parsing the clocks. Bigger registers, use more power. Maybe this is one reason why high clock speeds mean more power.
\subsubsection{6KHz clock}
Due to limitations of the XC9500XL FPGA logic blocks, I ended up limiting the counter registers to 12+1 bits\footnote{Possibly I could use multiple smaller registers in a type of cascade, but let's not bother with that for now. I had 600KHz resolution, until I added the UART out/}, so I have around 6,000 (assuming 60Hz), resolution. With this, I need a 6KHz clock. I could do this with the uno, but let's throw an attiny in there because it's a good tool for this kind of purpose and resolution. It should be able to function as a rough 6KHz timer, easily.
\subsubsection{UART output}
I set the CPLD to use the rising edge of the 6KHz clock and to shift the counter value out... Unsuprisingly, the baud rate is 6000. I found this by using my Open Bench Logic Sniffer\footnote{Phantom 3 in Repairs 2019}. It's fairly quick to configure and get working. Auto detected the UART speed easy.
However, my uart value is 12 - 14 bits, and with uart being an 8 bit protocol, it makes this unconventional. May need to bit bang something. But before that...
\subsection{Divide by N Counters}
\begin{center}
\includegraphics[scale=0.2]{../pics/DSCN2958.JPG}
\captionof{figure}{This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.}
\end{center}
The schematics appear to be incorrect for the divide by 6 counter in the Practical Electronics for Beginners book. Having looked at my built up circuit carefully, I see a 20Hz output from the 60Hz. I managed to get my hands on a copy of the TTL Cookbook by Don Lancaster recently, and that details correct divide by 6 and 10 counters (which are different from what's on my proto board), and while I could fix the divide by 6 counter, instead, I'm going to build another divide by 2 counter, and leave the original incorrect one there as a warning (it's also easier to just build a new one).
As it is, I'm getting 2Hz output on the pulse pin... Oops. Practical Untested Electronics for Beginners. Hax. Everything in life is hax. The earlier you realize that, the better you will feel about your own work.\footnote{It's possible they put the error in on purpose. It's really hard to tell...}
\subsection{Attiny 6KHz Clock}
A small victory here: I setup an Attiny10 with an external oscillator (programmable CMOS, not Quartz) of 1.536MHz. I then set prescaler at 256 to get
6000. Set micro fuse to enable CKOUT pin, and now I have a 6KHz clock from the 20 cent micro plus. Neat usage of the attiny10 here, thanks
to my other project using it. The CPLD works with it, no problem.
\subsection{Parsing of CPLD UART Stream}
I have the UART stream feeding into the Atmega328/Uno. For the code, I was unsure how to handle it at first, but then I realized a simple shift in would fit.
\textbf{Situation:} I have a serial UART stream at 6000 baud from the CPLD. However, it's not exactly UART. In fact, it has values of 6000, which are over 8 bit. So I have a 14 bit serial stream. There is no stop bit after the 8 bits, and no two 8 bit bytes. So hardware serial will not work.
\textbf{Solution:} I have a serial 14 bit stream at 6000 baud. The answer is to tie the 6000 Hz CLK to a pin on the Uno, and implement a shift in, so that every clock up, the value is read on the Serial / 14 bit pin.
\textbf{Problems:} The timing is not 100\% As a result, some values are being read incorrectly. 5996 shows up as 5048 or similar. This is likely because I quickly prototyped with digitalRead. I need to go back and access the Input direct via register reads to speed things up. A Pin register access similar to:
\begin{verbatim}
Example Code Snippet
Let's demonstrate the use of the DDRx,
PORTx and PINx registers from the
following code snippet:
DDRC = 0x0F;
PORTC = 0x0C;
// lets assume a 4V supply comes to PORTC.6 and Vcc = 5V
if (PINC == 0b01000000)
PORTC = 0x0B;
else
PORTC = 0x00;
\end{verbatim}
Reference: http://maxembedded.com/2011/06/port-operations-in-avr/
may fix these issues. In the meantime, because the errors are consistent, I setup some LUTs\footnote{Lookup tables, i.e. hard coded fixes. 5048 now converts to 5996.}.
\subsection{Max7219 8 digit 7-Segment Display}
I've
\section{Project Rev A Complete}
After another night or two of work, I have a working prototype.
\end{document}

+ 122
- 0
60hz_Divider/docs/16.tex~ View File

@ -0,0 +1,122 @@
\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{}}
\author{Steak Electronics}
\date{}
\begin{document}
%\maketitle
\tableofcontents
\textcolor{green!60!blue!70}{
\section{60Hz Divider}}
\subsection{Overview}
Let's count. There is a schematic in Practical Electronics For Beginners 4th edition. I've built that up, and will add some CPLD counter logic, along with a micro to output the SPI to a 7seg counter module.
The goal is relative accuracy. Not absolute. No GPS here. I'm going from 60 to 6,000 cycles.\footnote{Due to limitations of CPLD} This is just meant to be fun.
\begin{center}
\includegraphics[scale=0.15]{../pics/DSCN2964.JPG}
\captionof{figure}{60 Hz Logic Divider to 1Hz}
\end{center}
\subsection{Initial Notes: Counting the Hz}
pseudo code goal:
\begin{verbatim}
Using 1Hz signal
Start counting 1MHz every 1Hz
when next cycle is received,
display count
start counting again
\end{verbatim}
That's all the objective is here. Easy with a micro, but goal is to complete using cmos or 74 logic.
4553 x 5
74hct132
1MHz clock (or 6MHz clock), or some variation thereof
jk flip flop
74376 - quad jk flip flop
7476 - jk flip flop
1mhz clk will be main counter,
6 hz or 1 hz will be latch / reset
I ended up skipping the 74 CMOS, in favor of a CPLD. Practical Electronics also mentions this approach as favored. Even a micro alone could be used. Schematic entry in the CPLD could also be used.
\subsection{MAX7219 8 digit 7 LED segment Display Driver}
Basic code tested with this was the LedControl arduino library.
\begin{verbatim}
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
\end{verbatim}
Some of the lines have to be edited to allow for all digits to be read, and
also to lower intensity of display. I think also a component package (dark
grey clear plastic bag) in front of the leds with intensity 1 is about right.
\subsection{CPLD Programming}
Using the XC9500XL series. This chip has some limitations - which are good.
As you get faster clocks, you need bigger registers to handle parsing the clocks. Bigger registers, use more power. Maybe this is one reason why high clock speeds mean more power.
\subsubsection{6KHz clock}
Due to limitations of the XC9500XL FPGA logic blocks, I ended up limiting the counter registers to 12+1 bits\footnote{Possibly I could use multiple smaller registers in a type of cascade, but let's not bother with that for now. I had 600KHz resolution, until I added the UART out/}, so I have around 6,000 (assuming 60Hz), resolution. With this, I need a 6KHz clock. I could do this with the uno, but let's throw an attiny in there because it's a good tool for this kind of purpose and resolution. It should be able to function as a rough 6KHz timer, easily.
\subsubsection{UART output}
I set the CPLD to use the rising edge of the 6KHz clock and to shift the counter value out... Unsuprisingly, the baud rate is 6000. I found this by using my Open Bench Logic Sniffer\footnote{Phantom 3 in Repairs 2019}. It's fairly quick to configure and get working. Auto detected the UART speed easy.
However, my uart value is 12 - 14 bits, and with uart being an 8 bit protocol, it makes this unconventional. May need to bit bang something. But before that...
\subsection{Divide by N Counters}
\begin{center}
\includegraphics[scale=0.2]{../pics/DSCN2958.JPG}
\captionof{figure}{This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.}
\end{center}
The schematics appear to be incorrect for the divide by 6 counter in the Practical Electronics for Beginners book. Having looked at my built up circuit carefully, I see a 20Hz output from the 60Hz. I managed to get my hands on a copy of the TTL Cookbook by Don Lancaster recently, and that details correct divide by 6 and 10 counters (which are different from what's on my proto board), and while I could fix the divide by 6 counter, instead, I'm going to build another divide by 2 counter, and leave the original incorrect one there as a warning (it's also easier to just build a new one).
As it is, I'm getting 2Hz output on the pulse pin... Oops. Practical Untested Electronics for Beginners. Hax. Everything in life is hax. The earlier you realize that, the better you will feel about your own work.\footnote{It's possible they put the error in on purpose. It's really hard to tell...}
\subsection{Attiny 6KHz Clock}
A small victory here: I setup an Attiny10 with an external oscillator (programmable CMOS, not Quartz) of 1.536MHz. I then set prescaler at 256 to get
6000. Set micro fuse to enable CKOUT pin, and now I have a 6KHz clock from the 20 cent micro plus. Neat usage of the attiny10 here, thanks
to my other project using it. The CPLD works with it, no problem.
\subsection{Parsing of CPLD UART Stream}
I have the UART stream feeding into the Atmega328/Uno. For the code, I was unsure how to handle it at first, but then I realized a simple shift in would fit.
\textbf{Situation:} I have a serial UART stream at 6000 baud from the CPLD. However, it's not exactly UART. In fact, it has values of 6000, which are over 8 bit. So I have a 14 bit serial stream. There is no stop bit after the 8 bits, and no two 8 bit bytes. So hardware serial will not work.
\textbf{Solution:} I have a serial 14 bit stream at 6000 baud. The answer is to tie the 6000 Hz CLK to a pin on the Uno, and implement a shift in, so that every clock up, the value is read on the Serial / 14 bit pin.
\textbf{Problems:} The timing is not 100\% As a result, some values are being read incorrectly. 5996 shows up as 5048 or similar. This is likely because I quickly prototyped with digitalRead. I need to go back and access the Input direct via register reads to speed things up. A Pin register access similar to:
\begin{verbatim}
\end{verbatim}
may fix these issues.
\section{Project Rev A Complete}
After another night or two of work, I have a working prototype.
\end{document}

+ 12
- 0
60hz_Divider/docs/16.toc View File

@ -0,0 +1,12 @@
\contentsline {section}{\numberline {1}60Hz Divider}{1}
\contentsline {subsection}{\numberline {1.1}Overview}{1}
\contentsline {subsection}{\numberline {1.2}Initial Notes: Counting the Hz}{2}
\contentsline {subsection}{\numberline {1.3}MAX7219 8 digit 7 LED segment Display Driver}{2}
\contentsline {subsection}{\numberline {1.4}CPLD Programming}{3}
\contentsline {subsubsection}{\numberline {1.4.1}6KHz clock}{3}
\contentsline {subsubsection}{\numberline {1.4.2}UART output}{3}
\contentsline {subsection}{\numberline {1.5}Divide by N Counters}{4}
\contentsline {subsection}{\numberline {1.6}Attiny 6KHz Clock}{4}
\contentsline {subsection}{\numberline {1.7}Parsing of CPLD UART Stream}{5}
\contentsline {subsection}{\numberline {1.8}Max7219 8 digit 7-Segment Display}{6}
\contentsline {section}{\numberline {2}Project Rev A Complete}{6}

+ 15
- 0
60hz_Divider/docs/17.aux View File

@ -0,0 +1,15 @@
\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}60Hz Divider}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Overview}{1}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces 60 Hz Logic Divider to 1Hz\relax }}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Initial Notes: Counting the Hz}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}MAX7219 8 digit 7 LED segment Display Driver}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.4}CPLD Programming}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.1}6KHz clock}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.2}UART output}{3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5}Divide by N Counters}{4}}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.\relax }}{4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.6}Attiny 6KHz Clock}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.7}Parsing of CPLD UART Stream}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8}Max7219 8 digit 7-Segment Display via Uno}{6}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Project Rev A Complete}{7}}

+ 311
- 0
60hz_Divider/docs/17.log View File

@ -0,0 +1,311 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 24 AUG 2020 01:57
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/
60hz_Divider/docs/17.tex
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/6
0hz_Divider/docs/17.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
) (./17.aux)
\openout1 = `17.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)
(./17.toc
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 2.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 2.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 2.
)
\tf@toc=\write3
\openout3 = `17.toc'.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <9> on input line 24.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 24.
<../pics/DSCN2964.JPG, id=1, 1003.75pt x 752.8125pt>
File: ../pics/DSCN2964.JPG Graphic file (type jpg)
<use ../pics/DSCN2964.JPG>
Package pdftex.def Info: ../pics/DSCN2964.JPG used on input line 26.
(pdftex.def) Requested size: 150.556pt x 112.91699pt.
[1
Non-PDF special ignored!
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
Overfull \hbox (88.69052pt too wide) in paragraph at lines 65--65
[] \OT1/cmtt/m/n/10.95 ***** These pin numbers will probably not work with your
hardware *****[]
[]
[2 <../pics/DSCN2964.JPG>] [3]
<../pics/DSCN2958.JPG, id=20, 1003.75pt x 752.8125pt>
File: ../pics/DSCN2958.JPG Graphic file (type jpg)
<use ../pics/DSCN2958.JPG>
Package pdftex.def Info: ../pics/DSCN2958.JPG used on input line 88.
(pdftex.def) Requested size: 200.74644pt x 150.55983pt.
[4 <../pics/DSCN2958.JPG>] [5]
Overfull \hbox (13.65749pt too wide) in paragraph at lines 127--128
\OT1/cmr/m/n/10.95 Reference: http://maxembedded.com/2011/06/port-operations-in
-avr/
[]
Overfull \hbox (19.70627pt too wide) in paragraph at lines 170--170
[]\OT1/cmtt/m/n/10.95 //https://playground.arduino.cc/Main/LedControl/#Seg7Cont
rol[]
[]
[6]
LaTeX Font Info: Try loading font information for OMS+cmr on input line 179.
(/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 179.
[7] [8] (./17.aux) )
Here is how much of TeX's memory you used:
3544 strings out of 494945
53853 string characters out of 6181032
119035 words of memory out of 5000000
6815 multiletter control sequences out of 15000+600000
8977 words of font info for 32 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
39i,8n,39p,694b,291s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts
/cm/cmbx10.pfb></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/cmr6.pfb></usr/
share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/te
xlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-di
st/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on 17.pdf (8 pages, 499283 bytes).
PDF statistics:
65 PDF objects out of 1000 (max. 8388607)
44 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
11 words of extra memory for PDF output out of 10000 (max. 10000000)

BIN
60hz_Divider/docs/17.pdf View File


+ 191
- 0
60hz_Divider/docs/17.tex View File

@ -0,0 +1,191 @@
\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{}}
\author{Steak Electronics}
\date{}
\begin{document}
%\maketitle
\tableofcontents
\textcolor{green!60!blue!70}{
\section{60Hz Divider}}
\subsection{Overview}
Let's count. There is a schematic in Practical Electronics For Beginners 4th edition. I've built that up, and will add some CPLD counter logic, along with a micro to output the SPI to a 7seg counter module.
The goal is relative accuracy. Not absolute. No GPS here. I'm going from 60 to 6,000 cycles.\footnote{Due to limitations of CPLD} This is just meant to be fun.
\begin{center}
\includegraphics[scale=0.15]{../pics/DSCN2964.JPG}
\captionof{figure}{60 Hz Logic Divider to 1Hz}
\end{center}
\subsection{Initial Notes: Counting the Hz}
pseudo code goal:
\begin{verbatim}
Using 1Hz signal
Start counting 1MHz every 1Hz
when next cycle is received,
display count
start counting again
\end{verbatim}
That's all the objective is here. Easy with a micro, but goal is to complete using cmos or 74 logic.
4553 x 5
74hct132
1MHz clock (or 6MHz clock), or some variation thereof
jk flip flop
74376 - quad jk flip flop
7476 - jk flip flop
1mhz clk will be main counter,
6 hz or 1 hz will be latch / reset
I ended up skipping the 74 CMOS, in favor of a CPLD. Practical Electronics also mentions this approach as favored. Even a micro alone could be used. Schematic entry in the CPLD could also be used.
\subsection{MAX7219 8 digit 7 LED segment Display Driver}
Basic code tested with this was the LedControl arduino library.
\begin{verbatim}
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
\end{verbatim}
Some of the lines have to be edited to allow for all digits to be read, and
also to lower intensity of display. I think also a component package (dark
grey clear plastic bag) in front of the leds with intensity 1 is about right.
\subsection{CPLD Programming}
Using the XC9500XL series. This chip has some limitations - which are good.
As you get faster clocks, you need bigger registers to handle parsing the clocks. Bigger registers, use more power. Maybe this is one reason why high clock speeds mean more power.
\subsubsection{6KHz clock}
Due to limitations of the XC9500XL FPGA logic blocks, I ended up limiting the counter registers to 12+1 bits\footnote{Possibly I could use multiple smaller registers in a type of cascade, but let's not bother with that for now. I had 600KHz resolution, until I added the UART out/}, so I have around 6,000 (assuming 60Hz), resolution. With this, I need a 6KHz clock. I could do this with the uno, but let's throw an attiny in there because it's a good tool for this kind of purpose and resolution. It should be able to function as a rough 6KHz timer, easily.
\subsubsection{UART output}
I set the CPLD to use the rising edge of the 6KHz clock and to shift the counter value out... Unsuprisingly, the baud rate is 6000. I found this by using my Open Bench Logic Sniffer\footnote{Phantom 3 in Repairs 2019}. It's fairly quick to configure and get working. Auto detected the UART speed easy.
However, my uart value is 12 - 14 bits, and with uart being an 8 bit protocol, it makes this unconventional. May need to bit bang something. But before that...
\subsection{Divide by N Counters}
\begin{center}
\includegraphics[scale=0.2]{../pics/DSCN2958.JPG}
\captionof{figure}{This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.}
\end{center}
The schematics appear to be incorrect for the divide by 6 counter in the Practical Electronics for Beginners book. Having looked at my built up circuit carefully, I see a 20Hz output from the 60Hz. I managed to get my hands on a copy of the TTL Cookbook by Don Lancaster recently, and that details correct divide by 6 and 10 counters (which are different from what's on my proto board), and while I could fix the divide by 6 counter, instead, I'm going to build another divide by 2 counter, and leave the original incorrect one there as a warning (it's also easier to just build a new one).
As it is, I'm getting 2Hz output on the pulse pin... Oops. Practical Untested Electronics for Beginners. Hax. Everything in life is hax. The earlier you realize that, the better you will feel about your own work.\footnote{It's possible they put the error in on purpose. It's really hard to tell...}
\subsection{Attiny 6KHz Clock}
A small victory here: I setup an Attiny10 with an external oscillator (programmable CMOS, not Quartz) of 1.536MHz. I then set prescaler at 256 to get
6000. Set micro fuse to enable CKOUT pin, and now I have a 6KHz clock from the 20 cent micro plus. Neat usage of the attiny10 here, thanks
to my other project using it. The CPLD works with it, no problem.
\subsection{Parsing of CPLD UART Stream}
I have the UART stream feeding into the Atmega328/Uno. For the code, I was unsure how to handle it at first, but then I realized a simple shift in would fit.
\textbf{Situation:} I have a serial UART stream at 6000 baud from the CPLD. However, it's not exactly UART. In fact, it has values of 6000, which are over 8 bit. So I have a 14 bit serial stream. There is no stop bit after the 8 bits, and no two 8 bit bytes. So hardware serial will not work.
\textbf{Solution:} I have a serial 14 bit stream at 6000 baud. The answer is to tie the 6000 Hz CLK to a pin on the Uno, and implement a shift in, so that every clock up, the value is read on the Serial / 14 bit pin.
\textbf{Problems:} The timing is not 100\% As a result, some values are being read incorrectly. 5996 shows up as 5048 or similar. This is likely because I quickly prototyped with digitalRead. I need to go back and access the Input direct via register reads to speed things up. A Pin register access similar to:
\begin{verbatim}
Example Code Snippet
Let's demonstrate the use of the DDRx,
PORTx and PINx registers from the
following code snippet:
DDRC = 0x0F;
PORTC = 0x0C;
// lets assume a 4V supply comes to PORTC.6 and Vcc = 5V
if (PINC == 0b01000000)
PORTC = 0x0B;
else
PORTC = 0x00;
\end{verbatim}
Reference: http://maxembedded.com/2011/06/port-operations-in-avr/
may fix these issues. In the meantime, because the errors are consistent, I setup some LUTs\footnote{Lookup tables, i.e. hard coded fixes. 5048 now converts to 5996.}.
\subsection{Max7219 8 digit 7-Segment Display via Uno}
I didn't have any trouble getting the 7 segment to display with the Uno and the Max7219. Note that I avoided outputting the values via the CPLD. The Uno is just quicker to code this output. I used the LedControl library. I had to adopt a quick function to break down the values. The Max7219 does not take in variables, so instead, you feed it single digits. Therefore I needed to extract a single digit from the tens, hundreds, and thousands. See below:
\begin{verbatim}
//https://playground.arduino.cc/Main/LedControl/#Seg7Control
void printNumber(int v) {
int ones;
int tens;
int hundreds;
int thousands;
boolean negative;
if(v < -9999 || v > 9999)
return;
if(v<0) {
negative=true;
v=v*-1;
}
ones=v%10;
v=v/10;
tens=v%10;
v=v/10;
hundreds=v%10;
v=v/10;
thousands=v;
/*if(negative) {
//print character '-' in the leftmost column
lc.setChar(0,4,'-',false);
}
else {
//print a blank in the sign column
lc.setChar(0,4,' ',false);
}*/
//Now print the number digit by digit
lc.setDigit(0,3,(byte)thousands,false);
lc.setDigit(0,2,(byte)hundreds,false);
lc.setDigit(0,1,(byte)tens,false);
lc.setDigit(0,0,(byte)ones,false);
}
\end{verbatim}
Note that I commented out the negative sign on this. My values are always positive.
\section{Project Rev A Complete}
With the above complete, I have an initial prototype. The issues with this are the following:
\begin{itemize}
\item Uno reads 14 bit serial stream wrong (timing issues)
\item 7 segment display slightly bright
\item Should add readout of 120 Volts (can get from transformer)
\item Plywood should be replaced with fiberglass
\end{itemize}
Other than that, it is working, and will be setup and watched for a bit to enjoy the readout.
\end{document}

+ 140
- 0
60hz_Divider/docs/17.tex~ View File

@ -0,0 +1,140 @@
\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{}}
\author{Steak Electronics}
\date{}
\begin{document}
%\maketitle
\tableofcontents
\textcolor{green!60!blue!70}{
\section{60Hz Divider}}
\subsection{Overview}
Let's count. There is a schematic in Practical Electronics For Beginners 4th edition. I've built that up, and will add some CPLD counter logic, along with a micro to output the SPI to a 7seg counter module.
The goal is relative accuracy. Not absolute. No GPS here. I'm going from 60 to 6,000 cycles.\footnote{Due to limitations of CPLD} This is just meant to be fun.
\begin{center}
\includegraphics[scale=0.15]{../pics/DSCN2964.JPG}
\captionof{figure}{60 Hz Logic Divider to 1Hz}
\end{center}
\subsection{Initial Notes: Counting the Hz}
pseudo code goal:
\begin{verbatim}
Using 1Hz signal
Start counting 1MHz every 1Hz
when next cycle is received,
display count
start counting again
\end{verbatim}
That's all the objective is here. Easy with a micro, but goal is to complete using cmos or 74 logic.
4553 x 5
74hct132
1MHz clock (or 6MHz clock), or some variation thereof
jk flip flop
74376 - quad jk flip flop
7476 - jk flip flop
1mhz clk will be main counter,
6 hz or 1 hz will be latch / reset
I ended up skipping the 74 CMOS, in favor of a CPLD. Practical Electronics also mentions this approach as favored. Even a micro alone could be used. Schematic entry in the CPLD could also be used.
\subsection{MAX7219 8 digit 7 LED segment Display Driver}
Basic code tested with this was the LedControl arduino library.
\begin{verbatim}
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
\end{verbatim}
Some of the lines have to be edited to allow for all digits to be read, and
also to lower intensity of display. I think also a component package (dark
grey clear plastic bag) in front of the leds with intensity 1 is about right.
\subsection{CPLD Programming}
Using the XC9500XL series. This chip has some limitations - which are good.
As you get faster clocks, you need bigger registers to handle parsing the clocks. Bigger registers, use more power. Maybe this is one reason why high clock speeds mean more power.
\subsubsection{6KHz clock}
Due to limitations of the XC9500XL FPGA logic blocks, I ended up limiting the counter registers to 12+1 bits\footnote{Possibly I could use multiple smaller registers in a type of cascade, but let's not bother with that for now. I had 600KHz resolution, until I added the UART out/}, so I have around 6,000 (assuming 60Hz), resolution. With this, I need a 6KHz clock. I could do this with the uno, but let's throw an attiny in there because it's a good tool for this kind of purpose and resolution. It should be able to function as a rough 6KHz timer, easily.
\subsubsection{UART output}
I set the CPLD to use the rising edge of the 6KHz clock and to shift the counter value out... Unsuprisingly, the baud rate is 6000. I found this by using my Open Bench Logic Sniffer\footnote{Phantom 3 in Repairs 2019}. It's fairly quick to configure and get working. Auto detected the UART speed easy.
However, my uart value is 12 - 14 bits, and with uart being an 8 bit protocol, it makes this unconventional. May need to bit bang something. But before that...
\subsection{Divide by N Counters}
\begin{center}
\includegraphics[scale=0.2]{../pics/DSCN2958.JPG}
\captionof{figure}{This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.}
\end{center}
The schematics appear to be incorrect for the divide by 6 counter in the Practical Electronics for Beginners book. Having looked at my built up circuit carefully, I see a 20Hz output from the 60Hz. I managed to get my hands on a copy of the TTL Cookbook by Don Lancaster recently, and that details correct divide by 6 and 10 counters (which are different from what's on my proto board), and while I could fix the divide by 6 counter, instead, I'm going to build another divide by 2 counter, and leave the original incorrect one there as a warning (it's also easier to just build a new one).
As it is, I'm getting 2Hz output on the pulse pin... Oops. Practical Untested Electronics for Beginners. Hax. Everything in life is hax. The earlier you realize that, the better you will feel about your own work.\footnote{It's possible they put the error in on purpose. It's really hard to tell...}
\subsection{Attiny 6KHz Clock}
A small victory here: I setup an Attiny10 with an external oscillator (programmable CMOS, not Quartz) of 1.536MHz. I then set prescaler at 256 to get
6000. Set micro fuse to enable CKOUT pin, and now I have a 6KHz clock from the 20 cent micro plus. Neat usage of the attiny10 here, thanks
to my other project using it. The CPLD works with it, no problem.
\subsection{Parsing of CPLD UART Stream}
I have the UART stream feeding into the Atmega328/Uno. For the code, I was unsure how to handle it at first, but then I realized a simple shift in would fit.
\textbf{Situation:} I have a serial UART stream at 6000 baud from the CPLD. However, it's not exactly UART. In fact, it has values of 6000, which are over 8 bit. So I have a 14 bit serial stream. There is no stop bit after the 8 bits, and no two 8 bit bytes. So hardware serial will not work.
\textbf{Solution:} I have a serial 14 bit stream at 6000 baud. The answer is to tie the 6000 Hz CLK to a pin on the Uno, and implement a shift in, so that every clock up, the value is read on the Serial / 14 bit pin.
\textbf{Problems:} The timing is not 100\% As a result, some values are being read incorrectly. 5996 shows up as 5048 or similar. This is likely because I quickly prototyped with digitalRead. I need to go back and access the Input direct via register reads to speed things up. A Pin register access similar to:
\begin{verbatim}
Example Code Snippet
Let's demonstrate the use of the DDRx,
PORTx and PINx registers from the
following code snippet:
DDRC = 0x0F;
PORTC = 0x0C;
// lets assume a 4V supply comes to PORTC.6 and Vcc = 5V
if (PINC == 0b01000000)
PORTC = 0x0B;
else
PORTC = 0x00;
\end{verbatim}
Reference: http://maxembedded.com/2011/06/port-operations-in-avr/
may fix these issues. In the meantime, because the errors are consistent, I setup some LUTs\footnote{Lookup tables, i.e. hard coded fixes. 5048 now converts to 5996.}.
\subsection{Max7219 8 digit 7-Segment Display}
I've
\section{Project Rev A Complete}
After another night or two of work, I have a working prototype.
\end{document}

+ 12
- 0
60hz_Divider/docs/17.toc View File

@ -0,0 +1,12 @@
\contentsline {section}{\numberline {1}60Hz Divider}{1}
\contentsline {subsection}{\numberline {1.1}Overview}{1}
\contentsline {subsection}{\numberline {1.2}Initial Notes: Counting the Hz}{2}
\contentsline {subsection}{\numberline {1.3}MAX7219 8 digit 7 LED segment Display Driver}{2}
\contentsline {subsection}{\numberline {1.4}CPLD Programming}{3}
\contentsline {subsubsection}{\numberline {1.4.1}6KHz clock}{3}
\contentsline {subsubsection}{\numberline {1.4.2}UART output}{3}
\contentsline {subsection}{\numberline {1.5}Divide by N Counters}{4}
\contentsline {subsection}{\numberline {1.6}Attiny 6KHz Clock}{5}
\contentsline {subsection}{\numberline {1.7}Parsing of CPLD UART Stream}{5}
\contentsline {subsection}{\numberline {1.8}Max7219 8 digit 7-Segment Display via Uno}{6}
\contentsline {section}{\numberline {2}Project Rev A Complete}{7}

+ 15
- 0
60hz_Divider/docs/18.aux View File

@ -0,0 +1,15 @@
\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}60Hz Divider}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Overview}{1}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces 60 Hz Logic Divider to 1Hz\relax }}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Initial Notes: Counting the Hz}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}MAX7219 8 digit 7 LED segment Display Driver}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.4}CPLD Programming}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.1}6KHz clock}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.2}UART output}{3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5}Divide by N Counters}{4}}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.\relax }}{4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.6}Attiny 6KHz Clock}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.7}Parsing of CPLD UART Stream}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8}Max7219 8 digit 7-Segment Display via Uno}{6}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Project Rev A Complete}{7}}

+ 311
- 0
60hz_Divider/docs/18.log View File

@ -0,0 +1,311 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2019.8.17) 24 AUG 2020 02:03
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/
60hz_Divider/docs/18.tex
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2020/6
0hz_Divider/docs/18.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
) (./18.aux)
\openout1 = `18.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)
(./18.toc
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 2.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 2.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 2.
)
\tf@toc=\write3
\openout3 = `18.toc'.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <9> on input line 24.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 24.
<../pics/DSCN2964.JPG, id=1, 1003.75pt x 752.8125pt>
File: ../pics/DSCN2964.JPG Graphic file (type jpg)
<use ../pics/DSCN2964.JPG>
Package pdftex.def Info: ../pics/DSCN2964.JPG used on input line 26.
(pdftex.def) Requested size: 150.556pt x 112.91699pt.
[1
Non-PDF special ignored!
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
Overfull \hbox (88.69052pt too wide) in paragraph at lines 65--65
[] \OT1/cmtt/m/n/10.95 ***** These pin numbers will probably not work with your
hardware *****[]
[]
[2 <../pics/DSCN2964.JPG>] [3]
<../pics/DSCN2958.JPG, id=20, 1003.75pt x 752.8125pt>
File: ../pics/DSCN2958.JPG Graphic file (type jpg)
<use ../pics/DSCN2958.JPG>
Package pdftex.def Info: ../pics/DSCN2958.JPG used on input line 88.
(pdftex.def) Requested size: 200.74644pt x 150.55983pt.
[4 <../pics/DSCN2958.JPG>] [5]
Overfull \hbox (13.65749pt too wide) in paragraph at lines 129--130
\OT1/cmr/m/n/10.95 Reference: http://maxembedded.com/2011/06/port-operations-in
-avr/
[]
Overfull \hbox (19.70627pt too wide) in paragraph at lines 172--172
[]\OT1/cmtt/m/n/10.95 //https://playground.arduino.cc/Main/LedControl/#Seg7Cont
rol[]
[]
[6]
LaTeX Font Info: Try loading font information for OMS+cmr on input line 181.
(/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 181.
[7] [8] (./18.aux) )
Here is how much of TeX's memory you used:
3545 strings out of 494945
53855 string characters out of 6181032
119035 words of memory out of 5000000
6815 multiletter control sequences out of 15000+600000
8977 words of font info for 32 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
39i,8n,39p,694b,291s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts
/cm/cmbx10.pfb></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/cmr6.pfb></usr/
share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/te
xlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-di
st/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on 18.pdf (8 pages, 500268 bytes).
PDF statistics:
65 PDF objects out of 1000 (max. 8388607)
44 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
11 words of extra memory for PDF output out of 10000 (max. 10000000)

BIN
60hz_Divider/docs/18.pdf View File


+ 195
- 0
60hz_Divider/docs/18.tex View File

@ -0,0 +1,195 @@
\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{}}
\author{Steak Electronics}
\date{}
\begin{document}
%\maketitle
\tableofcontents
\textcolor{green!60!blue!70}{
\section{60Hz Divider}}
\subsection{Overview}
Let's count. There is a schematic in Practical Electronics For Beginners 4th edition. I've built that up, and will add some CPLD counter logic, along with a micro to output the SPI to a 7seg counter module.
The goal is relative accuracy. Not absolute. No GPS here. I'm going from 60 to 6,000 cycles.\footnote{Due to limitations of CPLD} This is just meant to be fun.
\begin{center}
\includegraphics[scale=0.15]{../pics/DSCN2964.JPG}
\captionof{figure}{60 Hz Logic Divider to 1Hz}
\end{center}
\subsection{Initial Notes: Counting the Hz}
pseudo code goal:
\begin{verbatim}
Using 1Hz signal
Start counting 1MHz every 1Hz
when next cycle is received,
display count
start counting again
\end{verbatim}
That's all the objective is here. Easy with a micro, but goal is to complete using cmos or 74 logic.
4553 x 5
74hct132
1MHz clock (or 6MHz clock), or some variation thereof
jk flip flop
74376 - quad jk flip flop
7476 - jk flip flop
1mhz clk will be main counter,
6 hz or 1 hz will be latch / reset
I ended up skipping the 74 CMOS, in favor of a CPLD. Practical Electronics also mentions this approach as favored. Even a micro alone could be used. Schematic entry in the CPLD could also be used.
\subsection{MAX7219 8 digit 7 LED segment Display Driver}
Basic code tested with this was the LedControl arduino library.
\begin{verbatim}
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
\end{verbatim}
Some of the lines have to be edited to allow for all digits to be read, and
also to lower intensity of display. I think also a component package (dark
grey clear plastic bag) in front of the leds with intensity 1 is about right.
\subsection{CPLD Programming}
Using the XC9500XL series. This chip has some limitations - which are good.
As you get faster clocks, you need bigger registers to handle parsing the clocks. Bigger registers, use more power. Maybe this is one reason why high clock speeds mean more power.
\subsubsection{6KHz clock}
Due to limitations on the XC9500XL FPGA logic blocks, I ended up limiting the counter registers to 12+1 bits\footnote{Possibly I could use multiple smaller registers in a type of cascade, but let's not bother with that for now. I had 600KHz resolution, until I added the UART out/}, so I have around 6,000 (assuming 60Hz), resolution. With this, I need a 6KHz clock. I could do this with the uno, but let's throw an attiny in there because it's a good tool for this kind of purpose and resolution. It should be able to function as a rough 6KHz timer, easily.
\subsubsection{UART output}
I set the CPLD to use the rising edge of the 6KHz clock and to shift the counter value out... Unsuprisingly, the baud rate is 6000. I found this by using my Open Bench Logic Sniffer\footnote{Phantom 3 in Repairs 2019}. It's fairly quick to configure and get working. Auto detected the UART speed easy.
However, my uart value is 12 - 14 bits, and with uart being an 8 bit protocol, it makes this unconventional. May need to bit bang something. But before that...
\subsection{Divide by N Counters}
\begin{center}
\includegraphics[scale=0.2]{../pics/DSCN2958.JPG}
\captionof{figure}{This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.}
\end{center}
The schematics appear to be incorrect for the divide by 6 counter in the Practical Electronics for Beginners book. Having looked at my built up circuit carefully, I see a 20Hz output from the 60Hz. I managed to get my hands on a copy of the TTL Cookbook by Don Lancaster recently, and that details correct divide by 6 and 10 counters (which are different from what's on my proto board), and while I could fix the divide by 6 counter, instead, I'm going to build another divide by 2 counter, and leave the original incorrect one there as a warning (it's also easier to just build a new one).
As it is, I'm getting 2Hz output on the pulse pin... Oops. Practical Untested Electronics for Beginners. Hax. Everything in life is hax. The earlier you realize that, the better you will feel about your own work.\footnote{It's possible they put the error in on purpose. It's really hard to tell...}
\subsection{Attiny 6KHz Clock}
A small victory here: I setup an Attiny10 with an external oscillator (programmable CMOS, not Quartz) of 1.536MHz. I then set prescaler at 256 to get
6000. Set micro fuse to enable CKOUT pin, and now I have a 6KHz clock from the 20 cent micro plus. Neat usage of the attiny10 here, thanks
to my other project using it. The CPLD works with it, no problem.
\subsection{Parsing of CPLD UART Stream}
Back to the 14 bit stream...
I have the UART stream feeding into the Atmega328/Uno. For the code, I was unsure how to handle it at first, but then I realized a simple shift in would fit.
\textbf{Situation:} I have a serial UART stream at 6000 baud from the CPLD. However, it's not exactly UART. In fact, it has values of 6000, which are over 8 bit. So I have a 14 bit serial stream. There is no stop bit after the 8 bits, and no two 8 bit bytes. So hardware serial will not work. \footnote{I didn't want to deal with coding the UART into the CPLD. There are also size limitations.}
\textbf{Solution:} I have a serial 14 bit stream at 6000 baud. The answer is to tie the 6000 Hz CLK to a pin on the Uno, and implement a shift in, so that every clock up, the value is read on the Serial / 14 bit pin. I do have a start bit, and I am not outputting all the time, so this will be one 14 bit value every second.
\textbf{Problems:} The Uno's digitalRead timing is not 100\% As a result, some values are being read incorrectly. 5996 shows up as 5048 or similar. I need to go back and access the Input direct via register reads to speed things up. A Pin register access similar to:
\begin{verbatim}
Example Code Snippet
Let's demonstrate the use of the DDRx,
PORTx and PINx registers from the
following code snippet:
DDRC = 0x0F;
PORTC = 0x0C;
// lets assume a 4V supply comes to PORTC.6 and Vcc = 5V
if (PINC == 0b01000000)
PORTC = 0x0B;
else
PORTC = 0x00;
\end{verbatim}
Reference: http://maxembedded.com/2011/06/port-operations-in-avr/
may fix these issues. In the meantime, because the errors are consistent, I setup some LUTs\footnote{Lookup tables, i.e. hard coded fixes. e.g. 5048 now converts to 5996.}.
\subsection{Max7219 8 digit 7-Segment Display via Uno}
I didn't have any trouble getting the 7 segment to display with the Uno and the Max7219. Note that I avoided outputting the values via the CPLD. The Uno is just quicker to code this output. I used the LedControl library. I had to adopt a quick function to break down the values. The Max7219 does not take in variables, so instead, you feed it single digits. Therefore I needed to extract a single digit from the tens, hundreds, and thousands. See below:
\begin{verbatim}
//https://playground.arduino.cc/Main/LedControl/#Seg7Control
void printNumber(int v) {
int ones;
int tens;
int hundreds;
int thousands;
boolean negative;
if(v < -9999 || v > 9999)
return;
if(v<0) {
negative=true;
v=v*-1;
}
ones=v%10;
v=v/10;
tens=v%10;
v=v/10;
hundreds=v%10;
v=v/10;
thousands=v;
/*if(negative) {
//print character '-' in the leftmost column
lc.setChar(0,4,'-',false);
}
else {
//print a blank in the sign column
lc.setChar(0,4,' ',false);
}*/
//Now print the number digit by digit
lc.setDigit(0,3,(byte)thousands,false);
lc.setDigit(0,2,(byte)hundreds,false);
lc.setDigit(0,1,(byte)tens,false);
lc.setDigit(0,0,(byte)ones,false);
}
\end{verbatim}
Note that I commented out the negative sign on this. My values are always positive.
\section{Project Rev A Complete}
With the above complete, I have an initial prototype. The issues with this are the following:
\begin{itemize}
\item Uno reads 14 bit serial stream wrong (timing issues)
\item 7 segment display slightly bright
\item Should add readout of 120 Volts (can get from transformer)
\item Plywood should be replaced with fiberglass
\end{itemize}
It turns out that 4 digits on the display is the minimum for a project like this to be viable. 3 digits wouldn't be enough resolution, and 5 digits is not necessary (although nice). The values differ here from about 5996 to 6003 cycles per second.
Other than that, it is working, and will be setup and watched for a bit to enjoy the readout.
\end{document}

+ 191
- 0
60hz_Divider/docs/18.tex~ View File

@ -0,0 +1,191 @@
\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{}}
\author{Steak Electronics}
\date{}
\begin{document}
%\maketitle
\tableofcontents
\textcolor{green!60!blue!70}{
\section{60Hz Divider}}
\subsection{Overview}
Let's count. There is a schematic in Practical Electronics For Beginners 4th edition. I've built that up, and will add some CPLD counter logic, along with a micro to output the SPI to a 7seg counter module.
The goal is relative accuracy. Not absolute. No GPS here. I'm going from 60 to 6,000 cycles.\footnote{Due to limitations of CPLD} This is just meant to be fun.
\begin{center}
\includegraphics[scale=0.15]{../pics/DSCN2964.JPG}
\captionof{figure}{60 Hz Logic Divider to 1Hz}
\end{center}
\subsection{Initial Notes: Counting the Hz}
pseudo code goal:
\begin{verbatim}
Using 1Hz signal
Start counting 1MHz every 1Hz
when next cycle is received,
display count
start counting again
\end{verbatim}
That's all the objective is here. Easy with a micro, but goal is to complete using cmos or 74 logic.
4553 x 5
74hct132
1MHz clock (or 6MHz clock), or some variation thereof
jk flip flop
74376 - quad jk flip flop
7476 - jk flip flop
1mhz clk will be main counter,
6 hz or 1 hz will be latch / reset
I ended up skipping the 74 CMOS, in favor of a CPLD. Practical Electronics also mentions this approach as favored. Even a micro alone could be used. Schematic entry in the CPLD could also be used.
\subsection{MAX7219 8 digit 7 LED segment Display Driver}
Basic code tested with this was the LedControl arduino library.
\begin{verbatim}
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
\end{verbatim}
Some of the lines have to be edited to allow for all digits to be read, and
also to lower intensity of display. I think also a component package (dark
grey clear plastic bag) in front of the leds with intensity 1 is about right.
\subsection{CPLD Programming}
Using the XC9500XL series. This chip has some limitations - which are good.
As you get faster clocks, you need bigger registers to handle parsing the clocks. Bigger registers, use more power. Maybe this is one reason why high clock speeds mean more power.
\subsubsection{6KHz clock}
Due to limitations of the XC9500XL FPGA logic blocks, I ended up limiting the counter registers to 12+1 bits\footnote{Possibly I could use multiple smaller registers in a type of cascade, but let's not bother with that for now. I had 600KHz resolution, until I added the UART out/}, so I have around 6,000 (assuming 60Hz), resolution. With this, I need a 6KHz clock. I could do this with the uno, but let's throw an attiny in there because it's a good tool for this kind of purpose and resolution. It should be able to function as a rough 6KHz timer, easily.
\subsubsection{UART output}
I set the CPLD to use the rising edge of the 6KHz clock and to shift the counter value out... Unsuprisingly, the baud rate is 6000. I found this by using my Open Bench Logic Sniffer\footnote{Phantom 3 in Repairs 2019}. It's fairly quick to configure and get working. Auto detected the UART speed easy.
However, my uart value is 12 - 14 bits, and with uart being an 8 bit protocol, it makes this unconventional. May need to bit bang something. But before that...
\subsection{Divide by N Counters}
\begin{center}
\includegraphics[scale=0.2]{../pics/DSCN2958.JPG}
\captionof{figure}{This divide by 6 counter, appears to not line up with what the TTL Cookbook has for a similar 7490 one.}
\end{center}
The schematics appear to be incorrect for the divide by 6 counter in the Practical Electronics for Beginners book. Having looked at my built up circuit carefully, I see a 20Hz output from the 60Hz. I managed to get my hands on a copy of the TTL Cookbook by Don Lancaster recently, and that details correct divide by 6 and 10 counters (which are different from what's on my proto board), and while I could fix the divide by 6 counter, instead, I'm going to build another divide by 2 counter, and leave the original incorrect one there as a warning (it's also easier to just build a new one).
As it is, I'm getting 2Hz output on the pulse pin... Oops. Practical Untested Electronics for Beginners. Hax. Everything in life is hax. The earlier you realize that, the better you will feel about your own work.\footnote{It's possible they put the error in on purpose. It's really hard to tell...}
\subsection{Attiny 6KHz Clock}
A small victory here: I setup an Attiny10 with an external oscillator (programmable CMOS, not Quartz) of 1.536MHz. I then set prescaler at 256 to get