Wednesday, September 19, 2012

Propeller Chip Nanotechnology

BIG BRAIN Propeller Chip Nanotechnology
PROPELLER CHIP NANOTECHNOLOGY
Welcome to the development of hobby nanotechnology machines inside the Propeller chip!

Parallax Propeller
Inside the chip: Parallax Propeller magnified thousands of times




















ABOVE: Step by step with increasing magnification, we examine the P8X832A Propeller chip during the Big Brain's Microscopy Initiative. The final result is shown in one of the photos below (Clumping Molecules of Molecular States Inside a Big Brain Propeller Chip).

Keeping in step with the development of small objects inside the chip, a natural progression moves toward the development of nanotechnology and nano devices.


According to Wikipedia, "Nanotechnology (sometimes shortened to "nanotech") is the manipulation of matter on an atomic and molecular scale. Generally, nanotechnology works with materials, devices, and other structures with at least one dimension sized from 1 to 100 nanometers. Quantum mechanical effects are important at this quantum-realm scale. With a variety of potential applications, nanotechnology is a key technology for the future and governments have invested billions of dollars in its research. Through its National Nanotechnology Initiative, the USA has invested 3.7 billion dollars. The European Union has invested 1.2 billion and Japan 750 million dollars."

BIG BRAIN NANOTECHNOLOGY INITIATIVE 
In this installment, the Big Brain will develop the first three PropNanos - two tiny Propeller Pulsars, not unlike powerful Pulsar Stars visible in the Universe (at least in the thought of an extremely fast exampling pulsating periodic timing base) and it will also develop the Propeller Nano Window, an instrument capable of looking at the system and observing timing within the miniscule range of Nanotechnology and nano-timing.  (see Propeller Nano Window, Propeller Nano Pulsar and Propeller Nano Pulsar 2)

ABOVE - Beginning at top left, deep inside the Propeller chip, a small section of one Cog RISC processor is progressively enlarged thousands of times, moving towards the molecular level. Big Brain Microscopy Project.


BIG BRAIN PROPELLER MICROSCOPY INITIATIVE
The Big Brain Project has started a Microscopy Initiative to increase the resolution and results of visual optical imaging inside of a Propeller chip, to supplement the study and creation of interior Propeller Nano Technology and objects within the chip. The initiative has built the closest machine to an Electron Microscope, without the complexity, expense or hazards. The Propeller Microscopy Machine PMM is safe and easy to use, and operates on the same concept as the PGT Telescope. The inside of the Propeller chip is creatively viewed as a TinyCosmos containing many objects. Powerful Microscopy with the PMM can put the size of objects into perspective and amplify elements many thousands of times for study. Knowing the map layout of objects inside the Propeller and their juxtaposition relative to other objects will serve to better understand the transient field elements of relative inductance, impedance, capacitance, thermodynamics and numerous physical field parameters.

PROPELLER NANOTECHNOLOGY RANGE
Keep in mind that Nanotechnology encompasses not only the range of small in units of length but that along the dimension of time as time approaches the infinitesimally small until that of the Quantum world begins to emerge. We will begin with the development of time-based nano machines so that we have "measuring yardsticks" from which to continue the construction of more nano sized machines.

UNDERSTANDING THE PROPELLER
To develop Propeller Nanotechnology and the first specialized and smallest PropNano, we need to better understand a number of processor elements inside the Parallax Propeller chip. Many people agree the Propeller is a very innovative microprocessor chip and Parallax owner and designer Chip Gracey did not hold back on its new state of the art design innovation and built in features. This 32-bit 8-core chip is enriched with elements, such as Generators, Counters, VCOs, PLLs, RC Clocks, Registers, and internal components ideal for our projects like sensing Substrate Pin Diodes for example. For review of designs, ideas, internal elements, materials, techniques, and some theory, let's start by looking at important points offered by Parallax.

Powerful microscopes reach molecular levels
LEFT: CLUMPING MOLECULES OF MOLECULAR STATES INSIDE A BIG BRAIN PROPELLER CHIP

Powerful Electron Microscopes reveal objects at the upper end of the molecular level. This image, made with the PMM Propeller Microscopy Machine, shows the inside of a Parallax Propeller chip amplified thousands of times. This result is from using a simple and inexpensive technique developed by the Big Brain Electron Microscopy Initiative. To qualify as a nano object by generalized definition, the object size may range between 1 and 100 nanometers on at least one side. Thus, approaching such small sizes (and exceeding) may lead to the study of Quantum effects. Project courtesy Big Brain Labs, Big Brain Electron Microscopy Initiative and Humanoido. Propeller by Parallax.

CONFIGURABLE STATE MACHINES
Two Counters per cog (Configurable state machines generate or sense repetitive signals per clock cycle, Measure frequency, detect edges, count cycles, D/A or A/D conversion, and more, Operate autonomously with optional run-time monitoring and adjusting). The System Counter is a global, read-only, 32-bit counter that increments once every System Clock cycle.

PROPELLER COGS
Cogs can read the System Counter (via their CNT registers) to perform timing calculations and can use the WAITCNT command to create effective delays within their processes. The System Counter is a common resource which every cog can read simultaneously. The System Counter is not cleared upon startup since its practical use is for differential timing. If a cog needs to keep track of time from a specific, fixed moment in time, it simply needs to read and save the initial counter value at that moment in time, and compare subsequent counter values against that initial value.

INTRO TO THE SYSTEM COUNTER
The System Counter is a global, read-only, 32-bit counter that increments once every System Clock cycle. Cogs can read the System Counter (via their CNT register) to perform timing calculations and can use the WAITCNT command to create effective delays within their processes. The System Counter is a common resource. Every cog can read it simultaneously. The System Counter is not cleared upon startup since its practical use is for differential timing. If a cog needs to keep track of time from a specific, fixed moment in time, it simply needs to read and save the initial counter value at that moment in time, and compare all of the later counter values against that initial value.

COUNTER MODULES
Each cog has two counter modules: CTRA and CTRB. Each counter module can control or monitor up to two I/O pins and perform conditional 32-bit accumulation of its FRQ register into its PHS register on every clock cycle. Each counter module also has its own phase-locked loop (PLL) which can be used to synthesize frequencies up to 128 MHz. With a little setup or oversight from the cog, a counter can be used for: frequency synthesis, frequency measurement, pulse counting, pulse measurement, multi-pin state measurement, pulse-width modulation, duty-cycle measurement, digital-to-analog conversion, analog-to-digital conversion.

BUILD A TIME YARDSTICK
This time yardstick is fully adjustable to a time base determined by the toggling of Pin 1. It's currently set for one millisecond per Pin toggle and can easily go forward or backward in time by adjusting the value of Cycles. This is a nice exampling reference program for use in developing more nano apps and it clearly shows how to use the set time feature.

ABOVE PHOTO is a schematic diagram showing the wiring used to make the projects cited in this posting. The crystal is interchangeable with 5Mhz or 6.25Mhz at X0 and X1. The 24LC254 32K EEPROM will store a program as nonvolatile memory. A Parallax Propeller Plug eliminates the need for wiring in complicated USB interfacing. The entire circuit with the 8-Core Propeller chip runs on 3.3 volts. The build on a solderless breadboard takes only a few minutes. The chip's eight cores are about a US dollar each. The Prop Plug is currently $14.99. The crystal and EEPROM are about $1.50 each.


{
      ************************************************************************
      ************************************************************************
      ***                                                                  ***
      ***                    Propeller Time Yardstick                      ***
      ***                Toggles Time Base Reference Pin P1                ***
      ***                        ms_yardstick.spin                         ***
      ***                                                                  ***
      ***                                                                  ***
      ***                             V01.0                                ***
      ***                           Humanoido                              ***
      ***                                                                  ***
      ***                                                                  ***  

      ************************************************************************
}
 CON    
  _clkmode = xtal1 + pll16x     ' Declare constants, Feedback/PLL multiplier   
  _xinfreq = 5_000_000          ' External oscillator 5 MHz Crystal for 80MHz

                                ' 160MIPs, 20MIPs/Cog
PUB Toggle | TimeBase, Cycles
  dira[1]~~                     ' Set P1 to output
  Cycles := clkfreq / 1000      ' Calculate cycles per 1 millisecond*
  TimeBase := cnt               ' Get current count
  repeat                        ' Loop endlessly
    waitcnt(TimeBase += Cycles) ' Wait to start of next millisecond
    !outa[1]                    ' Toggle P1

CNT returns the Current 32-bit System Counter value. The CNT register contains the current value in the global 32-bit System Counter. The System Counter serves as the central time reference for all cogs; it increments its 32-bit value once every System Clock cycle. Upon power-up/reset, the System Counter starts with an arbitrary value and counts upwards from there, incrementing with every System Clock cycle. Since the System Counter is a read-only resource, every cog can read it simultaneously and can use the returned value to synchronize events, count cycles and measure time.


Using CNT
Read CNT to get the current System Counter value. The actual value itself does not matter for any particular purpose, but the difference in successive reads is very important. Most often, the CNT register is used to delay execution for a specific period or to synchronize an event to the start of a window of time. The next examples use the WAITCNT instruction to achieve this.


waitcnt(3_000_000 + cnt)    ' Wait for 3 million clock cycles


The above code is an example of a “fixed delay” It delays the cog’s execution for 3 million system clock cycles (about 1⁄4 second when running with the internal fast oscillator). In Spin code, when using CNT inside of a WAITCNT command as shown above, make sure to write the expression in the form “offset + cnt” as opposed to “cnt + offset” and make sure offset is at least 381 to account for Spin Interpreter overhead and avoid unexpectedly long delays. See the WAITCNT command’s Fixed Delays section on page 218 in the Propeller manual for more information. The next is an example of a “synchronized delay.” It notes the current count at one place and performs an action (toggles a pin) every millisecond thereafter with accuracy as good as that of the oscillator driving the Propeller chip.


Here, I/O pin 1 is set to output. Then the local variable Cycles is set equal to the current System Clock frequency divided by 1000; i.e., the number of System Clock cycles per 1 millisecond of time. Next, the local variable TimeBase is set to the current System Counter value. Finally, the last two lines of code repeat endlessly; each time waiting until the start of the next millisecond and then toggling the state of P1.

For more information, see the WAITCNT section’s Fixed Delays on page 218 and Synchronized Delays on page 219 of the Propeller Manual. The CNT register is read-only so in Spin it should not be assigned a value (i.e., should not be to the left of a := or other assignment operator) and when used in Propeller Assembly it should only be accessed as a source (s-field) value (i.e., mov dest, source).

RUNNING MODE & UPDATE PERIOD
For some of these operations, the cog can be set up and left in a free-running mode. For others, it may use WAITCNT to time-align counter reads and writes within a loop, creating the effect of a more complex state machine. Note that for a cog clock frequency of 80 MHz, the counter update period is a mere 12.5 ns. This high speed, combined with 32-bit precision, allows for very dynamic signal generation and measurement.

DESIGN GOAL
The design goal for the counter was to create a simple and flexible subsystem which could perform some repetitive task on every clock cycle, thereby freeing the cog to perform some computationally richer super-task. While the counters have only 32 basic operating modes, there is no limit to how they might be used dynamically through software. Integral to this concept is the use of the WAITPEQ, WAITPNE, and WAITCNT instructions, which can event-align or time-align a cog with its counters. Each counter has three registers...

QUANTUM MECHANICS
Quantum mechanics (QM – also known as quantum physics, or quantum theory) is a branch of physics dealing with physical phenomena at microscopic scales, where the action is on the order of the Planck constant. Quantum mechanics departs from classical mechanics primarily at the quantum realm of atomic and subatomic length scales. QM provides a mathematical description of much of the dual particle-like and wave-like behavior and interactions of energy and matter. In advanced topics of quantum mechanics, some of these behaviors are macroscopic and only emerge at extreme (i.e., very low or very high) energies or temperatures. The name quantum mechanics derives from the observation that some physical quantities can change only in discrete amounts (Latin quanta), and not in a continuous (cf. analog) way. For example, the angular momentum of an electron bound to an atom or molecule is quantized. In the context of quantum mechanics, the wave–particle duality of energy and matter and the uncertainty principle provide a unified view of the behavior of photons, electrons, and other atomic-scale objects. -Wikipedia

THE ELECTRON MICROSCOPE
An electron microscope uses a beam of electrons to illuminate a specimen and produce a magnified image. An electron microscope (EM) has greater resolving power than a light-powered optical microscope because electrons have wavelengths about 100,000 times shorter than visible light (photons) . They can achieve better than 50 pm resolution and magnifications of up to about 10,000,000x whereas ordinary, non-confocal light microscopes are limited by diffraction to about 200 nm resolution and useful magnifications below 2000x.
The electron microscope uses electrostatic and electromagnetic "lenses" to control the electron beam and focus it to form an image. These lenses are analogous to but different from the glass lenses of an optical microscope that form a magnified image by focusing light on or through the specimen. Electron microscopes are used to observe a wide range of biological and inorganic specimens including microorganisms, cells, large molecules, biopsy samples, metals, and crystals. Industrially, the electron microscope is often used for quality control and failure analysis. For more information, refer to Wikipedia.

Propeller Nano Tool Development

THE NANO WINDOW 
Propeller Nano Window  Here's the first Nano device for our project and a tool for measuring the smallest units of System clock cycling inside the Propeller chip, using the System Counter and programming in Spin language. The code provides a way to read and view the numerical result of the System Counter CNT register and display a binary result on a series of LED lights attached to pins P0 through P31. The number represented by 32 binary lights: Note, although there are several systems and methods of representing signed integers with a processor, using sign & magnitude or one's complement systems, the range is from -2147483647 to 2147483647. Using a two's complement system, it's -2147483648 to 2147483647.

{
      ************************************************************************
      ************************************************************************
      ***                                                                  ***
      ***                      Propeller NANO Window                       ***
      ***               Displays Binary Result on LEDs P0-P31              ***
      ***                       nano_window.spin                           ***
      ***                                                                  ***
      ***                                                                  ***
      ***                             V01.0                                ***
      ***                           Humanoido                              ***
      ***                                                                  ***
      ***                                                                  ***  

      ************************************************************************
}
CON    
  _clkmode = xtal1 + pll16x ' Declare constants, Feedback/PLL multiplier   
  _xinfreq = 5_000_000      ' External oscillator 5 MHz Crystal for 80MHz

                            ' 160MIPs, 20MIPs/Cog
VAR                         ' Variables Declaration
  long  Time                ' Time is the returned variable from cnt
PUB ReadCNT                 ' Read the system counter public method
  Time := cnt               ' Read System Counter 32 bit number
  DIRA := %11111111111111111111111111111111 ' Direction State -

                            ' Make pins 0-31 outputs
  OUTA := Time              ' Output State - Send Time variable to A register

                            ' & output
  waitpne(0, 0, 0)          ' Keep cog alive or spin interpreter will exit

                            ' (or use repeat)
  
CREATING A NANO PULSAR
GOING BEYOND A PULSAR STAR

Propeller Nano Pulsar  Are there stars inside the Propeller chip? We think so. Let's create a simple exampling Nano Pulsar, a tiny machine built up from code and the Counter Module to create incredibly small nano pulses at pin location. Not unlike a periodic Pulsar Star (which can provide a reference millisecond periodic timing base), the Propeller Nano Pulsar is programmed to continually and periodically emit its nanosecond range signal, actually exceeding the range parameters of a Pulsar Star, in this case a repeating 12.6 nano-second wide nano pulse. Programming is in Propeller Spin language.

{
      ************************************************************************
      ************************************************************************
      ***                                                                  ***
      ***                      Propeller Nano Pulsar                       ***
      ***                        Nano Result at Pin                        ***
      ***                         prop_pulsar.spin                         ***
      ***                                                                  ***
      ***                                                                  ***
      ***                             V01.0                                ***
      ***                           Humanoido                              ***
      ***                                                                  ***
      ***                                                                  ***  

      ************************************************************************
}
CON

                 ' Declare constants, Feedback/PLL multiplier  
   _clkmode = xtal1 + pll16x 
                 ' External oscillator 5 MHz Crystal for 80MHz
   _xinfreq = 5_000_000     
                 ' 160MIPs, 20MIPs/Cog PUB Toggle3(Pin)
                 'Use cog's counter module, toggle at clock speed
dira[Pin]~~      'Set I/O pin to output
                 ' mode PLL BPIN APIN
ctra := 100_000 << 23 + 1 << 9 + Pin

                 'Establish mode and APIN (BPIN ignored)
                 'Set FRQA so PHSA[31] toggles every clock
frqa := $8000_0000
repeat           'infinity loop
    
This code produces a Pulsar with 12.6-ns wide nano pulses at definitive pin location. The period is only 25.0 nanoseconds.


THE SMALLEST PULSAR
GOING SMALLER with more "Nano-esse" 
The machine can be rebuilt for higher resolution with a 6.25Mhz hardware crystal to sub for the 5Mhz crystal, going from 80Mhz clock to 100Mhz and creating a 10-ns wide pulse range with a smaller period of only 20 nanoseconds. This ultra miniscule 10-ns wide "machine" is the smallest created thus far (in terms of pulsating width) within the Propeller chip' TinyCOSMOS. It has a timing is equal to ten billionths of one second.

{
      ************************************************************************
      ************************************************************************
      ***                                                                  ***
      ***                     Propeller Nano Pulsar 2                      ***
      ***                        Nano Result at Pin                        ***
      ***                        prop_pulsar2.spin                         ***
      ***                                                                  ***
      ***                                                                  ***
      ***                             V01.0                                ***
      ***                           Humanoido                              ***
      ***                                                                  ***
      ***                                                                  ***  

      ************************************************************************
}
CON

                 ' Declare constants, Feedback/PLL multiplier  
   _clkmode = xtal1 + pll16x 
                 ' External oscillator 6.25 MHz Crystal for 100MHz
   _xinfreq = 6_250_000     
                 ' 200MIPs, 25MIPs/Cog PUB Toggle3(Pin)
                 'Use cog's counter module, toggle at clock speed
dira[Pin]~~      'Set I/O pin to output
                 ' mode PLL BPIN APIN
ctra := 100_000 << 23 + 1 << 9 + Pin

                 'Establish mode and APIN (BPIN ignored)
                 'Set FRQA so PHSA[31] toggles every clock
frqa := $8000_0000
repeat           'infinity loop

DEFINING NANOTIME
Let's introduce the Big Brain's concept of NanoTime for the Propeller chip. While Nano size is well defined within a range of units, the unit range of Nano time is not. Therefore this project will set the range of Nano time within the criteria range (along at least one side of a variable cycle) of one nanosecond to 100 nanoseconds. This is one billionth of a second to 100 billionths of a second. Ten nano-seconds is equal to 1/100th of a microsecond while a hundred nano-seconds is equal to 1/10th microsecond. Generally, nanotechnology works with materials, devices, and other structures with at least one dimension sized from 1 to 100 nanometers.

CONVERTING UNITS
The Mac Dashboard within OSX 10.6.8 is a time quick and easy conversion program with units ranging from nanoseconds to years. It shows the nanotechnology range of 1 to 100 ns is equal to .001 to .1 microsecond and 1E-6 to .0001 millisecond when converted.

NANOSECOND
A nanosecond (ns) is one billionth of a second (10−9 or 1/1,000,000,000 s). A nanosecond is equal to 1000 picoseconds or 11000 microsecond.

NANOMETER
A nanometer; symbol nm, is a unit of length in the metric system, equal to one billionth of a meter. 

PULSAR
A pulsar (portmanteau of pulsating star) is a highly magnetized, rotating neutron star that emits a beam of electromagnetic radiation. This radiation can only be observed when the beam of emission is pointing towards the Earth, much the way a lighthouse can only be seen when the light is pointed in the direction of an observer, and is responsible for the pulsed appearance of emission. Neutron stars are very dense, and have short, regular rotational periods. This produces a very precise interval between pulses that range from roughly milli-seconds to seconds for an individual pulsar. The precise periods of pulsars makes them useful tools. Observations of a pulsar in a binary neutron star system were used to indirectly confirm the existence of gravitational radiation. The first extrasolar planets were discovered around a pulsar, PSR B1257+12. Certain types of pulsars rival atomic clocks in their accuracy in keeping time. - Wikipedia

LINKS
Molecular Microscopy Initiative