User Guide

36
Virtual Breadboard User Guide Because microcontrollers don’t work alone…

Transcript of User Guide

Page 1: User Guide

Virtual Breadboard

User GuideBecause microcontrollers don’t work alone…

Page 2: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Message from James,

It is with enormous satisfaction and great personal sacrifice that Virtual Breadboard is finallyreleased. This is a product that has come from the soul of my passion uniting both myinterests of microcontroller technologies and profession of software engineering.

Virtual Breadboard see's the world through the eyes of the microcontroller, simulating theworld at the functional level one step away from the nity grity of electronic circuitry. This is agood thing, Virtual Breadboard is about programming microcontrollers and if themicrocontroller cannot tell the difference about its Virtual world then nor will your micro code.The benefits are that Virtual Breadboard can be used to rapidly prototype complexmicrocontroller applications without having to build or even design the hardware first. This canchange your design cycle, allowing you to investigate different micro-solutions more rapidlyand most importantly pay greater consideration to software re-use up front in your designs.

What do I mean by software re-use? Foremostly Virtual Breadboard is a communicationpackage. For example when microchip publish an application note they often publish aschematic diagram of some test hardware. To investigate the use of the code for your ownapplication you often have to build the hardware first, program your micros and then run thecode on the hardware. I have not yet seen an application note supplied with stimulus files thatcan be run with the MPSIM to demonstrate the micro-code in action. The result is thatapplication notes are often limited in their utility. As a communications package, publishing anapplication note with a Virtual Breadboard .VBB file means you can open the application inVirtual Breadboard, run it and interact with its input devices on the simulated hardware.Furthermore you can step through the code, set breakpoints, watch registers and eveninvestigate the impact of small changes you make to code. Now that's communication.

So what's this got to do with software re-use? By providing accessible applicationcommunication it is my vision to host a growing library of application references, examplesand source code. I have already got the ball rolling by converting numerous Microchipapplication notes and providing some high level reference components such as theRS232!LCD driver. I will continue to provide reference applications and source code but myhope is that you too will get involved with the spirit of building this reference library bysubmitting your own examples and source. The goal is to facilitate a world class resourcewhich you can access when building your applications. This might mean that you use twochips that run code that already exists even though if you spent a month you could probablyput all the code on one chip. In some cases the extra month will be necessary but even moreoften you can use the existing code especially for your first prototypes. Now that'sproductivity.

With your support Virtual Breadboard is going to grow. I have designed the product to be easyto upgrade, just add components. You have to license them of course but I have suppliedmany components and will supply many more components which are available with the basic"Virtual Breadboard" License. I started this project because I needed to programmaticallycontrol how the outside world interacts with my microcontroller code not just though simplelinear stimulus files. I am certain that many of you will feel this same need. The ComponentDeveloper Kit (CDK) includes everything you need to create your own components includingdocumentation and examples. There are already many exciting components on my drawingboards, a basic compiler, VHDL, new microcontrollers, logic libraries, SPICE, BasicStamp… Itgets even more exciting when I consider the prospects of getting others involved. Thelicensing system supports payment for 3rd party component licenses so if you have amicrocontroller related product that you would like to see integrated into the VirtualBreadboard environment - let's talk. If you would like to be involved in a development effort tocreating new components - let's talk. If you have a good idea for a component - let's talk. Ifnot let's talk anyway.

Finally, Virtual Breadboard is fun. Programming is fun. So please, enjoy.

James [email protected]

Page 3: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Introducing Virtual Breadboard

Modern Microcontrollers are fast, versatile, and extremely useful for a wide variety ofinteresting applications. However, the real-time nature of microcontroller applications cancause nightmares at debug time. Often requiring a myriad of expensive debug tools such asin-circuit emulators, oscilloscopes, logic triggers and probes. Furthermore, evaluating adesign requires the expensive and time consuming task of building the hardware andpurchasing the physical components before you even begin the software development cycle.

Introducing Virtual Breadboard, the microcontroller development tool for everyone. True to itsword Virtual Breadboard adopts the familiar look and feel of a real breadboard. With easy touse tools you plug components into your virtual breadboard and wire them together to buildtest circuits and applications for your microcontrollers. At runtime Virtual Breadboard takesyou inside your breadboard circuit as a visual interactive simulation. However unlike a realbreadboard you can stop, step, analyse and modify your key components in simulated realtime dramatically simplifying the debugging process.

Virtual Breadboard comes with a large and growing library of Reference applications, sourcecode and simulated components that you can draw from to get your microcontrollerapplications up to speed faster than ever before.

If you develop microcontroller applications or wouldlike to then Virtual Breadboard is for you.

Virtual Breadboard gives you, the microcontroller software developer, enormous flexibility inthe development cycle of your microcontroller code. Presently development systems such asMPLAB, simulate a single stand-alone microcontroller and provide only limited capability fordriving the pins of the microcontroller under development by using difficult to prepare stimulusfiles and the like. While suitable for small stand-alone subroutines and uni-directional IO, whathappens when the inputs are dependent on the outputs as is the case with so many real timecontrol applications? The result is a tricky use of real-time hardware debugging tools such asIn-circuit emulators and expensive monitoring equipment so as to watch in real-time whatyour software is doing. Followed by the offline debugging, compilation and often removal andinsertion of a newly programmed microcontroller into the destination hardware beforerepeating the cycle.

Virtual Breadboard gives you many more options for your development cycle allowing you toeasily and quickly build complex automated stimulus generators to exercise yourmicrocontroller code.

Virtual Breadboard is Visual. Visual simulation makes it easy to see when and where errorsare occurring according to the visual clues provided by active circuit elements such as LED’sand LCD’s.

Virtual Breadboard is Interactive. You can interact with your Breadboard very much like thereal thing. Interaction allows for non-linear stimulus to be applied and what if testing to beeasily explored.

Virtual Breadboard is Extensible. Designed to grow Virtual Breadboard provides facilities toadd new packages of components to extend again and again the applications you candevelop with Virtual Breadboard.

Virtual Breadboard is for you if your develop microcontroller applications or would like to.

Page 4: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Installation and Setup

System Requirements

The minimum recommended system is

Processor: Pentium II classRAM: 32 MB (64 recommended)Operating System: Windows 95/98 or Windows NT 4.0Display SVGA (800x600), (1024x768) or greater recommendedColor 256, High or True Color recommendedHardDisk 10MB Installation, 50Mb Spare Hard-Disk space recommended,

Support Software Requirements

Virtual Breadboard is a simulation and debugging environment designed to support yourdevelopment efforts using your favourite software development platform.

The examples in this document assume that you have installed and are familiar with thefollowing software.

• MPLAB Micrchip PIC (IDE) freely available at www.microchip.com

• Adobe Acrobot 4.0 reader freely available at www.adobe.com

To Install Virtual Breadboard

Virtual Breadboard is a standalone Windows application to be installed on the Workstation itis to be used. The file you download from www.virtualbreadboard.com is a self extractinginstallation shield. Simply download, execute and following the installation instructions whenpresented.

If you have trouble installing Virtual Breadboard (This is true for any Installation )

1. Restart Windows, and do not start any other application2. Verify that no applications are running in the background, such as Microsoft Office

Taskbar or any start-up loaded applications. (Use CTRL-ALT-DEL and check Tasks)3. Install Virtual Breadboard and accept all of the defaults

Page 5: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Definitions

Term DescriptionBreadboard A breadboard is the fundamental document of Virtual Breadboard. A

breadboard consists of a collection of components, component links andbreadboard properties.

Component A component is a simulated logic component such as the PIC16c54microcontroller or a 4094 CMOS 4000 shift register. Components are thefundamental element of a Virtual Breadboard circuit. Components aredeveloped using the Component Development kit and must adhere to theComponent Interface contract.

ComponentSpecification

Each component has its own specification associated with it. Thecomponent specification includes at least a description of thecomponents operation, pinout and properties. The specification may alsoinclude equivalent circuit diagrams and examples of usage.

Design Mode Design mode is where breadboards are built and edited including thecreation, editing and saving of breadboards. Editing breadboardsincludes the placement of components, the linking of components andthe setting of component properties.

License A license is a software key that enables Virtual Breadboard to use acomponent. The basic license is the “Virtual Breadboard” license whichenables Virtual Breadboard to add and use the many additionalpackages that also use the “Virtual Breadboard” license. A package canalso require its own special license, which then also needs to be licensedby Virtual Breadboard to enable its use.

Link A link connects two pins together. Components communicate to eachother through their pins and over links.

MDI Multiple Document Interface is a standard Windows applicationframework which allows an application to contain multiple childdocuments.

MDI Child Form A MDI Child form is a child of the MDI application. The MDI applicationcontains the MDI Child form and accesses it using the standard MDIframework tools.

Package A collection of Components. Components in a package are usually fromthe same family eg The CMOS4000 series or PIC microcontrollers

PackageSpecification

Each package has its own specification associated with it. A packagespecification describes the components it contains and any commonfunctionality and properties. In addition a package specification may offerselection guides for its components to assist in selection

PinOut Each component has a collection of interface pins known as its pinout.Components interact with each other through their pinout.

Properties Every component has a set of properties which can effect its behaviour.Every component has at least a Type and Orientation property.Properties are edited using the properties editor.

Runtime Mode Runtime mode is where the component interactions on the breadboardare simulated using run, step and step over functions.

Topmost Form A topmost form is a form is a form that sits on top of all other forms inWindows even if it is not the active form. Runtime tools in VirtualBreadboard often use Topmost forms. Virtual Breadboard needs to bereset to design mode to hide these topmost forms.

Page 6: User Guide

©1999 James Caska.

Licencing and Deployment Model

Virtual Breadboard is a Windows application distributed as a self installing applicationdownloadable from the WEB. Virtual Breadboard can be further expanded by downloadingadditional component packages also distributed over the WEB.

A Virtual Breadboard circuit is of a set of connected components. Virtual Breadboard is theuser interface which hosts the editing of circuits and provides the basic runtime controls.Components are the simulated logic elements which are hosted by Virtual Breadboard andPackages are collections of components.

Virtual Breadboard is free and includes numerous free components that can be used toevaluate Virtual Breadboard. This evaluation/education version has no limitations, time limitsor restrictions and is identical to the licensed version with the exception that the licensedversion can add additional component packages for use in circuits. It is component packagesthat add functionality to Virtual Breadboard.

Virtual Breadboard supports multiple licenses. The basic license is the “Virtual Breadboard”license, which enables Virtual Breadboard to add new component packages and is thelicense for many additional component packages that are available to licensed VirtualBreadboard users.

A license can be used by more than one package. Virtual Breadboard supports additionallicenses to support the development of future high value components by 3rd Party developers.These components can then be optionally licensed by Virtual Breadboard users so that youonly need to pay for those packages you actually need.

License : “Virtual Breadboard”

Component Package

Component Package

Component Package

Virtual Breadboard

www

License : “License A” License : “License B”

Component

Component

.virtualbreadboard.com

Component

v1.0 November 1999

Page 7: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

How to license Virtual Breadboard

When you first install Virtual Breadboard it is unlicensed. This does not stop you from usingVirtual Breadboard in fact you are free to use Virtual Breadboard without restriction. There areno time limits or limitations except you cannot add new packages. Still there is a very usefulcollection of Virtual Breadboard native components you can use for free. The free installationversion is as much an educational version as an evaluation version and I consider this my“contribution” to the net. Nevertheless, the really cool stuff is not available until you licenseVirtual Breadboard.

Virtual Breadboard has a built-in License manager which you start using the Tools!!!!LicenseManager menu.

The License manager maintains a list of registered components and maintains licenses foreach of them. Each registered component has a required license name and each licensename has a serial number. When a license has been unlocked the serial number is replacedby a picture of a key to indicate you have purchased that license.

Initially the only available package is the VIRTUAL BREADBOARD package which requiresthe “Virtual Breadboard” License.

To unlock the “Virtual Breadboard” license you need an unlock key. To get an unlock key youwill need to quote the “Virtual Breadboard” License serial number.

Please refer to www.virtualbreadboard.com for more information on purchasing an unlockkey. However this is the serial number you need to quote to get the unlock key. Here

Once you have obtained your unlock key the license can be unlocked by clicking theUnlock License button and completing the Unlock dialog with your unlock key.

Page 8: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Once licensed the License manager displays a key instead of a license number to show thatthe package has been licensed. The other thing that happens is that the ADD button isreleased which allows you to add new packages.

Page 9: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Adding new Packages to Virtual Breadboard

Once you have licensed Virtual Breadboard you can add new packages. A package can haveits own unique license or can use a license that already exists. For example there are alreadynumerous packages that use the “Virtual Breadboard” license so these packages can beadded and used in Virtual Breadboard without having to license each package individually.This is like a group license. In this example the PICMICROS and CMOS4000 packages usethe Virtual Breadboard license and are ready to be used in Virtual Breadboard.

Alternatively a package may require a unique license. In this example the 3RDPARTYpackage requires its own special license. This licensing system has been designed to provideeasy revenue access to encourage 3rd party developers to build new and exciting packageextensions to Virtual Breadboard.

3rd Party developers are referred to Component Development Kit (CDK) for more informationabout developing Virtual Breadboard components and packages.

Page 10: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Virtual Breadboard

Toolbar –File, Edit and runtime tools

Links Selector –Link/component selector plus component orientation tools

Components Pallete – Native component pallete

Component Properties – Component properties editor for component customisation

Package Navigator – Component package navigation hierarchy for component location

Component Preview – Preview of currently selected component and properties

ToolbarLinks/Selector Components Pallete

Package NavigatorComponent PropertiesComponent Preview

Page 11: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Toolbar

Icon Function Short-Cut DescriptionFile New Ctrl+N The file new button creates a new Breadboard. The

new breadboard is added as a MDI form. VirtualBreadboard supports multiple open Breadboards

File Open Ctrl+O The file open buttons starts a common control dialog tolocate a previously saved breadboard to be opened.Virtual Breadboard files are saved with the *.VBBpostfix

File Save Ctrl+S The file save buttons saves the currently activebreadboard to file. If it is a new file a common controldialog will open to select a new name for thebreadboard to be saved as.

Cut Ctrl+X Copies the currently selected components and mutuallinks to the clipboard and deletes them from the currentbreadboard

Copy Ctrl+C Copies the selected components and mutual links tothe clipboard.

Paste Ctrl+V Pastes the contents of clipboard into the currentbreadboard. The pasted components are attached tocursor and placed into position on the next mouseclick.

Undo Ctrl+Z Undoes the previous action. Virtual Breadboardsupports multiple undo.

Run F9 Switches to runtime mode, and runs an interactivesimulation for the current breadboard.

Halt F5 Halts the current simulation but remains in runtimemode.

Step F7 Issues the step command to the breadboard. Switchesto runtime mode if in design mode before issuing thestep instruction.

Step Over F8 Steps over the next instruction. A component is free todetermine what stepover means for it. Formicrocontrollers stepover means to execute a functioncall and step to the following instruction. Switches toruntime mode if in design mode before issuing thestep-over instruction.

Reset F6 Issues reset instruction to all breadboard components.Microcontrollers reset their PC and check for changesin their reference file, reloading if necessary. Switchesto runtime mode if in design mode before issuing thestep-over instruction.

End Halts the simulation and returns to design mode. Hidesany runtime forms.Sets the simulated step frequency for the currentBreadboard. This effects the timestep parameter to allcomponents and the elapsed time calculations.Sets the animation speed which determines how oftenthe screen is refreshed which can impact simulationperformance.

Page 12: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Links/Selector

Icon Function DescriptionSelector Sets the mode to component selection mode.

Rotate Left Rotates the selected component right clockwise 90°. Isavailable when only one component is selected.

Rotate Right Rotates the selected component left anti-clockwise 90°..Is available when only one component is selected.

Blue Link Sets the mode to Link mode and sets the colour of thelinks to blue.

Green Link Sets the mode to Link mode and sets the colour of thelinks to green.

Red Link Sets the mode to Link mode and sets the colour of thelinks to red.

Yellow Link Sets the mode to Link mode and sets the colour of thelinks to yellow.

Black Link Sets the mode to Link mode and sets the colour of thelinks to yellow.

Selection Mode

Components

Selecting an individual component

• Click on the component image• Drag a bounding box around the component

Selecting more than one component

• Drag a bounding box around more than one component• Append a component to the group selection by clicking on an unselected component

while holding down the SHIFT key• Append a group of components to the group selection by dragging a bounding box

around more than one unselected component while holding down the SHIFT key

Unselecting components

• Unselect all components by clicking on the Breadboard where no components arepresent

• Remove a selected component from a group of selected components by clicking thecomponent while holding down the SHIFT key

• Remove a sub-group of selected components from a group of selected components bydragging a bounding box around the components to unselect while holding down theSHIFT key

• Press ESC to unselect all components and return to select mode.

Page 13: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Functions for selected components

Function DescriptionMove Selected components can be moved using drag-and-drop on the

Breadboard. To drag-and-drop a selected component or group of selectedcomponents click and hold while the cursor is over at least one of theselected components. A preview bounding box will be attached to yourpointer which can be used to determine where to drop the components.Releasing the button will place the components

Cut Selected components will be placed on copy buffer and deleted fromBreadboard

Copy Selected components will be placed on copy bufferPaste A bounding box preview of the components in the copy buffer will be

attached to the mouse pointer. Use this preview to determine the locationto place the pasted components. The next mouse click will place thecomponents at the current cursor position

Delete All selected components and their common links are deletedRotate Left Rotates the selected component right clockwise 90°. Is available when

only one component is selected.Rotate Left Rotates the selected component left anti-clockwise 90°.. Is available when

only one component is selected.

Links

Selecting an individual link

• Click directly on the link

Functions for selected links

Delete Deletes the currently selected link

Link Mode

Links

Creating a Link

• Click-and-hold the mouse pointer on a component pin to start creating a link. Moving themouse pointer will trace out a preview of the links. Release the mouse pointer over asecond links to create a link between the two pins.

Exiting Links Mode

• Press ESC to unselect all components and return to select mode.• Click the Selector Icon

Page 14: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Virtual Breadboard Wiring Rules

There are three simple rules for the wiring of a Virtual Breadboard circuit and for successfulevaluation

1. Thou shall link only 1 link into an input pin. ( Outputs can source more than one link)2. Thou shall link all inputs to all components3. Thou shall use feedback components for all feedback loops

Virtual Breadboard Components

Virtual Breadboard Package Specification

Page 15: User Guide

©1999 James Caska.

Tutorial 1: Binary Counter

The best way to learn how to use a program is by example. This example takes you throughthe process of creating a binary counter. In this example you will learn:

♦ To create a New Breadboard♦ To review a component specification♦ To add a component to a breadboard♦ To review a package specification♦ To open a package♦ To locate a Filename using the property editor♦ To selecting an individual component on a Breadboard♦ To rotate a component♦ To create a link♦ To move a component♦ To run a Virtual Breadboard simulation♦ To halt a running Virtual Breadboard simulation♦ To single step through a Virtual Breadboard simulation♦ To set a breakpoint in the PIC sourcecode.♦ To end runtime mode and return to design mode.♦ To save a Breadboard.

Application Description

A Binary counter is implemented using the PIC16c54 microcontroller available in theEvaluation Package. A CLOCK pulse generated by a 555 TIMER provides the input to becounted. This signal is the input to the RTCC (real time clock) pin of the PIC16c54. The PICcounts the pulses and uses PORT B to show the binary value of the count on a LED display.

t

555 Timer PIC Debug Toolbar

eBinary Count Output

PIC Micro Componen

www.virtualbreadboard.com

PIC Counter Sourc

v1.0 November 1999

Page 16: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To create a New Breadboard

1. On the Windows task bar, click the Start button, point to Programs, and then clickVirtual Breadboard

Virtual Breadboard opens and starts as a Multiple Document Interface (MDI) parentapplication.

2. In the File menu select File!!!! New or select the New Toolbar button.

A new breadboard will start as a MDI child to Virtual Breadboard.

Your screen should now look like this:

The next thing to do is to add the components to the breadboard. There are threecomponents to add for this example

• 555 Timer• LED Display• PIC16c54

Often before adding a component or if you have not used a component before, you will wantto familiarise yourself with its functionality, properties and use. Each component has aspecification associated with it that fully described its functionality and use.

New button

Page 17: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To review a component specification

1. On the Components pallete click on the Timer Component button.

The Clock component is actually a 555-monostable timer. A preview of thecomponent appears in the component preview panel at the bottom left ofthe Virtual Breadboard main screen. Immediately above the preview panelis the properties panel, which now shows the available properties for the555 Timer component. The specification for the component and itsproperties is available by clicking the PDF button at the top right edge ofthe preview panel.

2. Click the Component Specification Button

The specification document for the component will load as a PDF andappear as a MDI child in the document panel. The specification is thecomplete description of the component functionality. Includingdescription of use, properties and default settings, pin-out, equivalent electrical circuit,manufacturers data sheets and examples of use.

Click here to review the TIMER Component specification from this example.

We would normally use the component properties editor is used to change componentproperty values. However, the TIMER default settings of ASTABLE Timer, Duty = 0.5 andPERIOD 10 cycles are satisfactory so we are ready to add the component to the breadboard.

Component Specification

Component Specification button

TimerComponent

button

ComponentSpecification button

Timer Component button

Package Specification button

Component Properties

Page 18: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To add a component to a breadboard

1. Select the breadboard you want to add the component to.

Presently, the TIMER component specification is showing. Select the breadboard createdearlier using the Window !!!! Breadboard0 menu option as shown.

Virtual Breadboard is a MDI application. MDI means Multiple Document Interface. That ismore than one document can be open at any one time. The two document types in VirtualBreadboard are component specifications and breadboards. Multiple breadboards andmultiple specifications can be open at any one time in Virtual Breadboard. Virtual Breadboardsupports the standard Window MDI menu options including Cascade, Tile Horizontally, TileVertically, arrange icons and the listing of currently open documents. You can manipulateyour view by using these menu options.

2. Drag and Drop the component onto the breadboard

Now that you have your breadboard selected adding a new component is easy as draggingand dropping the component on the breadboard. In the bottom left corner of VirtualBreadboard is the component preview.

Move your mouse pointer over the component preview.of the 555 Timer and Click and holdyour left-mouse-button. A bounding box will appear around your mouse pointer to indicate youhave picked up the component.

Move the mouse to the approximate location you want to place the component on yourbreadboard. The bounding box will follow your mouse pointer as you move it to indicatewhere the component will fit on the breadboard. Don’t worry if you don’t place it exactly youcan always move it again later on.

Component Preview

Page 19: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Release the mouse button to drop the component into place. It just like plugging a realcomponent onto a real breadboard. Think of the component selector as your component binand your breadboard as well.. your breadboard. You get the idea.

Repeat the previous two steps to add the LED8 component. (Bottom righthand corner of the component palette.) Leave a little room for the PIC16c54micro to be added in the middle. You might notice the component is upside-down. Later, I will show you how to turn it around.

Your screen should now look something like this.

The final component to add is the PIC16c54 itself. Unlike the TIMER and LED8 component,the PIC16c54 is not a “Built-In” component. It is a member of the EVALUATION package.

A Package is a Virtual Breadboard “plugin” and contains one or more components. Packagesenable Virtual Breadboard to expand and grow. If you know a little about programming youcan even add build your own and packages to add using the Component Development Kit.

There are numerous packages available when you licence Virtual Breadboard. However, theevaluation version of Virtual Breadboard can only use the EVALUATION package.

The EVALUATION package contains a selection of sample components from other packagesincluding the PIC16c54. All packages have a package specification which provides importantinformation about the components in the package including component selection and anyshared run-time features of the components.

LED8 Componentbutton

Package Tree

Page 20: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To review a package specification

The package specification can be accessed directly from the package tree by right clickingthe name of the package. This pops up a package specification menu which can beselected to access the package specification. When selected the specification appears in itsown form in the same way as a component specification.

To open the evaluation package specification right click on EVALUATION in the package treeand select the package specification menu.

Your screen should now have the EVALUATION package specification

An alternative way to review the package specification is toselect the Package Specification Button. This opens thepackage specification for the currently selected component. IeThe component that is showing in the Component Previewpanel.

It can be seen from the specification that the EVALUATION package indeed includes thePIC16c54. When you have finished reviewing EVALUATION package specification reselectthe Breadboard Hint: Menu Window ! Breadboard0 )

Click here to review the EVALUATION Package Specification from this example now.

ComponentSpecification button

Package Specification Button

Page 21: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To open a package

To open a package you double-click on the package name in the package Tree. This willopen the package to reveal the components as children.

To add the PIC16C54 double-click on the EVALUATION and select PIC16C54 from thecomponents in the list.

Your screen should now look like this.

The PIC16C54 has now been selected as the current component. You will notice theProperties editor has been populated with properties for the PIC16C54. There are fourproperties. Type, Orientation, Filename and WatchDog.

Type and Orientation are properties common to all components and are read only in theproperty editor. Type is the name of the component in the component package and obviouslyhas the value of PIC16C54. Orientation determines which of four directions that component isfacing and can only be changed by the component rotation tools, to be discussed later.

Filename and Watchdog are special PIC16C54 properties and are editable in the propertieseditor.

As per the PICMICROS component specification. Filename locates the source code to beexecuted by the PIC. Two file formats are available, LST and HEX. LST is the MPLAB LSTfile generated when compiling source in MPLAB or any other development environment thatsupports MPLAB LST files. HEX is an Intel format HEX file containing the PIC executioncode. Note that Debug facilities are only available for LST files.

Component selected from Package

Component Properties

Page 22: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To locate a Filename using the property editor

The LST source for this example is already compiled and is available asTutorials\Lesson1\Lesson1.LST.

To select it as the source code for the PIC16C54 click on the Filename property in theproperty editor. The Filename property will become active and show the FileOpen button.

Click the FileOpen button to launch the FileOpen Dialog. Use the FileOpen dialog to locatethe Lesson1.lst file and select open.

The filename should now appear in the properties editor although the name is too long to seethe whole name.

FileOpen Button

Filename property is Active (Highlighted)

Completed Filename property

Page 23: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

You are now ready to now drag and drop the PIC16C54 in place on the breadboard

After placing the PIC somewhere between the TIMER and LED8, your screen should looksomething like this.

So now we are well down the track for building this application. All that remains is to link thecomponents together and run the application. However what we really want to do is to tidy upthe locations of the components so make the circuit nice and neat. A neat circuit is alwayseasier to understand.

Virtual Breadboard has a permanent grid and all components are designed to align to this gridwhich makes it easy to align components and build neat-circuits.

In this application PORTB of the PIC is going to be linked to the PINS of the LED8 display. Atthis point however the pins are facing the same way and a link between them is required totravel an unnecessary distance.

What we really want is to turn the LED8 component around and buff it up against the PICPortB so the links are short and unnoticeable.

To turn the LED8 component around we need to first select it and then click one of thecomponent rotation tools twice.

LED8 PINS PIC PORTB PINS

Page 24: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To selecting an individual component on a Breadboard

Selecting a component on a breadboard is a fundamental operation when using VirtualBreadboard and there are a number of ways of doing it.

The easiest way to select an individual component is to simply click it on the breadboard.Move your mouse over the image of the LED8 on the breadboard and click once to select thecomponent.

A number of things happen when you select a component. The first is that the component issurrounded by a selection bounding box. This indicates which component is currentlyselected. The second thing that happens is the selected component becomes selected intothe component preview and its properties become available for in-place editing in theproperties editor. Another thing is that component specific editing tools become availablesuch as cut, copy, delete and the rotation tool. Which allow components to be cut -deletedfrom breadboard and placed in the copy buffer for later pasting, copied – copied into the copybuffer for later pasting, deleted – simply removed from the breadboard and rotation – whichallows the orientation of the components to be modified.

The other way to select a component is to use a bounding box. Bounding Box selection isprimarily used for selecting multiple components is however a useful technique for componentselection if links are getting in the way of a clean component pick.

A Bounding Box selection is started by clicking and holding the mouse down on thebreadoard. This anchors the start of the bounding box to the location of the mouse click.Moving the mouse creates a box which when release will select any component fullycontained within the bounding box.

Selected Component

Component Rotation Tools

Cut/Copy tools

Page 25: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To rotate a component

Once a component is selected to rotate it simply clickthe rotation tools to rotate it 90° left or right.

Notice however that rotation is only supported forindividual components. Selecting a group of componentsdisables the rotation tools.

Click either component Rotation tool to rotate LED8 180° so that its pins are facing the PICPORTB pins. Note that the orientation property of the LED8 has changed from the defaultvalue of Down to Up.

Your screen should now look like this.

Now that the component is facing the right way we want to move the LED8 component suchthat its pins are directly adjacent the PIC pins. However before doing this for the purpose ofdemonstration it is better to link the components together.

Component RotationTools

LED8 has been rotated 180°°°°

LED8 Orientation is Up

Link Tools

Page 26: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To create a link

To create a link first select one of the link buttons byclicking on one of the link tool in the links toolbar. There arefive available link colors to help you organise yourbreadboard. This puts the current breadboard into linksmode and changes the cursor pointer to a cross-hair whenyour cursor is over the breadboard. When you are in Linksmode the only operation available is the creation links. To exit Links mode you need to re-select the Free Cursor mode by clicking the Free cursor icon or by pressing ESC whichautomatically resets to Free cursor mode.

With the Link selected move your cursor to one of the pins you want to link and and click-and-hold your left mouse button down on the pin. There is a small area of snap-to-pin whichwill move the starting point exactly to the centre of the pin. Now with the left mouse button stillheld down move the mouse cursor (cross-hair) to the pin to link to, as you move the cursor alink is pulled from the starting pin to the current cursor position to provide a visualrepresentation of the link being formed.

When over the pin to link to release the button. If you got close enough to the second pin alink will be formed between the two pins.

Repeat this process for all the links between PIC PORTB and LED8 Pins and also betweenthe TIMER CK Pin and the PIC RC pin.

Blue Link selected

Links Toolbar

Link Under construction.

Free Cursor

Page 27: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

The circuit is now ready for a simulation run but before we do we want to tidy up the circuit byaligning the components next to each other.

Page 28: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To move a component

When in Free Select Mode, Virtual Breadboard supports drag-and-drop moving of theselected component or groups of components. Before moving components make sure theBreadboard is in Free Select ( Click the Free Select Icon if not aleady selected)

To drag and drop a component into position click-and-hold the cursor on the component tomove. A move selection box will be attached to the cursor and the cursor will change in to amove (NSEW) cursor. Moving the cursor will move the outline of the component whichprovides a preview of where the component will be moved to. Releasing the mouse buttondrops the component to the new location.

Moving group selected components is also supported by the drag-and-drop move.

Finally, the circuit is complete and we are ready to run the simulation. Virtual Breadboardoperates under two modes, design and runtime. So far we have been in design time mode.Design mode allows you to add new components, modify their properties, move them aroundthe breadboard and so on. Runtime allows you to observe the circuit under simulatedconditions.

Virtual Breadboard supports five basic runtime features, run, halt, step, step-over and reset.In addition to these features, components themselves may have runtime controls that will onlybe available when in runtime mode. The PIC16C54 for example has an entire debugging toolsuite available during runtime to assist in the debugging of its source code.

In this example however, the source has already been tested so all you need to do is pressthe run button to start the simulation.

Run Simulation

Page 29: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 Nove

♦♦♦♦ To run a Virtual Breadboard simulation

Running a simulation is as simple clicking the run Simulation buttonon the toolbar, selecting the Simulation!!!!Run menu option orpressing the F9 shortcut key. This will put Virtual Breadboard intoruntime mode, hiding the design time tools. Any runtime tools for thecomponents will become available and the circuit will begin executingthe simulation.

In this example the PIC16C54 starts its debug menu and begins executing the councode. This results in the timing pulses being generated by the 555 Timer being couPIC16C54 and the counted number appearing at PORTB and subsequently on thecomponent in binary form.

During runtime there is some interesting performance and simulation information avthe toolbar. The simulated Step frequency, which by default is 1Mhz, is the numbsimulated steps per second applied by virtual breadboard. Different components ardifferently by the steps frequency. The Timer component has the default period of 1which in the real world makes it a 100Khz oscillator. The PIC16C54 in the real worldivide by 4 clock which means 1Mhz step frequency is equivalent to running the PI4Mhz clock. The LED8 component is not effected by the step frequency.

The simulated steps is the total number of steps the simulation has performed sinsimulation session started. This is number is multiplied by the simulated step frequecalculate the elapsed simulated real-time. To give some idea of the performanceVirtual Breadboard simulation the number of steps per second is displayed.

Running a simulation is one of two ways to view a simulation. The other is to singlethrough the simulation which provides good debugging opportunities. Before singlethe simulation you need to halt the simulation.

RunB

Steps/Seco

Elapsed simulated real-timeSimulated StepsSimulated StepFrequency

Simulationutton

mber 1999

ter sourcented by the LED8

ailable iner ofe effected0 steps

d has aC with a

ce thisncy to

of the

step stepping

nd

Page 30: User Guide

♦♦♦♦ To halt a running Virtual Breadboard simulation

To halt a running single step a simulation you first need tohalt the simulation. Click the halt simulation button on thetoolbar, selecting the Simulation!!!!Halt menu option or pressthe F5 shortcut key to halt the simulation. Note that haltingthe simulation is different to ending the simulation which returns Virtual Breadboard to designmode and hides any runtime tools associated with the components.

With the simulation halted click the source button and the Special Function Registersbutton from the PIC16c54 debug toolbar to open the source code for the PIC. Thecomplete documentation to the debugging tools available to components of the PICMICROSpackage are available in the PICMICROS package specification and are only covered herebriefly as an example of component runtime tool usage.

Halt Simulation Button

Single Step Buttons PIC Source Code

PIC Debug ToolbarSourceCode Button

©1999 James Caska. www.virtu

By having the Sourcecode and the Specialcan see what is going on inside the PIC anstepping is an invaluable debug tool and thparts of the simulated circuit I am sure youdevelopment of your microcontroller applic

Current PICSourceLine

albreadboard.com

Function Registers opend how it correlates to the e ability to single step plu will find an extremely powations.

PIC SpecialFunction Registers

v1.0 November 1999

as you single step yourest of the circuit. Singles change values in othererful tools in the

Page 31: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To single step through a Virtual Breadboard simulation

To single step through the simulation click the Single StepSimulation button on the toolbar, select the Simulation!!!!Stepmenu option or pressing the F7 shortcut key. This will step thesimulation forward by one step.

With the SourceCode and the Special Function Registers windows open what you will see isthe sourceline increment to indicate that during the last step that line of source was executed.Any changes to Special Function Registers will be shown in the Special Function Registerswindow in RED to highlight the change. However sometimes when you click the step buttonnothing seems to happen but when you step a second time the soucecode steps again. Thisis because some PIC instructions require two steps to complete the instruction and thesimulation executes in one step increments.

Repeatedly pressing the single step button will show the sourcecode for this example goingaround a very simple loop that grabs the value from the TIMER0 register and then pushes itonto the PORTB output. Every ten steps, which is the period of the TIMER, the RTCC willreceive the rising clock edge it requires to trigger the increment of TIMER0 which occursindependently of the main loop. All of this happens before your very eyes in single step modewhich allows you view and compare expected values. Single stepping is a seriously usefultool, the other seriously useful tool you will use often in conjunction with single stepping arebreakpoints.

A breakpoint is a line of soucecode that when a running simulation comes to will automaticallyhalt the simulation and allow you to single step from that point onwards. This allows you to setbreakpoints in remote sections of the code and run the simulation up to that point beforesingle stepping. Virtual Breadboard allows any component to support breakpoints. The PICDebugger supports breakpoints using the sourcecode window.

Single Step SimulationButton

Page 32: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To set a breakpoint in the PIC sourcecode.

Setting a breakpoint involves selecting the line of sourcecode to set a breakpoint on. In thiscase it is easy because the sourcecode is only small. For larger source code you will need touse the scrollbars and Find tools. The PICMICROS package specification more completelycovers these additional tools. Once you have selected the line to set a breakpoint click eitherthe Breakpoint toolbar button, Select the Source!!!! Break menu option, Right click to popupthe Break menu option at the cursor location or press the F9 short cut key.

Once the breakpoint is set the line of sourcecode becomes RED. If there is already abreakpoint set on a sourceline the breakpoint will toggle off. If the sourcecode is reset, that isif there is a change to the sourcecode and it is reloaded all breakpoints are reset.

Now that you have set a breakpoint when you run the simulation it will automatically halt atthis line of code. In this example when you press run it probably will appear as if nothing hashappened because there is only a few steps until the breakpoint is reached again.Nevertheless the simulation is running, repeatedly pressing run will step through thesimulation 4 steps at a time instead of just one at a time.

Well that wraps up the first tutorial. All that remains is to exit back to design mode and savethe breadboard.

Breakpoint Button

Popup Breakpoint menuSourceline withBreakpoint Set (RED)

Page 33: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

♦♦♦♦ To end runtime mode and return to design mode.

To end runtime mode click the End Simulation button on the toolbaror select the Simulation!!!! End menu option. This action will stopany running simulation, close any runtime forms, and return to designmode showing the design mode component selection and editingtools. It is important to know that ending the simulation does not resetthe state of the simulation so that you can End the simulation and then run it again fromdesign mode and the simulation will pick up from where it left off.

When using Virtual Breadboad in conjunction with other development tools such as MPLAByou might find that the runtime forms remain on the top of your application even thoughVirtual Breadboard is only a background application.

If this is undesireable, which is not always the case end runtime mode in Virtual Breadboardto close these topmost forms before switching to the other applications.

Now that Virtual Breadboard has returned to design mode you can save it.

♦♦♦♦ To save a Breadboard.

To save a Breadboard click the Save button on the toolbar or selectthe File!!!! Save menu. This will start the filesave dialog which you useto create or locate a filename to save this breadboard as.

That’s all for Tutorial 1.

End Simulation Button

Save Button

Save Button FileSave Dialog

Page 34: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Goals and limitations

Virtual Breadboard simulation vs The real world

The Virtual Breadboard simulation aims to provide microcontrollers with the same signals theywill see in when they are in their real-world application. Thus the Virtual Breadboard world isseen through the eyes of the microcontroller. If the microcontroller source code cannot tell thedifference between the real-world and the Virtual Breadboard simulated world then VirtualBreadboard has done its job.

Virtual Breadboard is not a spice simulation and doesn’t pretend to predict electronic circuitbehaviours1 For this reason you have to be very careful about the assumptions you makeabout the behaviour of your circuits especially for very high frequency signals where errorsare most likely.

In most circumstances the Virtual Breadboard simulation is sufficient to model the applicationas it will appear at the pinouts of the microcontrollers you are developing code for. VirtualBreadboard depends on the component models to take care of transient and complex circuitbehaviours and to simply publish the Interface. There are numerous benefits to this approach.

Firstly, no particular electronic implementation is prescribed. This is equivalent to the modernsoftware technique of a contracted interface. This allows the microcontroller implementationto be prototyped independently and often before the electronic design. This is a reversal ofthe current design approach of building the hardware and then fitting the software later.Another advantage of this is the ability to rapidly prototype potential solutions and draw fromthe growing library of software and components in your designs.

Secondly, the performance of Virtual Breadboard is better for the simplified circuit which isalways important but especially so for debugging complex multiple processor systems.

Thirdly, the Virtual Breadboard circuits are inherently simpler to construction where eachcomponent would often require many electrical components to do the job.

However, it remains that Virtual Breadboard circuits are models of the real world and requirespecial consideration when translating a Virtual Breadboard design to a real world

Virtual Breadboard is not an Electrical Circuit Design Tool

Virtual Breadboard is about developing microcontroller software not about designingelectronic circuits2. There are already many excellent electronic circuit development toolssuch as Electronics Workbench, PSPICE, Protel and Circuit Maker.

The role that Virtual Breadboard will play in the development cycle is to prototype your designbefore you even get to your Electronics circuit package and reduce the number of hardwaredevelopment cycles by providing the best microcontroller software solution up-front.

In addition in many cases you will not have to build hardware at all to get the satisfaction ofbuild a microcontroller application. The Virtual Breadboard simulation will suffice – although Imust admit at the end of the day there is nothing quite like having the working thing in you hotlittle hands. Hardware seems more, well… real.

1 .A spice component which can simulate spice circuits internally yet provide a VirtualBreadboard pinout is planned.2 An automated tool for generating electronic circuits from Virtual Breadboard descriptions isplanned.

Page 35: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Trouble Shooting

Feedback Loops

The evaluation model makes no assumptions about a pin being an input or an output pin.Hence it cannot resolve feedback loops with the specific use of a feedback component whichhas a known input and a known output. A feedback loop is formed where a componentsoutput effects its own input. The evaluation model requires a component to resolve all of itsinputs before it can determine its output so where its input depends on its undeterminedoutput the simulation cannot find a solution. This is simply resolved by placing a feedbackcomponent in the feedback loop. One issue you need to be aware of is that a feedback loopinduces a single step delay in the signal. This can be problem for complex feedback circuitsespecially when it is exposed to high frequencies.

Cannot resolve multiple paths for inputs

While it is ok to have more than one link FROM a voltage source it is not OK to have morethan one link INTO a input. For example if a LED has two pins linking into it one link isattached to a switch with an open circuit and the other to a VDD power component the LEDmay well be OFF because it might think that it is open circuit. Depending on which link wasmade first. To resolve this situation you must use the JOIN component which is used to joinmultiple links into a single link. As always all voltages must be the same or open-circuit at aJOIN else there is a short circuit. Which is an error – but is not announced (See next section)

No Error Messages

In release 1.0 there are no error messages to tell you what is going wrong with the simulationcircuit. It just won’t work as expected. However being a visual environment it is usually prettyeasy to detect when and what is not working as expected. I am however working to introduceerror detection messages as soon as possible.

Non-Linked Junction

Careful of the situation where a junction lies on a link line and it is supposed to be linked butis not. It looks like it is linked but will cause a failure to link to the input of the component itforms an input to. The component cannot resolve its inputs and the circuit seems to fail. Sodouble check those links if your circuit is failing to execute.

Setting Properties for incorrect component

Be careful of the situation where you think you are editing the properties of a component onthe breadboard when you are only editing the scratch component. This can sometimes meanyou fail to set a filename or something.

Page 36: User Guide

©1999 James Caska. www.virtualbreadboard.com v1.0 November 1999

Known Bugs

Links to other documents fail in MDI-Child PDF help-filesWhen you use the PDF with the embedded view, the PDFs will not link to other files throughtheir links. If you find you want to link use the default external help viewer, ie Ensure theHelp!Show Help in External Viewer is check. This is going to be a “feature” because unlessabobe update and support their viewer control there is nothing I can do.

Key Short-cuts become disabled.Every now and then the short-cut keys become disabled for a breadboard. Eg. CTRL-X (Cut),CTRL-C (Copy), CTRL-V(Paste), Delete become disabled for a breadboard. While you canstill use the menus and toolbars this annoying bug is remedied by closing and re-opening thebreadboard.

Pasting can sometimes leave an extra copy of the componentCopying and pasting can sometimes leave an extra component under the first parentcomponent. This can mean you get a link confused because it is actually linked to the hiddencomponent. I am not sure of the sequence that produces this error but it may be a user error,ie extra cut and paste but because the components are hidden you can’t detect them. Notsure.

Screen RefreshThe Screen refresh can sometimes leave artefacts. Eg. In place editing of the Labelcomponent will leave scribbles until the screen is refresh. If necessary you can use thescrollbars to move the breadboard forcing a refresh for now.

Editing PerformanceFor many components and links on a single breadboard the refresh can get a little slow. Isuggest you take advantage of the PCBInterconnect facilities to break your design intosmaller chunks. Each breadboard can then be smaller and hence faster and easier to edit fornow.

Lost Edit StateWhen editing multiple breadboards at the same time the Select/Link button state can getconfused. For example, on breadboard1 you are linking so you click a link and the cursorbecomes a cross-hair. When you go to breadboard2 the cursor will become a selector arrowbut the toolbar is still in link mode. Furthermore if you then click selector to pick and movecomponents on breadboard2 when you return to breadboard1 the cursor returns to cross-hairs even though the toolbar is in selector mode. Dilligence only required.