DonTronics PicBasic Compiler. More Info.

Home | Products | Prices | Directory | Order | Contact | New | Books | Files | Links | Other
Bottom_of_Page

More Information:
What are they saying about this Product?
Version updates: Currently Version 1.30
Walking LED Basic Program. 'WLEDPBC.BAS'. Parallax Basic Stamp 1 Compatible.
Walking LED Output Source. 'WLEDPBC.SRC'
Walking LED Output Object. 'WLEDPBC.HEX'

Using my Cheap Programmer to burn 84's with the output of PBC.
Nigel.zip new features. Points to Download.
Ken.zip plus 'WLEDPBC.INI' file. Points to Download.

If you are a US Customer and you purchase directly from MEL, just mention that you saw this product first on this home page.

PicBasic Compiler or 'PBC'

This additional info is made up of some text straight from the manual mixed with a generous sprinkling of Don's thoughts and ideas.

Memory:

How does the memory storage capacity of the 84 stack up against the Stamp?

I couldn't find anything in the manual about this so I grabbed two of my old programs that have been around for nearly two years now and found the following:

My WLED.BAS program...

Parallax Basic Stamp: 36 bytes of 256 total is 14.06% used.
PicBasic Compiler: 151 bytes of 1024 bytes total is 14.74% used.

My PAGER.BAS program...

In both cases, 14 bytes of additional EEPROM is used for storage, and these bytes have been included.

Parallax Basic Stamp: 138 bytes of 256 total is 53.90% used.
PicBasic Compiler: 412 bytes of 1024 bytes total is 41.11% used.

Also the PICs RAM does start at different addresses on the '84 and '62x's. The '620 also only has .5K of ROM so programs that ran in a 1K '84 may not fit. On the other hand, the 622 has 2K of memory and this can be fully utilised.

And you can't use the EEPROM commands on anything but the '84. This may be a future development. In the meantime this can be done with Basic or Assembly code.

Speed:

Since PBC programs execute directly from the code space of the PIC rather than being fetched from a serial EEPROM, PBC programs execute much faster than equivalent programs on a Basic Stamp. In fact, some programs execute 100's of times faster! This sits somewhere between a true Machine Language Program and the Stamp speed.

Cost:

(Prices quoted are US Dollar$)

Why pay $34 per project, or worse yet, per product? PBC allows programs to be compiled directly into PICs costing from $5 to $10. With this kind of saving, the investment in this compiler and the DonTronics PIC84PGM programmer could all pay for itself in just a few projects. The lower cost may mean the difference between a marketable product or an expensive idea with no where to go.

Operating Software:

DOS prompt only that uses the following syntax: PBC Options Filename

PIC Hardware:

The created file is designed to run on a PIC16C84/04/P running at 4Mhz. All you really need is two 20pf caps for the crystal, a 10K pullup for the /MCLR and +5Volts. Most 84s can be speed up to 8Mhz, but note that this doesn't comply with manufacturers specs. Tin canned, 4 legged TTL Oscillators may speed it along at 12Mhz too, but watch out for internal EEPROM read/write cycles! Gary Barnes of Western Australia put me onto the 12Mhz Oscillator trick.

Other users have told me that you can get some 4Mhz PICs running at 16 and 20Mhz by just putting a 10Meg resistor across the faster cyrstal.

DEBUG Command:

This isn't supported with PBC. May I suggest you make up a single wire interface with 2 by 7 SEG LEDs or an LCD for this. I did this in the old days with my Z80 stuff. You can use a target board with an 84 on board to accept the serial stream and decode it to the LEDs or LCD.
All other commands are supported.

Gosub/Return:

The Stamp implements subroutines via these statments. User variable W6 is used by the Stamp as a four nibble stack. Thus, Stamp PBasic programs may have up to 16 Gosubs and subroutines can be nested up to four levels deep.

The PIC16Cxx has these two instructions as well as an eight level stack. PBC programs make use of these instructions and use four levels of this stack, with the other four levels being reserved for library routines. Thus, W6 is still available, subroutines may still be nested up to four levels deep and the number of Gosubs is limited only by the PIC's code space.

Summary:
Subroutines: Nested four deep on both.
Gosubs: Stamp 16, PBC limited only by code space.

EEPROM, Read and Write

The PIC16C84 has 64 bytes of EEPROM that PBC uses for these commands.
The 620, 621, and 622 don't support the EEPROM 'Read' or 'Write' commands.

Back to The Table of Contents.

What are they saying about this Product?

From henderso@ee.msstate.edu    Wed Jun 12 07:22:33 1996
Date: Tue, 11 Jun 1996 08:04:31 -0500
From: Mark Edsel Henderson 
Reply to: stamps@parallaxinc.com
To: stamps@parallaxinc.com
Subject: Re: [STAMPS] PBASIC Compiler

How about some more information on this PIC BASIC Compiler.  Just
general stuff like where to get it, how much it costs, and features.
I like the idea of getting some free speed, and  a longer program.
Is this the free lunch we have been waiting for. ;)
Mark

===============================================================

From PJWELEC@aol.com     Wed Jun 12 07:20:16 1996
Date: Tue, 11 Jun 1996 05:25:17 -0400
From: PJWELEC@aol.com
Reply to: stamps@parallaxinc.com
To: stamps@parallaxinc.com
Subject: Re: [STAMPS] PBASIC Compiler

An excellent product - Stamp Compatible
I bought this complier from them over here in the UK
Very Fast - Have to slow Some commands down 
not limited to 16 gosubs And when you can use pic84's 
at @ 2UKp Excellent investment PHIL >>

===============================================================

From sean@msiconsulting.com     Wed Jun 12 07:20:36 1996
Date: Tue, 11 Jun 1996 06:42:39 -0700
From: "MSI: Sean Cunningham" 
Reply to: stamps@parallaxinc.com
To: "'stamps@parallaxinc.com'" 
Subject: FW: [STAMPS] PBASIC Compiler

I compile programs for 16C84's using it - it works very well indeed. 
Saves a lot of money to compile for 16c84s than use BS1's.

===============================================================
Date:         Sun, 22 Sep 1996 23:26:24 +0300
Reply-To: pic microcontroller discussion list 
Sender: pic microcontroller discussion list 
From: Pekka Ritamaki 
Subject:      Re: picbasic version 1.20
To: Multiple recipients of list PICLIST 

Hello Barbaros!
>I am using picbasic ver. 1.20 from micro engineering labs. for sometime
>there any other pic basic compilers ?What do you think about picbasic ?

I am using it also and I am very satified. No problems. I have done a
keyboard scanner( 8*8 matrice) to RS-232 ( 9600 baud), a serial to 4*20 LCD
with many options ( EEPROM logos, 12-bit AD-converter, cursor control, row
control). Serial to 4*relays ( 12V coils, 250VAC 10A contacts, 3*16-bit
AD-converter to serial ( 3 USD coverter chips!). No I am thinking serial to
PWM problem ( no spikes to output during serial input), Halogen lamp ( 12VAC
2A ) or 4-20 mA current output control by serial etc.
Regards Pekka
Pekka Ritam=E4ki
PROBYTE Oy
Nirvankatu 31
FIN-33820 TAMPERE=20
puh INT +358-31-2661885
fax INT +358-31-2661886
http://www.sci.fi/~pri

===============================================================

Date:         Mon, 23 Sep 1996 06:53:35 -0700
Reply-To: pic microcontroller discussion list 
Sender: pic microcontroller discussion list 
From: Mike Hagans 
Organization: CircuitWerkes
Subject:      Re: Picbasic v1.20

Greetings Barbaros,

Have been using the Micro Engineering Labs Pbasic compiler for a few
weeks now.  I like it too!  My sole project (thus far) with it is a Telco
coupler/dtmf decoder (on portA of 16c84) with combination-lock style
access.  Getting the PCB's made this week.  You can get some good
reference applications and a much better description of Pbasic command
usage from the Parallax web site.

73's
Mike (N4JRD)

===============================================================

Date:         Mon, 23 Sep 1996 19:25:48 -0700
Reply-To: pic microcontroller discussion list 
Sender: pic microcontroller discussion list 
From: BARBAROS ASUROGLU 
Subject:      Re: Micro Engineering
To: Multiple recipients of list PICLIST 

Dear Ronald;

> Ronald Ford wrote:

 > Barbaros (TA2CBA),  I would like to know more about Micro Engineering
 > Compiler.  I've looked at there Home pg. several times, wondered if
it's as
 > good as it sounds?  I have a pic84 and a counterfeit stamp going.
Stamp
 > gives you 8 I/O lines. Does Micro Eng. let you use port A on the 84?

 Yes;indeed you can use all ports (or lets call it registers)by basic
 command to write poke and to read peek(does it sound familiar??)

> Can > you use machine code along with the compiled basic commands?

 you can include machine code in between the program and 'CALL' whenever
 you want.They also supply their own assembler which is more powerful
than mpasm.

>  Would like to > use a Interrupt driven serial receive on the 84.  Any other
 input you
have
>

 The basic has form 300 to 9600 baud serial 8,N,1 config data input and
 output routines which is very easy to use.

 > on Micro Eng.  would be helpful.  Hate to spend the $ for something
that's
 > so so.          Thanks, Ron
 >
> > Ps. Northeastern Ohio

 Besides you can use this compiler not only for 16c84 for all members of
 16cxx,16c7x,16c6x.i used it on a 16c64 and 16c71 it was very easy and
 satisfactory.I think it is worth to buy it.One more think it is fully
 stamp compatible...:)

 These are the things coming to my mind in a few seconds if you have any
 other questions please do not hesitate to ask ...

 One more thing TA2CBA stands for Turkish Amateur Radioham call signs Are
 you interested in Ham Radio???

 Have a nice day ....:)

 Barbaros

===============================================================
Back to The Table of Contents.

Version Updates.

PicBasic Compiler Version 1.30  Copyright (c)1995, 1996 microEngineering Labs

===========================================================================
I2CIN and I2COUT commands for access to external serial EEPROMs.

Added Ver 1.30
===========================================================================
More user variables from B0-B79 and W0-W39 for use with larger PICs.

Added Ver 1.30
==========================================================================
PicStic 4+ PASS function.

Added Ver 1.30
==========================================================================
Interrupt vector access improved in INC\PBH.INC.

Adjusted Ver 1.30
==========================================================================
ENDASM previously had to be on a line all by itself.

Fixed Ver 1.30
===========================================================================
PEEK and POKE commands to access all PIC registers.

Added Ver 1.20
==========================================================================
Changed SERIN, SEROUT 600 baud to 9600 baud.

Adjusted Ver 1.20
==========================================================================
Changed PROTECT_ON to PROTECT_OFF in INC\PB*.INC.

Adjusted Ver 1.20
==========================================================================
SERIN didn't set port pin to input.

Fixed Ver 1.20
==========================================================================
ClockGet function (PicStic 2) causes program to perform
unpredictably. Resulted from indexing into bit mask table without
setting PCLATH and page containing table.

Fixed Ver 1.11
==========================================================================
@TABLE macro failed to properly page align table. Fixed operator
precedence error in calculating page boundaries.

Fixed Ver 1.11
==========================================================================
BUTTON command incorrectly interpreted downstate parameter.

Fixed Ver 1.11
==========================================================================
SERIN and SEROUT functions used more than 4 levels of stack. This
resulted in unpredictable program behavior if SERIN and SEROUT were
used in subroutines.

Fixed Ver 1.11
==========================================================================
Fixed typographic error (SUBFW rather than SUBWF) in code generator.

Fixed Ver 1.11
==========================================================================
Function AD0 (PicStic 3) didn't import ADC function. Improperly
written @MOD statement for function ADC.

Fixed Ver 1.11
==========================================================================
Adjust ADC (PicStic 3) data accumulation to allow more settling time
for A/D data.

Fixed Ver 1.11
==========================================================================
Assignment statement not properly placed in CODE segment if
immediately following an EEPROM statement.

Fixed Ver 1.11
==========================================================================
DIRS byte implemented wrong. PBASIC specified DIR? = 0 as input and
DIR? = 1 output. Adjusted macros & supported routines to complement
all bytes and bits accessed in [80..FF]. Only TRIS registers are
accessed by PBC directly in this page.

Fixed Ver 1.10
==========================================================================
PicStic 2 Clock Support and PicStic 3 A/D Support.

Added Ver 1.10
==========================================================================
Changed HS_OSC to XT_OSC in INC\PB*.INC.

Adjusted Ver 1.10
==========================================================================
Initial versions of @SAVE & @REST macros saved both PORT and TRIS
data. PORT data is unaffected by reset or watchdog timeout. New
versions save/restore only TRIS data.

Optimized Ver 1.10
==========================================================================
Potential failures to maintain watchdog timer corrected in the
following library routines and compiler generated sequences by
replacing 'RETURN' with 'GOTO DONE'.

Fixed Ver 1.10
==========================================================================


Following are additions to the PicBasic 1.0/1.1/1.2 manual.

2. Command Line Options

2.2. Options

Option       Option Description
  C    Suppress PBC Extensions
  Dı   Generates Listing, Symbol
       Table, and Map File
  Lı   Generates Listing
 OBı   Generates Binary rather than
       Merged Intel HEX
 P##   Specify Target (PIC16C##)
  Q    Forces use of explicit
       extension for Source Name
  S    Skips execution of Assembler
       when Done

ı Option is passed directly to PM, if invoked after compilation.

2.2.1. Option -C

In order to given the user options in extending the PBASIC language, PBC
provides some additional capabilities above and beyond the original
specifications for PBASIC. Namely PEEK and POKE, inline assembly, the CALL 
statement, and additional variables (W7 through W10 and B14 through B21). 
The -C option disables these extensions, forcing strict compatibility with 
original PBASIC on the program being compiled. Using any of these extensions 
with the -C will generate errors.

This is useful mainly for programs developed on the BASIC Stamp I which may have
variable names which conflict with extension keywords.

4.28. SERIN 
4.29. SEROUT

SERIN and SEROUT have been altered to run up to 9600 baud from the previous
limit of 2400 baud. This has been accomplished by replacing the little used
rate of 600 baud with 9600 baud. Modes of T9600, N9600, OT9600 and ON9600
may now be used.

600 baud is no longer available and will cause a compilation error if an
attempt is made to use it.

5. Structure of a Compiled Program

5.1. Target Specific Header (PB##.INC)

The first thing a PBC generated program does is define the symbol PBCX to be 1
if PBC extensions are enabled or 0 if PBC extensions are disabled. This allows
the library to selectively define additional variables and functions needed for
PBC extensions.

Next, a target specific header file is included. By default, this file is
PB84.INC, although this can be changed using the -P option.

This header is, in turn, responsible for including (via MACLIB) the processor
specific header supplied with PM. The PM header, in turn, defines all the
processor specific information needed to assemble programs for that PIC.

...

5.2. PBH.INC

PBH.INC first defines user variables in the data segment. This is followed by
the definition of working and temporary registers used by PBC's libraries.
User variables occupy 22 bytes of memory unless the -C option is used, in
which case only 14 bytes are used. Working variables  and temporary registers
occupy another 13 bytes.

...

6. PBC Extensions

Unlike the BASIC Stamp which executes on a virtual processor, PBC programs
execute directly on the PIC. Since no expansion was possible on the BASIC Stamp,
PBASIC provides no support for user extensions. PBC, on the other hand, adds
extensions allowing PBC programs to interface with additional PIC registers 
and assembly routines. These are similar to extensions found in other 
BASICs.

6.05. I2CIN and I2COUT

I2CIN

I2CIN Control, Address, Var {, Var}

I2CIN sends Control and Address out the I2C clock and data lines and puts
the byte(s) received into Var.

Symbol  con = %01010000
Symbol  addr = B5

        addr = 17           ' Set address to 17
        I2Cin con,addr,B2   ' Read data at address 17 into B2

I2CIN and I2COUT can be used to read and write data to a serial EEPROM
with a 2-wire I2C interface such as the Microchip 24LC01B, 24LC02B and
similar devices.  This allows data to be stored in non-volatile memory so that
it can be maintained even after the power is turned off.  These commands
operate in the I2C master byte read and write modes and may also be used to
talk to other devices with an I2C interface like temperature sensors and A/D
converters.

The lower 7 bits of the Control byte contain the control code along with chip
select or additional address information, depending on the particular device. 
The high order bit is a flag indicating whether the following Address is to be
sent as an 8 bit or 16 bit address.  If this flag is low, the Address is sent as 8
bits.  The control code for a serial EEPROM is %1010.

For example, when communicating with a 24LC01B, the Address required is
8 bits, the control code is %1010 and the chip select is unused so the Control
byte would be %01010000 or $50.  Formats of Control bytes for some of the
different parts follow:

Device    Capacity      Control         Address size
24LC01B   128 bytes     %01010xxx       8 bits
24LC02B   256 bytes     %01010xxx       8 bits
24LC04B   512 bytes     %01010xxb       8 bits
24LC08B   1K bytes      %01010xbb       8 bits
24LC16B   2K bytes      %01010bbb       8 bits
24LC32B   4K bytes      %11010ddd       16 bits
24LC65    8K bytes      %11010ddd       16 bits

xxx = don't care
bbb = block select (high order address) bits
ddd = device select bits

See the Microchip Non-Volatile Memory Products Data Book for more
information on these and other devices that may be used with the I2CIN and
I2COUT commands.

The I2C data and clock lines are predefined in the main library as PortA.0
and PortA.1 respectively.  This gets them out of the way of the PortB pins
and makes it unnecessary to define them in each I2CIN or I2COUT
statement.  They may be assigned to different pins by simply changing the
equates at the beginning of the I2C routines in the file PBL.INC.

The I2C data line should be pulled up to Vcc with a 4.7K resistor as it is
run in a bi-directional open-collector manner.


I2COUT

I2COUT Control, Address, (Value {, Value})

I2COUT sends Control and Address out the I2C clock and data lines
followed by Value.

Symbol  con = %01010000
Symbol  addr = B5

        addr = 17               ' Set address to 17
        I2Cout con,addr,(56)    ' Send the byte 56 to address 17
        Pause 10                ' Wait 10ms for write to complete
        addr = 127              ' Set address to 127
        I2Cout con,addr,(B12)   ' Send the byte in B12 to address 127
        Pause 10                ' Wait 10ms for write to complete

When writing to a serial EEPROM it is necessary to wait 10ms (device
dependent) for the write to complete before attempting communication with
the device again.  If a subsequent I2CIN or I2COUT is attempted before the
write is complete, the access will be ignored.

While a single I2COUT statement may be used to write multiple bytes at
once, doing so would violate the above write timing requirement for serial
EEPROMs.  The multiple byte write feature may be useful with I2C devices
other than serial EEPROMs that don't have to wait between writes.

See the I2CIN command above for the rest of the story.

6.1. PEEK and POKE

Since PBC may be used with PICs having features above and beyond the BASIC 
Stamp including A/D converters, additional I/O ports and the like, two new
statements have been added to access these features.

PEEK reads an 8 bit value from any PIC register into a variable.

        Peek Address, Var

POKE writes an 8 bit value to any PIC register.

        Poke Address, Value

For example, to write a value, let's say 7, to PORTA on a PIC16C84, simply:

        Poke 5, 7
or

Symbol  PORTA = 5
        B0 = 7
        Poke PORTA, B0

6.2. Inline Assembly

PBC programs may contain inline assembly. One or more lines of assembly code is
preceeded by the ASM keyword and ended by the ENDASM keyword. Both keywords
appear on their lines alone.

The lines of assembly are copied verbatum to the assembly output file. This
allows the PBC program to use all of the facilities of PM, the PIC Macro
Assembler. This also, however, requires that the programmer have some
familiarity with the PBC libraries. PBCs notational conventions are similar to
other commercial compilers and should come as no shock to programmers
experienced enough to attempt inline assembly.

All symbol names defined in a PBC program are similarly defined in assembly,
but with the name preceeded with an underscore ( _ ). This allows access to user
variables, constants, and even labeled locations. Similarly, system variable
(such as W0) names are also preceeded by underscores (such as _W0).

Thus, any name defined in assembly starting with an underscore has the
possibility of conflicting with a PBC generated symbol. If conflict is
avoided, can these underscored assembly values be accessed from PBC? No.
Remember, the underscored names generated by PBC are only shadows of the actual
information defined in the compiler. Since inline assembly is copied directly to
the output file and not processed by the compiler, the compiler not only lacks
any type or value information about assembly symbols, it is completely unaware
that they exist. If variables are to be shared between assembly and PBC,
either use predefined system variables or define the variables in PBC.

Just as underscored symbols have possible conflicts, so do symbols not starting
with underscores. The problem is internal library variables. Luckily, most
library variables contain an '@' or make reference to one one of the working
registers (such as R0). Avoiding such names should be reduce problems. If you
should have a name collisions, the compiler will report the duplicate
definitions as an error.

6.3. CALL Statement

  CALL Label

As mentioned in the previous sections, PBC has no knowledge of inline
assembly items and they are therefore inaccessible to PBC. This creates a
problem - how does a user write his own commands in assembly? How does he
extende PBC if no access is allowed to new functions?

That is the roll of the CALL statement. Similar to GOSUB, it calls a named
routine. Unlike GOSUB, it doesn't check to assure that the label is actually
defined - it simply generates the code. If it turns out that the target label is
not defined, an error is later generated by the assembler.

Since PBC provides no formal method of adding functions, the CALL lacks
anyway to specify parameters and/or return values. To get around this problem,
the assembly routines and the PBC program usually "agree" on system variables
to perform these functions.

Consider, for example, the SHIFTOUT commands of the BASIC Stamp II. This general
form using PBC might be :

    B21 = OutputValue  ' Set Output Value
    Call ShiftOut      ' Shift Value Out

    ...

ASM

_ShiftOut           ; Shift B21 to '595
                    ; Use R[0..1] and T[0..5]
                    ;    as Needed.
        goto done   ; PBC Statement Return

ENDASM

Notice that the definition of ShiftOut is preceeded by an underscore. The CALL
statement follows PBC's convention of preceeding all PBC accessible names
with underscores.

Also note that the function terminates by jumping to done rather than simply
returning. Returning would be fine, but the done function performs other
housecleaning needed by PBC (reseting the RP0 bit and hitting the watchdog). W
is not affected by done.

6.4. Additional Variables

A number of variables have been predefined for temporary data storage in
your PicBasic program.  Byte-sized variables are named B0, B1, B2 and so
forth.  Word-sized variables are named W0, W1, W2 and so forth.  These
word-sized variables are made up of two byte-sized variables.  For example,
W0 consists of B0 and B1; W1 is made up of B2 and B3 and so forth.  Any
of these variables can, in effect, be renamed using the Symbol command to
have more meaning within your program.

These variables are actually stored in the PIC's RAM registers.  B0 is stored
in the first available RAM location, $0C for the PIC16C84 and some of the
smaller PICs, or $20 for the PIC16C74 and other larger PICs.  Refer to the
Microchip PIC data books for the actual location of the start of the RAM
registers for a given PIC.

The variables are assigned to RAM sequentially up to and including B21 at
which point variables internal to the compiler library subroutines are
assigned.  These assignments are done in the file PBH.INC in the INC
subdirectory.  You may refer to it for additional information.

For a PIC with only 36 bytes of RAM, such as the PIC16C84, the 22 user
variable bytes and the internal library variables use all of the RAM that is
available.  For larger PICs like the PIC16F84 with 68 bytes of RAM and the
PIC16C74 with 192 bytes of RAM, additional user variables may be
accessed.  These variables continue at B22 and run through B79 (also W11
through W39.)  A particular PIC may not have actual RAM at all of these
additional locations.  If you try to use a variable with no RAM location,
the compiler will not generate an error, but your program will not do what
you expect.

This table lists the highest user variable names that should be used with each
PIC:

PIC16C61  B21  W10
PIC16C71
PIC16C710
PIC16F83
PIC16C84

PIC16C711 B51  W25
PIC16F84

PIC16C554 B63  W31
PIC16C556
PIC16C620
PIC16C621

PIC16C558 B79  W39
PIC16C622
PIC16C62(A)
PIC16C63
PIC16C64(A)
PIC16C65(A)
PIC16C72
PIC16C73(A)
PIC16C74(A)

7. Potential Problems

7.10. Placement of Inline Assembly

PBC statements execute in order of appearance in the source. The first
executable lines that appears in where the program starts executions. That
statement literally appears in memory right behind the controllers startup code.
Similarly, the END implicit at the end of every PBC program is accomplished
by having the code for the END function appear first and unconditionally in the
library. It appears in memory directly behind the user's last statements. This
methods saves two unneeded jumps and everything normally works out alright...

The tendency of programmers is to place their own library functions written
using the inline assembler either before or after their code. In light of the
above explanation, this could create some obvious problems. If they appear early
in the program, the assembly routines execute prior to any PBC instructions
(some programmers will invariably exploit this feature). If they appear at the
tail of the program, execution which "falls off the end" of the PBC
statements may mysteriously find themselves unintentionally executing assembly
routines.

What should you do? Simple. Unlike a hosted system (such as the PC or the Mac),
there is little reason for an embedded system to terminate. Thus, place your
assembly routines after your PBC code.If you need to terminate your program,
explicitly place an END statement at the end of your code rather then relying on
the implicit END.

Back to The Table of Contents.

Walking LED Basic Program:

Parallax Basic Stamp 1 compatible. WLEDPBC.BAS

'THIS SIMPLE TEST PROGRAM WILL TEST THE BASIC STAMP VERSION OF MY
'PIGMY BOARD. IT SHIFTS A LED TO THE RIGHT WITH A 1 SECOND DELAY
'YOU SIMPLY CONNECT MY RELAY8 BOARD UP AS A LED MONITOR.
START:                  'HOOK UP MY RELAY8 BOARD.
GOSUB CLEAR		'SET ALL OUTPUTS LOW ON ENTRY
FOR B2 = 0 TO 7         'COUNT UP TO 8
'FOR B2 = 7 TO 0 STEP-1  'COUNT DOWN TO 8
GOSUB CLEAR             'CLEAR ALL LEDS
HIGH B2			'LIGHT UP ONE ONLY
PAUSE 1000		'DELAY 1 SECOND
NEXT B2			'SHIFT THE "ON"  LED TO THE RIGHT
GOTO START 		'DO IT ALL AGAIN
CLEAR:                  'SET TO ALL OUTPUTS AND LOW
LOW 0       '
LOW 1       '      BASIC STAMP TEST PROGRAM by Don McKENZIE
LOW 2       '             P.O. Box 595 Tullamarine 3043
LOW 3       '                     AUSTRALIA
LOW 4       '
LOW 5       '  19-Jul-94
LOW 6       '
LOW 7       '
RETURN      '
Back to The Table of Contents.

Walking LED Output Source Code:


WLEDPBC.SRC
; PBASIC Compiler Version 1.11        Copyright 1995, microEngineering Labs

PBCX		equ	1		; Enable Extensions

		include	"PB84.INC"

_START		call	_CLEAR
		clrf	_B2
@T0001		call	_CLEAR
		movf	_B2,W
		call	high@
		movlw	003h
		movwf	R0+1
		movlw	0E8h
		call	pause@XW
		movf	_B2,W
		call	R0@0W
		call	incR0
		movf	R0,W
		movwf	_B2
		movlw	000h
		call	lt@0W
		btfss	Z
		goto	@T0002
		movlw	007h
		call	gt@0W
		btfsc	Z
		goto	@T0001
@T0002		@GOTO	_START
_CLEAR		movlw	000h
		call	low@
		movlw	001h
		call	low@
		movlw	002h
		call	low@
		movlw	003h
		call	low@
		movlw	004h
		call	low@
		movlw	005h
		call	low@
		movlw	006h
		call	low@
		movlw	007h
		call	low@
		goto	done

		include	"PBL.INC"
Back to The Table of Contents.

Walking LED Output Object:


WLEDPBC.HEX
:10000000031E08000E30A9000C3084008001840A11
:10001000A90B062886012C28212084000739840694
:100020000310840C840C840C041A841704128A01B3
:10003000820701340234043408341034203440344C
:10004000803407398A018207303431343234333412
:10005000343435343634373443208E0143200E088F
:100060005B200330A300E83062200E089220792044
:1000700022088E0000308220031D422807307D2098
:1000800003192E282C280030572001305720023029
:1000900057200330572004305720053057200630B2
:1000A000572007305720952807306F2054280C2000
:1000B000FF3A80055F280C2080045E28FF3A8417F1
:1000C00080059528A20077206400230822040319E4
:1000D0000800F730FF3E031D6A2879206428831644
:1000E0000739F83881006300FF3081009528A309A3
:1000F000A209A20A0319A30A0800A501A4008720E7
:1001000001399528A501A4008720043995282508E0
:100110002302031D8F282408220203190234031C22
:1001200004340134A301A20095288312640008005E
:084000007F007F007F007F00BC
:04400E00ED3F010081
:00000001FF
Back to The Table of Contents.

Nigel.zip new feature:

The Nigel program now has a very nice -t hardware debug and test mode, which allows you to toggle all printer port lines from the keyboard. This program is ideal for burning 84's with the output od the PicBasic Compiler.

Download NIGEL.ZIP Very fast Pascal. 84 Disassembler built-in.

Back to The Table of Contents.

Ken.zip 'WLEDPBC.INI' file:

Download KEN.ZIP Very fast Machine language. Supports many devices using my board.
16CXX PRINTER PORT PIC PROGRAMMER By Ken Segler of CyberTech Computer Works
4308 YORKWOOD DR. NORTH LAS VEGAS, NV 89030

;======================================================================
; WLEDPBC.INI  Walking LED PicBasic Compiler for PIC16C84.
;
; Last UpDate  Tue  08/15/95 / 11:13 am
;======================================================================
INFO='WLEDPBC.INI FILE LOADED by CYBERTECH computer WORKS'
PRGEXIT=FALSE           ;
DEVICE=16C84            ;16C84
PORT=378                ;PLACE PRINTER PORT HERE.....
MSDELAY=14              ;
OVERPROG=3              ;
ID1=7F                  ;
ID2=7F                  ;
ID3=7F                  ;
ID4=7F                  ;
OSC=XT                  ;XT 4Mhz crystal or resonator.
WATCHDOG=ON             ;ON
POWERUPTIMER=ON         ;ON
CODEPROTECT=ON          ;ON or OFF Your choice. I believe non-code protect
DATAIN=40               ;                       may extend the life of the
DATAINV=0               ;                       84. See 'To Spade a PIC'.
VPPOFF=8                ;
VPPON=0                 ;
VDDOFF=4                ;
VDDON=0                 ;
CLKLO=0                 ;
CLKHI=2                 ;
OUTLO=0                 ;
OUTHI=1                 ;

Home | Products | Prices | Directory | Order | Contact | New | Books | Files | Links | Other
Top_of_Page

DonTronics_ US Home Page.      DonTronics Australian Home Page.
mailto: don@dontronics.com Copyright © 1997 DonTronics