|
|
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]
| + | |
in-circuit programming AMP MTA plug <- DB25M parallel (bsd) cable (wire side view):
in-circuit programming AMP MTA plug <- DB9F serial (dasa) cable (wire side view):