このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


Second Tutorial, Pascalite Programming- plt1bp HOME - - - - - - - - - Other 構成要素 for programmers - - - - - - - - - Pascalite Tutorial (米)棚上げする/(英)提議する of Contents

Pascalite Programming: Second program

This 見解/翻訳/版 of this tutorial is 罰金 tuned for a Pascalite, or the 解放する/自由な ソフトウェア Pascalite emulation. Please send me an email with "(民事の)告訴s" if something doesn't work!

If you have the open source FPC, aka 解放する/自由な Pascal or Borland's Turbo Pascal (TP hereafter), then there's a separate tutorial for you, covering much of the ground as 現在のd here for the Pascalite (人が)群がる.



Welcome. Here we go...

解雇する/砲火/射撃 up your Pascalite ソフトウェア. Enter the に引き続いて program....
program second;
begin
令状(lcd,255);
repeat
令状(lcd,'Hi');
until 4=5;
end.
... and start the simulator and (click green arrow, remember?) run the program. You should see HiHiHi... appear on the ふりをするd LCD. Before the 審査する gets very 十分な, try clicking on the 黒人/ボイコット arrows either 味方する of the 速度(を上げる) 指示する人(物), which is probably 説 "Med" (for medium) at the moment.

The 令状(lcd,255) line (疑いを)晴らすs the LCD 審査する. If you said 令状(lcd,65), an A would appear on the 審査する, 65 存在 the ASCII code for "A". Notice there are no apostrophes around the 65. If you wrote 令状(lcd,'65'), then you would get 65 on the LCD. 255 is what programmers call a rogue value. It is special; it isn't 扱う/治療するd like other numbers. Its meaning to the LCD 部隊 is "(疑いを)晴らす the 審査する". (It isn't a rogue value in general, only when sent to the LCD).

The word Repeat is one of the rare instances of something that is not followed by a semicolon, like Begin, discussed in the first tutorial. "Repeat" is always paired with an Until. The Until is always followed by something which is either true or 誤った. The "something" is called a 条件, in this 事例/患者 "4=5". 4 doesn't equal 5, of course, so the 条件 is 誤った. You will soon 会合,会う more コンビナート/複合体 (and sensible!) 条件s. (People with some experience of programming may wonder why I didn't say "until 誤った". Pascalite won't 受託する this, even though "誤った" is 許容できる in other circumstances.)

Our program, because of the "repeat/ until" pair will 成し遂げる the "令状(lcd,'Hi');" 指示/教授/教育 over and over again. This is called an infinite 宙返り飛行. 宙返り飛行s are powerful and useful, though you rarely make infinite 宙返り飛行s... on 目的! Some bugs are based on inadvertent infinite 宙返り飛行s.

修正する the program so that it says
program second;
begin
repeat
令状(lcd,255);
令状(lcd,'Hi');
until 4=5;
end.
(The word "repeat" has been moved up one line. You can do this by obvious means, but you can also do it by selecting the text, and then dragging it to where you want it!)

When you've made the change, and re-run the program, it almost looks as though "nothing" is happening. All 権利, the "Hi" appears and disappears.... but that's not much, is it? 非,不,無-the-いっそう少なく, the program is doing 令状(lcd,255); and 令状(lcd,'Hi'); over and over again. Notice the big 影響 on the results that arises from moving the "repeat" just one line. You should be able to see why the program behaves 異なって....
Pascalite, 存在 written for a 明確な/細部 piece of 金物類/武器類, has a few special features not 設立する in more general Pascals. As the 金物類/武器類 is a microcontroller, the usual way you give it input is more basic than is usual on a PC.... but don't worry! We'll talk more about input later, and our first example of Pascalite input is 現実に easier to understand than typical PC input. This is also the moment that you learn about the if... then... structure.

Change the line in your program that says....
令状(lcd,'Hi');
... so that it says...
if b0 then 令状(lcd,'b0 true');
N.B.: That's b-無, not b-oh.

追加する, just after the previous...
if not(b0) then 令状(lcd,'b0 誤った');

... and run the program again. (F2 and click green arrow).

Once the program is running, click on the 事実上の toggle switch labelled b0. It is 近づく the middle of the simulator パネル盤. The message that is flashing on the LCD パネル盤 should be "b0 true" when the switch is 負かす/撃墜する, and "b0 誤った" when the switch is off.

If you are lucky enough to have a real Pascalite, the LCD パネル盤 is an optional extra. We'll を取り引きする getting around the need of it in a minute. The real 同等(の) of the 事実上の switch b0 is very, very simple: An ordinary toggle switch. The wire from one 味方する goes to one place on the Pascalite, the other 味方する gets a wire and a resistor connected. That wire connects to a second point on the Pascalite, and the other 味方する of the resistor to a third point on the Pascalite. 明白に, you may need a little more 詳細(に述べる), but I hope that 説得するs you that the 金物類/武器類 is simple.

By the way.. a little aside: the word "then" has at least two meanings in English. It can be a 事柄 of sequence: I put on my socks, THEN I put on my shoes. Or it can be a 事柄 of consequence: If you eat three pizzas, THEN you will be sick. While time comes into that, too, I hope you'll see the more 重要な "consequence" element. In programming, "then" is used in the consequence sense.

There's nothing "wrong" with our program as it stands, but programmers often want to choose between two 代案/選択肢s, and have been given the に引き続いて shortcut. The two "if..." lines can be 取って代わるd with....
if b0 then 令状(lcd,'b0 true') else 令状(lcd,'b0 誤った');
Did the author of Pascal 心配する the internet? I ask that because I don't know how the line above appears on your 審査する.... and, I'm glad to say, it doesn't 事柄! If your browser window isn't 狭くする, from "if..." to "...誤った');" is perhaps on a 選び出す/独身 line, and it is 論理(学)の to 令状 it thus in the Pascalite editor. However, it is also 許容できる to 令状 it as two lines.... (make your browser window wide enough to 減ずる the に引き続いて to two lines)...
if b0 then 令状(lcd,'b0 true')
   else 令状(lcd,'b0 誤った');
公式文書,認める how I have indented the second line. It is optional, but it makes reading through your program easier, because it 強調するs the fact that the "else..." line is just a 延長/続編 of what started on the previous line. Everything from the "if..." to the "...誤った');" is ONE 声明. The 概念 of what is a 声明 is important in Pascal, and gets subtle in more コンビナート/複合体 事例/患者s. The big thing to notice here is that there is no semicolon before the semicolon. The 概念 of 声明s is a little like the 概念 of 宣告,判決s in everyday English. Both of the に引き続いて are valid (関わりなく where you break the lines, as in Pascal), and 類似の to 選び出す/独身 声明s in Pascal:

I will go to town.
I will go to town if it is raining.

It is incorrect to 令状:

I will go to town. If it is raining.

Pascal's semicolon is a bit like English's period (十分な stop). Because so many lines in Pascal end with a semicolon, and because putting one before an "else" 原因(となる)s problems, and because if...then...else 声明s are usually 分裂(する) across two (or more) lines, I still alter 類似の lines in my programs as follows:
if b0 then 令状(lcd,'b0 true') {no ; here}
   else 令状(lcd,'b0 誤った');
The text between the curly brackets is ignored by Pascalite. The chance to 追加する comments thus can be a real help to the programmer. Comments are also called 発言/述べるs, or rems. In other dialects of Pascalite, comments can be 含むd thus...
(*This is a rem*)
... or
//All of the 残り/休憩(する) of this line is a rem

Just before I end this tutorial, let's 解除する our 注目する,もくろむs from the mud in 前線 of our feet on this trek に向かって programming proficiency, and gaze at more 利益/興味ing 事業/計画(する)s in the middle distance. Suppose you had your Pascalite wired to your six レコード CD player, and you 手配中の,お尋ね者 to be able to use switches (like b0) to select which CD will play. Of course, you could 簡単に use six switches... but with a little cleverness a mere three will do. I the に引き続いて, a 0 stands for "switch in off position", and a 1 stands for "switch in on position" Each group of 3 digits shows the settings of the three switches.


000 could stand for "play CD1"
001 could stand for "play CD2"
010 could stand for "play CD3"
011 could stand for "play CD4"
100 could stand for "play CD5"
101 could stand for "play CD6"

... and you's still have 2 codes spare! If you want to switch between 256 選択s, a mere 8 switches is enough. 冷静な/正味の?




The work so far may have seemed "boring", but you have to walk before you run. If you're not 決定するd (stubborn?) enough to slog through this dull stuff, you're probably not temperamentally ふさわしい to programming, anyway. But that's okay: Higher 給料 for those of us who are! Even if you aren't looking for 給料, hang in there? It does get fun!




Please also 公式文書,認める that I have two other 場所/位置s, and that the に引き続いて search will not 含む them. They have their own search buttons.

My Sheepdog Guides 場所/位置.
My Arunet 場所/位置.

Go to the 場所/位置s above, and use their search buttons if you want to search them.
To search this 場所/位置....

Search this 場所/位置 or the web 力/強力にするd by FreeFind

場所/位置 search Web search
The search engine 単に looks for the words you type, so....
*    (一定の)期間 them 適切に.
*    Don't bother with "How do I get rich?" That will 単に return pages with "how", "do", "I"....

You can also search this 場所/位置 without using forms.
広告 from page's editor: Yes.. I do enjoy 収集するing these things for you... hope they are helpful. However.. this doesn't 支払う/賃金 my 法案s!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and 循環させる it for me? Links on your page to this page would also be 高く評価する/(相場などが)上がるd!
Click here to visit editor's freeware, shareware page.


Want a 場所/位置 hosted, or email? You can also help me if you 調印する up 経由で this link to 1&1's services. (I wouldn't recommend them unless I was happy after several years as one of their 顧客s. The Google advertisers 支払う/賃金 me. I know nothing about them or their services, of course.)



Valid HTML 4.01 Transitional Page has been 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org. Mostly passes.

AND passes... Valid CSS!


Why does this page 原因(となる) a script to run? Because of the Google パネル盤s, and the code for the search button. Also, I have some of my pages' traffic 監視するd for me by eXTReMe tracker. They 申し込む/申し出 a 解放する/自由な tracker. If you want to try one, check out their 場所/位置. Why do I について言及する the script? Be sure you know all you need to about spyware.
Editor's Main Homepage
How to email or 令状 this page's editor, Tom Boyd

....... P a g e . . . E n d s .....