Revision: 1497
Author: [email protected]
Date: Sun Nov 22 10:01:29 2009
Log: added youtube video link for blink a led tutorial
http://code.google.com/p/jallib/source/detail?r=1497
Modified:
/trunk/doc/dita/tutorials/tutorial_blink_a_led.xml
/trunk/doc/dita/tutorials/tutorial_getting_started.xml
=======================================
--- /trunk/doc/dita/tutorials/tutorial_blink_a_led.xml Sun Nov 8 01:04:16
2009
+++ /trunk/doc/dita/tutorials/tutorial_blink_a_led.xml Sun Nov 22 10:01:29
2009
@@ -11,17 +11,17 @@
<section>
<title>Where to we start?</title>
<p>Let’s make a led blink on and off, how fun is that!</p>
- <p>So, you’ve followed the installation guide and now have a
Programming language (JALv2) + Libraries (JALLIB) + Editor. We will be
using JAledIT for our first example.</p>
+ <p>So, you’ve followed the installation guide and now have a
Programming language (JALv2) + Libraries (JALLIB) + Editor. We will be
using JALEdIt for our first example.</p>
</section>
<section>
<title>Setup your workspace</title>
- <p>Start by getting out your programmer and connect it to your pc.
Some connect by serial port, some connect via USB. I actually use a serial
port programmer attached to a USB-to-Serial addapter to free up my serial
port for other projects.</p>
+ <p>Start by getting out your programmer and connect it to your PC.
Some connect by serial port, some connect via USB. I actually use a serial
port programmer attached to a USB-to-Serial adapter to free up my serial
port for other projects.</p>
<p>If you are using a serial port programmer you need to check that
you have a regular serial cable and is not a null modem cable. Using your
multimeter, check that each pin of your serial cable matches, if pins 7
& 8 are crossed, it is a null modem cable.</p>
<p><image href="images/blink_a_led_serial_cable.jpg"/><image
href="images/blink_a_led_usb_to_serial.jpg"/><image
href="images/blink_a_led_serial_pinout.jpg"/></p>
- <p>Get out your PIC microcontroller (we will now refer to it as a
PIC). You can use PIC’s 16f877, 16f877A, 18F2550 , 18F452 or 18F4550 for
this project since the port pinouts are the same for all of them. I will
use 16f877A for this blink a led project.</p>
+ <p>Get out your PIC microcontroller (we will now refer to it as a
PIC). You can use PIC’s 16f877, 16f877A, 18F2550 , 18F452 or 18F4550 for
this project since the port pin outs are the same for all of them. I will
use 16f877A for this blink a led project.</p>
<p>Now check PC connectivity to your programmer. Open your
programming software on your PC, check the settings within your software to
change the serial port number and programmer type (if available). Your
programmer software may tell you that your board is connected, if not, put
your PIC in your programmer and do some basic tests such as “read chip”,
“blank / erase chip”</p>
<image href="images/blink_a_led_programmer.jpg"/>
- <p>If you are using Micropro, click on “file” -> “port”, and
“file” -> “programmer” -> (your programmer type). If you do not know
the programmer type, you will have to guess untill Micropro says something
like “K149-BC board connected”, Put your PIC in your programmer and choose
your PIC type from the “Chip Selector” text box. Now do some basic
read/erase tests.</p>
+ <p>If you are using Micropro, click on “file” -> “port”, and
“file” -> “programmer” -> (your programmer type). If you do not know
the programmer type, you will have to guess until Micropro says something
like “K149-BC board connected”, Put your PIC in your programmer and choose
your PIC type from the “Chip Selector” text box. Now do some basic
read/erase tests.</p>
<image href="images/blink_a_led_micropro_read_pic.jpg"/>
</section>
<section>
@@ -37,22 +37,22 @@
<p>Your circuit is done, and it looks pretty, but it doesn’t do
anything :o(..</p>
</section>
<section>
- <title>Understand the jalv2 direcotry structure</title>
+ <title>Understand the jalv2 directory structure</title>
<p>First take a look at your jalv2 installation directory on your
PC, wherever you installed it. </p>
<p><image href="images/blink_a_led_jalv2_dir.jpg"/></p>
<p><b>compiler</b> – holds the jalv2.exe compiler program to convert
your JAL code to microcontroller hex code</p>
- <p><b>jaledit </b>– JAL text editor where you will write your
code</p>
+ <p><b>JALEdIt </b>– JAL text editor where you will write your
code</p>
<p><b>lib</b> – A set of libraries to make things work</p>
<p><b>sample</b> – Working examples.</p>
<p>Create yourself a folder called workspace, and in that folder
create a folder called blink_a_led (eg. C:\jalv2\workspace\blink_a_led\)</p>
</section>
<section>
<title>Setup your editor & .jal file</title>
- <p>Open up your fav text editor. I will use JAledit. Run jaledit.exe
from the jaledit directory. Start a new document, and save it in
jalv2\workspace\blink_a_led\ and name it blink_a_led.jal (eg:
C:\jalv2\workspace\blink_a_led\blink_a_led.jal)</p>
+ <p>Open up your favorite text editor. I will use JALEdIt. Run
jaledit.exe from the JALEdIt directory. Start a new document, and save it
in jalv2\workspace\blink_a_led\ and name it blink_a_led.jal (eg:
C:\jalv2\workspace\blink_a_led\blink_a_led.jal)</p>
</section>
<section>
<title>Let’s write some code</title>
- <p>So now we’re going to write the code that will make our led
blink. All code will be in highlighted text. You can read more about JAL
language useage here: <xref
href="http://www.casadeyork.com/jalv2/language.html" format="html" class="-
topic/xref ">http://www.casadeyork.com/jalv2/language.html</xref></p>
+ <p>So now we’re going to write the code that will make our led
blink. All code will be in highlighted text. You can read more about JAL
language usage here: <xref
href="http://www.casadeyork.com/jalv2/language.html" format="html" class="-
topic/xref ">http://www.casadeyork.com/jalv2/language.html</xref></p>
</section>
<section>
<title>Title & Author Block</title>
@@ -93,7 +93,7 @@
</section>
<section>
<title>Configure PIC Settings</title>
- <p>The following code sets some of the PIC’s internal settings,
called fuses. A OSC setting of HS tells the PIC there is an external clock
or crystal ocillator source. You must disable analog pins with
enable_digital_io() , you don’t need to worry about the others.</p>
+ <p>The following code sets some of the PIC’s internal settings,
called fuses. A OSC setting of HS tells the PIC there is an external clock
or crystal oscillator source. You must disable analog pins with
enable_digital_io() , you don’t need to worry about the others.</p>
<p><codeblock>-- configuration memory settings (fuses)
pragma target OSC HS -- HS crystal or resonator
pragma target WDT disabled -- no watchdog
@@ -104,13 +104,13 @@
</section>
<section>
<title>Choose an output pin</title>
- <p>Let’s choose an output pin to control our led. As you can see
from the circuit, our led is connected to pin #2. Let’s check our datasheet
to find the pin name from the pinout diagram. </p>
- <p>The PDF datasheet for this PIC and for all others can be
downloaded from the microchip website. Here is the datasheet for this PIC
<xref href="http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf"
format="html">http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf</xref>
,
and here is the pinout diagram from the datasheet:</p>
+ <p>Let’s choose an output pin to control our led. As you can see
from the circuit, our led is connected to pin #2. Let’s check our datasheet
to find the pin name from the pin out diagram. </p>
+ <p>The PDF datasheet for this PIC and for all others can be
downloaded from the microchip website. Here is the datasheet for this PIC
<xref href="http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf"
format="html">http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf</xref>
,
and here is the pin out diagram from the datasheet:</p>
<p><image href="images/blink_a_led_16f877_pinout.jpg"/></p>
<p>As you can see, we are using the pin RA0/ANO at pin #2. RA0 is
the pin name we are looking for. AN0 is another name for this same pin
(used in the analog to digital tutorial), but we can ignore it in this
tutorial. In the JAL language RA0 is written as pin_A0</p>
<p>Now let’s read the details of this pin in the datasheet on page
10. As you can see RA0 is a TTL Digital I/O pin. We are checking this to
make sure it is not a open drain output. Open drain outputs (like pin RA4)
require a pull-up resistor from the pin to V+</p>
<p><image href="images/blink_a_led_16f877_pin_info.jpg" width="500"
otherprops="clickable"/></p>
- <p>Now write code for pin A0. We are writing an “alias” only because
in the future we can refer to pin 2 (A0) as “led”. This way we no longer
need to remember the name of the pin (exept for the directional register in
the next line of code we will write).</p>
+ <p>Now write code for pin A0. We are writing an “alias” only because
in the future we can refer to pin 2 (A0) as “led”. This way we no longer
need to remember the name of the pin (except for the directional register
in the next line of code we will write).</p>
<p><codeblock>--
-- You may want to change the selected pin:
alias led is pin_A0</codeblock></p>
@@ -126,7 +126,7 @@
<p>So, now that we have the led under our control, let’s tell it
what to do.</p>
<p>We will want our led to continue doing whatever we want it to do
forever, so we’ll make a loop</p>
<p><codeblock>forever loop</codeblock></p>
- <p>It is good practice to indent before each line within the loop
for readability. 3 spaces before each line is the standard for JALLib.</p>
+ <p>It is good practice to indent before each line within the loop
for readability. 3 spaces before each line is the standard for Jallib.</p>
<p>In this loop, we will tell the led to turn on.</p>
<p><codeblock> led = ON</codeblock></p>
<p>now have some delay (250ms) a quarter of a second so we can see
the led on.</p>
@@ -188,12 +188,12 @@
<section>
<title>Compile your code to .hex</title>
<p>Now let’s get this beautiful code onto our PIC. Your PIC cannot
understand JAL, but it does understand hex, this is what the compiler is
for. The compiler takes people readable code and converts it to code your
PIC can understand.</p>
- <p>If you are using jaledit, click the compile menu at the top and
choose compile.</p>
- <p>If you are using your own text editor in windows, you will need
to open windows command prompt. Click start -> run and type cmd and
press ok. Now type (path to compiler) + (path to your .jal file) + (-s) +
(path to JALLIB libraries) + (options) Here’s an example:</p>
+ <p>If you are using JALEdIt, click the compile menu at the top and
choose compile.</p>
+ <p>If you are using your own text editor in windows, you will need
to open windows command prompt. Click start -> run and type cmd and
press OK. Now type (path to compiler) + (path to your .jal file) + (-s) +
(path to JALLIB libraries) + (options) Here’s an example:</p>
<p>C:\jalv2\compiler\jalv2.exe
"C:\jalv2\workspace\blink_a_led\blink_a_led.jal" -s
"C:\jalv2\lib" -no-variable-reuse</p>
<p>The option -no-variable-reuse will use more PIC memory, but will
compile faster.</p>
<p>If all this went ok, you will now have a blink_a_led.hex located
in the same directory as your blink_a_led.jal, If there where errors or
warnings, the compiler will tell you.</p>
- <p>A error means the code has an problem and could not generate
any .hex file. If there is a warning, the hex file was generated ok and may
run on your PIC but the code shoud be fixed.</p>
+ <p>A error means the code has an problem and could not generate
any .hex file. If there is a warning, the hex file was generated ok and may
run on your PIC but the code should be fixed.</p>
</section>
<section>
<title>Write the hex file to your PIC</title>
@@ -202,7 +202,8 @@
<section>
<title>Let's Try It</title>
<p>Put your PIC back into your circuit, double check your circuit if
you haven’t already, and make sure your PIC is facing the correct
direction. Apply power to your circuit.</p>
- <p>It’s alive! You should see your led blinking! Congradulations on
your first JALv2 + JALLIB circuit!</p>
+ <p>It’s alive! You should see your led blinking! Congratulations on
your first JALv2 + JALLIB circuit!</p>
+ <p>Here's a youtube video of the result: <xref
href="http://www.youtube.com/watch?v=PYuPZO7isoo" format="html"/></p>
</section>
</body>
</topic>
=======================================
--- /trunk/doc/dita/tutorials/tutorial_getting_started.xml Sun Nov 8
01:04:16 2009
+++ /trunk/doc/dita/tutorials/tutorial_getting_started.xml Sun Nov 22
10:01:29 2009
@@ -121,7 +121,7 @@
<image href="images/getting_started_micropro.jpg"/>
</section>
<section>
- <p>Ok, enough of this boring stuff, lets build something! Start with
the <xref href="tutorial_blink_a_led.xml">Blink A Led Tutorial</xref>.</p>
+ <p>OK, enough of this boring stuff, lets build something! Start with
the <xref href="tutorial_blink_a_led.xml">Blink A Led Tutorial</xref>.</p>
</section>
</body>
</topic>
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at http://groups.google.com/group/jallib?hl=.