| What does PL/i look like?
Most of any given program will look a lot like Basic. Referring to subroutines as "procedures" is borrowed from older languages like Pascal. The block structure is common to many languages, and setting the blocks apart with "begin..end" instead of {} is also borrowed from Pascal. In fact, if you are a Pascal programmer, you may recognize several similarities. We hope you won't miss ":=".
The simple test program shown here will ramp an analog output on AddMe III up and down from zero to near full scale. It got named "dimmer" because if we connect an LED across the output, we have an LED dimmer. This makes a good "my first program" exercise.
|
|
program dimmer
declare
myVar: int;
procedure turnon (setting: int)
declare
level: int;
begin
level = setting * 10;
seti (19, level);
delay (5);
end;
begin
while TRUE do
begin
 for myVar = 0 to 20 turnon(myVar);
 for myVar = 20 down to 0 turnon(myVar);
end;
end
|