Difference between revisions of "CBA Hello World síðan"

From Fab Lab Wiki - by NMÍ Kvikan
Jump to: navigation, search
Line 188: Line 188:
  
 
== Hello-world rafrásir ==
 
== Hello-world rafrásir ==
 
+
* Sjá: [[Hello world rafrásir]]
=== serial output ===
+
Einföld rafrás sem notar [[RS-232]] (serial) staðalinn til að senda 8 bita [[ASCII]] textastrenginn "Hello World!" aftur og aftur á 9600 bit per sekúndu.
+
 
+
Tvær útgáfur af forritskóðanum eru hér - annars vegar skrifað í smalamáli, og hinsvegar í C.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/serial/hello.serial.45.cad hello.serial.45.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/serial/hello.serial.45.asm hello.serial.45.asm] - smalamálskóði
+
* [http://fab.cba.mit.edu/about/fab/hello/serial/hello.serial.45.hex hello.serial.45.hex] - vélamál (vistþýtt)
+
* [http://fab.cba.mit.edu/about/fab/hello/serial/hello.serial.45.c hello.serial.45.c] - C kóði
+
* [http://fab.cba.mit.edu/about/fab/hello/serial/makefile makefile] - Make skrá fyrir C kóða
+
 
+
=== serial echo ===
+
Ögn flóknari rafrás sem notar [[RS-232]] (serial) staðalinn til að hlusta eftir textastrengjum og skrifa þá um leið til baka á 9600 bit per sekúndu. Svona rásir eru kallaðar "echo" rásir - gera ekkert nema endurvarpa gögnum.
+
 
+
Aftur, bæði smalamáls- og C forrit, en nú er líka útgáfa fyrir ATTiny44.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/echo/hello.echo.45.cad hello.echo.45.cad] - rafrás, teikning, ATTiny45
+
* [http://fab.cba.mit.edu/about/fab/hello/echo/hello.echo.45.asm hello.echo.45.asm] - smalamálskóði, ATTiny45
+
* [http://fab.cba.mit.edu/about/fab/hello/echo/hello.echo.45.c hello.echo.45.c] - C kóði, ATTiny45
+
* [http://fab.cba.mit.edu/about/fab/hello/echo/makefile makefile] - Make skrá fyrir C kóða, ATTiny45
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/echo/hello.echo.44.cad hello.echo.44.cad] - rafrás, teikning, ATTiny44
+
* [http://fab.cba.mit.edu/about/fab/hello/echo/hello.echo.44.asm hello.echo.44.asm] - smalamálskóði, ATTiny44
+
 
+
=== Takki ===
+
Einföld rás með takka. Þegar ýtt er á takkann sendir rásin skilaboð í gegnum RS-232.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/button/hello.button.45.cad hello.button.45.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/button/hello.button.45.asm hello.button.45.asm] - smalamálskóði
+
 
+
=== Ljósnemi ===
+
Einfaldur ljósnemi
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/light/hello.light.45.cad hello.light.45.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/light/hello.light.45.asm hello.light.45.asm] - smalamálskóði
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/light/hello.light.45.py hello.light.45.py] - [[Python]] forrit sem hlustar eftir úttaki og birtir niðurstöður
+
 
+
=== Hitanemi ===
+
Einfaldur hitanemi
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/temp/hello.temp.45.cad hello.temp.45.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/temp/hello.temp.45.asm hello.temp.45.asm] - smalamálskóði
+
* [http://fab.cba.mit.edu/about/fab/hello/temp/hello.temp.45.py hello.temp.45.py] - Python forrit sem hlustar eftir úttaki og birtir niðurstöður
+
 
+
=== Skrefasvörun (viðnám, þéttni, span, staðsetning, fjarlægð, halli) ===
+
Rás sem nemur hverslags skrefasvörun, svo sem viðnám, þéttni, span, staðsetningu, fjarlægð eða halla. Hægt að tengja mismunandi nema við rásina til að framkvæma mismunandi mælingar.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/step/hello.step.45.cad hello.step.45.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/step/hello.step.45.asm hello.step.45.asm] - smalamálskóði
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/step/hello.step.45.py hello.step.45.py] - Python forrit sem hlustar eftir úttaki og birtir niðurstöður
+
 
+
=== Hljóðnemi ===
+
Rás með hljóðnema. Sendir mælingar til baka í gegnum RS-232.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/mic/hello.mic.45.cad hello.mic.45.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/mic/hello.mic.45.asm hello.mic.45.asm] - smalamálskóði
+
* [http://fab.cba.mit.edu/about/fab/hello/mic/hello.mic.45.py hello.mic.45.py] - Python forrit sem birtir hljóðsveiflurnar í rauntíma (frekar kúl!)
+
* [http://fab.cba.mit.edu/about/fab/hello/mic/hello.mic.44.cad hello.mic.44.cad] - ATTiny44 útgáfa af sömu rás
+
 
+
=== RGB LED ===
+
Rás með RGB LED ljósi.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/RGB/hello.RGB.45.cad hello.RGB.45.cad] - rafrás, teikning
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/RGB/hello.RGB.45.asm hello.RGB.45.asm] - smalamálskóði - forrit sem rúllar í gegnum litrófið
+
 
+
=== LED array ===
+
Rás með [[Charlieplexing]] LED-fylki.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/array/hello.array.44.cad hello.array.44.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/array/hello.array.44.asm hello.array.44.asm] - smalamálskóði
+
* [http://fab.cba.mit.edu/about/fab/hello/array/hello.array.44.2.cad hello.array.44.2.cad] - rafrás með tveimur layerum (erfiðara að smíða, en þarf ekki 0 Ohma viðnám)
+
 
+
=== LCD skjár ===
+
Rás sem stýrir LCD skjá
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/LCD/hello.LCD.44.cad hello.LCD.44.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/LCD/hello.LCD.44.asm hello.LCD.44.asm] - smalamálskóði
+
 
+
=== Vídeóstýring ===
+
Rás sem birtir mynd á sjónvarpsskjá.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/video/hello.video.44.cad hello.video.44.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/video/hello.video.44.asm hello.video.44.asm] - smalamálskóði
+
 
+
=== Hátalari ===
+
Rás sem stýrir hátalara.
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/speaker/hello.speaker.45.cad hello.speaker.45.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/speaker/hello.speaker.45.pwm.asm hello.speaker.45.pwm.asm] - smalamálskóði sem notar [[PWM]]
+
* [http://fab.cba.mit.edu/about/fab/hello/speaker/hello.speaker.45.wave.asm hello.speaker.45.wave.asm] - smalamálskóði sem notar bylgjuform
+
 
+
=== DC mótor ===
+
Rás sem stýrir DC mótor
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/H-bridge/hello.H-bridge.44.cad hello.H-bridge.44.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/H-bridge/hello.H-bridge.44.asm hello.H-bridge.44.asm] - smalamálskóði
+
 
+
=== skrefamótor ===
+
Rás sem stýrir skrefamótor
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/stepper/hello.stepper.44.cad hello.stepper.44.cad] - rafrás, teikning
+
* [http://fab.cba.mit.edu/about/fab/hello/stepper/hello.stepper.44.full.asm hello.stepper.44.full.asm] - full stýring
+
* [http://fab.cba.mit.edu/about/fab/hello/stepper/hello.stepper.44.wave.asm hello.stepper.44.wave.asm] - bylgjustýring
+
* [http://fab.cba.mit.edu/about/fab/hello/stepper/hello.stepper.44.half.asm hello.stepper.44.half.asm] - hálfhringsstýring
+
 
+
=== Gömul hello-world verkefni ===
+
 
+
==== serial output, programming clip (hello) ====
+
* schematic: [http://fab.cba.mit.edu/about/fab/hello/old/hello/hello.sch hello.sch]
+
* PCB: [http://fab.cba.mit.edu/about/fab/hello/old/hello/hello.brd hello.brd]
+
* Gerber: [http://fab.cba.mit.edu/about/fab/hello/old/hello/hello.cmp hello.cmp] / [http://fab.cba.mit.edu/about/fab/hello/old/hello/hello.vinyl.cmp hello.vinyl.cmp]
+
* assembly code: [http://fab.cba.mit.edu/about/fab/hello/old/hello/hello.asm hello.asm]
+
* hex file: [http://fab.cba.mit.edu/about/fab/hello/old/hello/hello.hex hello.hex]
+
 
+
==== serial output, programming header (hello0) ====
+
 
+
==== serial I/O, programming clip (hello1) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello1/hello1.15.sch schematic]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello1/hello1.15.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello1/hello1.15.cmp Gerber]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello1/hello1.15.asm serial output]
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello1/hello1.15.echo.asm serial echo]
+
 
+
==== output: LED (hello2) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello2/hello2.sch schematic]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello2/hello2.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello2/hello2.asm serial output]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello2/hello2.blink.asm blink LED with serial output]
+
 
+
==== input: step-response (hello3) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello3/hello3.sch schematic]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello3/hello3.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello3/hello3.asm serial output]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello3/hello3.step.asm measure and send step-response curve]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello3/hello3.step.py receive and plot step-response curve]
+
 
+
==== Efe: button+LED ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/efe/efe.sch schematic]
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/old/efe/efe.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/efe/efe.hello.asm serial output]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/efe/efe.blink.asm blink the LED]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/efe/efe.charge.asm measure charging]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/efe/efe.charge.py plot charging]
+
 
+
==== A/D: light/sound/temperature (hello4) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello4/hello4.sch schematic]
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello4/hello4.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello4/hello4.asm serial output]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello4/hello4.ad.asm measure A/D]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello4/hello4.temp.asm measure temperature]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello4/hello4.ad.py plot readings]
+
 
+
==== D/A: speaker (hello5) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello5/hello5.sch schematic]
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello5/hello5.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello5/hello5.pwm.asm PWM]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello5/hello5.wave.asm wavetable synthesis]
+
 
+
==== display: LCD (hello7) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello7/hello7.sch schematic]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello7/hello7.brd PCB]
+
  display hello world: [http://fab.cba.mit.edu/about/fab/hello/old/hello7/hello7.1.asm master] [http://fab.cba.mit.edu/about/fab/hello/old/hello7/hello7.2.asm slave] processor
+
 
+
==== video: RS170 (hello8) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello8/hello8.sch schematic]
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello8/hello8.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello8/hello8.video.asm display hello world]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello8/rs170.jpg RS170]
+
 
+
==== motion: stepper (hello9) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello9/hello9.sch schematic]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello9/hello9.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello9/hello9.cmp Gerber]
+
 
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello9/hello9.step.asm stepper]
+
 
+
==== multiplexing: LED array (hello10) ====
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello10/hello10.sch schematic]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello10/hello10.brd PCB]
+
* [http://fab.cba.mit.edu/about/fab/hello/old/hello10/hello10.asm multiplexing]
+

Revision as of 10:08, 25 May 2009

Þetta er íslensk útgáfa á CBA Hello World síðunni fyrir Fab Lab smiðjurnar.


CAD/CAM

Sýnidæmi

2D vector teikning

2D raster teikning

3D

Forritun

Nytsamlegir Python pakkar

Útgáfustýring / dreifð þróunarvinna

  • git
    • msysgit - Git fyrir Windows
    • gitk - Grafískt notandaviðmót fyrir Git
    • git-gui - Annað grafískt notandaviðmót fyrir Git
  • [dist/siteserver.py siteserver] - Python skrifta fyrir vefþjóna sem gerir möppu að Git safni

Rafrásir / PCB

Hermun rafrása

Örstýringar

Fræsivél / Modela

  • Modela
    • stty 9600 raw -echo crtscts </dev/ttyS0
  • move x y
    • cat out.rml > /dev/ttyS0

Vínilskeri

  • CAMM-1
    • cat out.camm > /dev/parport0

Laserskeri

  • Epilog
    • cat out.epi > /dev/parport0

AVR forritun

  tiny45 load hex file, bsd cable: avrdude -p t45 -c bsd -U flash:w:file.hex
  tiny45 load hex file, dasa cable: avrdude -p t45 -P /dev/ttyUSB0 -c dasa -U flash:w:file.hex
  tiny44 load hex file: avrdude -p t44 -c bsd -U flash:w:file.hex
  tiny44 use 20 MHz xtal: avrdude -p t44 -c bsd -U lfuse:w:0x7E:m
  mega88 load hex file: avrdude -p m88 -c bsd -U flash:w:file.hex
  mega88 use 20 MHz xtal: avrdude -p m88 -c bsd -U lfuse:w:0x76:m
  mega644 load hex file: avrdude -p m644 -c bsd -U flash:w:file.hex
  mega644 use 20 MHz xtal: avrdude -p m644 -c bsd -U lfuse:w:0x76:m

Til að forritun virki gæti verið nauðsynlegt að keyra: (Sjá Linux skipanalínan)

 su
 modprobe parport
 modprobe ppdev
 chmod 777 /dev/parport0

ATtiny45 programming cable:

          7 - reset - 1 8 -
                    - 2 7 - SCK - 8
                    - 3 6 - MISO - 10
           18 - GND - 4 5 - MOSI - 9
                4   1  7  5   6          clip
  1  2  3  4  5  6  7  8  9  10 11 12 13 DB25
   14 15 16 17 18 19 20 21 22 23 24 25   DB25

in-circuit programming AMP MTA plug <- DB25M parallel (bsd) cable (wire side view):

        9        18        10
  | MOSI (3)  GND (2)  MISO (1) |
     -RESET (4)  SCK (5)
           7        8
                 | cable direction
                 v
  plug               1   3   5   4     2
  DB25  13  12  11  10   9   8   7   6   5   4   3   2   1
  DB25    25  24  23  22  21  20  19  18  17  16  15  14

in-circuit programming AMP MTA plug <- DB9F serial (dasa) cable (wire side view):

                 ^
                 | cable direction
        3        5         8
  | MOSI (3)  GND (2)  MISO (1) |
     -RESET (4)  SCK (5)
           7        4
  plug         4 3 1 5   2        
        DCD  Rx  Tx DTR GND
          DSR RTS CTS  RI
  DB9    1   2   3   4   5
  DB9      6   7   8   9
  serial programming voltage limiter: <A href=dist/dasa.cad dasa.cad]

serial AMP MTA plug <- DB9F cable (wire side view):

     Tx GND
  |  2   1 |
   3   4
   Rx DTR
      | cable direction
      v
  plug      3   2   4   1
       DCD  Rx  Tx DTR GND
         DSR RTS CTS  RI
  DB9   1   2   3   4   5
  DB9     6   7   8   9

Molex serial PCB connector:

  1   2   3   4
  Rx  Tx  DTR Gnd

Molex serial cable:

  4   3   2   1
  Gnd DTR Tx  Rx DCD
   RI  CTS RTS DSR
  5   4   3   2  1
   9   8   7   6
  PIN   PURPOSE              SIGNAL NAME  HEADER
  Pin 1 Data Carrier Detect  DCD
  Pin 2 Received Data        RxData       1
  Pin 3 Transmitted Data     TxData       2
  Pin 4 Data Terminal Ready  DTR          3
  Pin 5 Signal Ground        Gnd          4
  Pin 6 Data Set Ready       DSR
  Pin 7 Request To Send      RTS
  Pin 8 Clear To Send        CTS
  Pin 9 Ring Indicator%09      RI

Hello-world rafrásir