User Guide

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View User Guide as PDF for free.

More details

  • Words: 9,348
  • Pages: 36
Virtual Breadboard

User Guide Because microcontrollers don’t work alone…

Message from James, It is with enormous satisfaction and great personal sacrifice that Virtual Breadboard is finally released. This is a product that has come from the soul of my passion uniting both my interests of microcontroller technologies and profession of software engineering. Virtual Breadboard see's the world through the eyes of the microcontroller, simulating the world at the functional level one step away from the nity grity of electronic circuitry. This is a good thing, Virtual Breadboard is about programming microcontrollers and if the microcontroller 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 complex microcontroller applications without having to build or even design the hardware first. This can change your design cycle, allowing you to investigate different micro-solutions more rapidly and 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 communication package. For example when microchip publish an application note they often publish a schematic diagram of some test hardware. To investigate the use of the code for your own application you often have to build the hardware first, program your micros and then run the code on the hardware. I have not yet seen an application note supplied with stimulus files that can be run with the MPSIM to demonstrate the micro-code in action. The result is that application notes are often limited in their utility. As a communications package, publishing an application note with a Virtual Breadboard .VBB file means you can open the application in Virtual 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 even investigate 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 application communication it is my vision to host a growing library of application references, examples and source code. I have already got the ball rolling by converting numerous Microchip application notes and providing some high level reference components such as the RS232!LCD driver. I will continue to provide reference applications and source code but my hope is that you too will get involved with the spirit of building this reference library by submitting your own examples and source. The goal is to facilitate a world class resource which you can access when building your applications. This might mean that you use two chips that run code that already exists even though if you spent a month you could probably put all the code on one chip. In some cases the extra month will be necessary but even more often you can use the existing code especially for your first prototypes. Now that's productivity. With your support Virtual Breadboard is going to grow. I have designed the product to be easy to upgrade, just add components. You have to license them of course but I have supplied many components and will supply many more components which are available with the basic "Virtual Breadboard" License. I started this project because I needed to programmatically control how the outside world interacts with my microcontroller code not just though simple linear stimulus files. I am certain that many of you will feel this same need. The Component Developer Kit (CDK) includes everything you need to create your own components including documentation and examples. There are already many exciting components on my drawing boards, a basic compiler, VHDL, new microcontrollers, logic libraries, SPICE, BasicStamp… It gets even more exciting when I consider the prospects of getting others involved. The rd licensing system supports payment for 3 party component licenses so if you have a microcontroller related product that you would like to see integrated into the Virtual Breadboard environment - let's talk. If you would like to be involved in a development effort to creating new components - let's talk. If you have a good idea for a component - let's talk. If not let's talk anyway. Finally, Virtual Breadboard is fun. Programming is fun. So please, enjoy. James Caska [email protected]

©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 of interesting applications. However, the real-time nature of microcontroller applications can cause nightmares at debug time. Often requiring a myriad of expensive debug tools such as in-circuit emulators, oscilloscopes, logic triggers and probes. Furthermore, evaluating a design requires the expensive and time consuming task of building the hardware and purchasing the physical components before you even begin the software development cycle. Introducing Virtual Breadboard, the microcontroller development tool for everyone. True to its word Virtual Breadboard adopts the familiar look and feel of a real breadboard. With easy to use tools you plug components into your virtual breadboard and wire them together to build test circuits and applications for your microcontrollers. At runtime Virtual Breadboard takes you inside your breadboard circuit as a visual interactive simulation. However unlike a real breadboard you can stop, step, analyse and modify your key components in simulated real time dramatically simplifying the debugging process. Virtual Breadboard comes with a large and growing library of Reference applications, source code and simulated components that you can draw from to get your microcontroller applications up to speed faster than ever before. If you develop microcontroller applications or would like to then Virtual Breadboard is for you.

Virtual Breadboard gives you, the microcontroller software developer, enormous flexibility in the development cycle of your microcontroller code. Presently development systems such as MPLAB, simulate a single stand-alone microcontroller and provide only limited capability for driving the pins of the microcontroller under development by using difficult to prepare stimulus files and the like. While suitable for small stand-alone subroutines and uni-directional IO, what happens when the inputs are dependent on the outputs as is the case with so many real time control applications? The result is a tricky use of real-time hardware debugging tools such as In-circuit emulators and expensive monitoring equipment so as to watch in real-time what your software is doing. Followed by the offline debugging, compilation and often removal and insertion of a newly programmed microcontroller into the destination hardware before repeating the cycle. Virtual Breadboard gives you many more options for your development cycle allowing you to easily and quickly build complex automated stimulus generators to exercise your microcontroller code. Virtual Breadboard is Visual. Visual simulation makes it easy to see when and where errors are occurring according to the visual clues provided by active circuit elements such as LED’s and LCD’s. Virtual Breadboard is Interactive. You can interact with your Breadboard very much like the real thing. Interaction allows for non-linear stimulus to be applied and what if testing to be easily explored. Virtual Breadboard is Extensible. Designed to grow Virtual Breadboard provides facilities to add new packages of components to extend again and again the applications you can develop with Virtual Breadboard. Virtual Breadboard is for you if your develop microcontroller applications or would like to.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Installation and Setup System Requirements The minimum recommended system is Processor: RAM: Operating System: Display Color HardDisk

Pentium II class 32 MB (64 recommended) Windows 95/98 or Windows NT 4.0 SVGA (800x600), (1024x768) or greater recommended 256, High or True Color recommended 10MB Installation, 50Mb Spare Hard-Disk space recommended,

Support Software Requirements Virtual Breadboard is a simulation and debugging environment designed to support your development efforts using your favourite software development platform. The examples in this document assume that you have installed and are familiar with the following 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 it is to be used. The file you download from www.virtualbreadboard.com is a self extracting installation shield. Simply download, execute and following the installation instructions when presented. If you have trouble installing Virtual Breadboard (This is true for any Installation ) 1. Restart Windows, and do not start any other application 2. 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

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Definitions Term Breadboard

Component

Component Specification

Design Mode

License

Link MDI

MDI Child Form

Package Package Specification

PinOut Properties

Runtime Mode Topmost Form

Description A breadboard is the fundamental document of Virtual Breadboard. A breadboard consists of a collection of components, component links and breadboard properties. A component is a simulated logic component such as the PIC16c54 microcontroller or a 4094 CMOS 4000 shift register. Components are the fundamental element of a Virtual Breadboard circuit. Components are developed using the Component Development kit and must adhere to the Component Interface contract. Each component has its own specification associated with it. The component specification includes at least a description of the components operation, pinout and properties. The specification may also include equivalent circuit diagrams and examples of usage. Design mode is where breadboards are built and edited including the creation, editing and saving of breadboards. Editing breadboards includes the placement of components, the linking of components and the setting of component properties. A license is a software key that enables Virtual Breadboard to use a component. The basic license is the “Virtual Breadboard” license which enables Virtual Breadboard to add and use the many additional packages that also use the “Virtual Breadboard” license. A package can also require its own special license, which then also needs to be licensed by Virtual Breadboard to enable its use. A link connects two pins together. Components communicate to each other through their pins and over links. Multiple Document Interface is a standard Windows application framework which allows an application to contain multiple child documents. A MDI Child form is a child of the MDI application. The MDI application contains the MDI Child form and accesses it using the standard MDI framework tools. A collection of Components. Components in a package are usually from the same family eg The CMOS4000 series or PIC microcontrollers Each package has its own specification associated with it. A package specification describes the components it contains and any common functionality and properties. In addition a package specification may offer selection guides for its components to assist in selection Each component has a collection of interface pins known as its pinout. Components interact with each other through their pinout. 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 is where the component interactions on the breadboard are simulated using run, step and step over functions. A topmost form is a form is a form that sits on top of all other forms in Windows even if it is not the active form. Runtime tools in Virtual Breadboard often use Topmost forms. Virtual Breadboard needs to be reset to design mode to hide these topmost forms.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Licencing and Deployment Model Virtual Breadboard is a Windows application distributed as a self installing application downloadable from the WEB. Virtual Breadboard can be further expanded by downloading additional component packages also distributed over the WEB. A Virtual Breadboard circuit is of a set of connected components. Virtual Breadboard is the user 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 and Packages are collections of components. Virtual Breadboard is free and includes numerous free components that can be used to evaluate Virtual Breadboard. This evaluation/education version has no limitations, time limits or restrictions and is identical to the licensed version with the exception that the licensed version can add additional component packages for use in circuits. It is component packages that 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 the license for many additional component packages that are available to licensed Virtual Breadboard users. A license can be used by more than one package. Virtual Breadboard supports additional rd licenses to support the development of future high value components by 3 Party developers. These components can then be optionally licensed by Virtual Breadboard users so that you only need to pay for those packages you actually need.

Virtual Breadboard License : “Virtual Breadboard”

License : “License A”

Component Package

Component

Component Package

Component

License : “License B” Component

Component Package

©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 using Virtual Breadboard in fact you are free to use Virtual Breadboard without restriction. There are no time limits or limitations except you cannot add new packages. Still there is a very useful collection of Virtual Breadboard native components you can use for free. The free installation version 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 license Virtual Breadboard. Virtual Breadboard has a built-in License manager which you start using the Tools!License Manager menu. The License manager maintains a list of registered components and maintains licenses for each of them. Each registered component has a required license name and each license name has a serial number. When a license has been unlocked the serial number is replaced by a picture of a key to indicate you have purchased that license. Initially the only available package is the VIRTUAL BREADBOARD package which requires the “Virtual Breadboard” License. To unlock the “Virtual Breadboard” license you need an unlock key. To get an unlock key you will need to quote the “Virtual Breadboard” License serial number. Please refer to www.virtualbreadboard.com for more information on purchasing an unlock key. 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 the Unlock License button and completing the Unlock dialog with your unlock key.

©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 that the package has been licensed. The other thing that happens is that the ADD button is released which allows you to add new packages.

©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 have its own unique license or can use a license that already exists. For example there are already numerous packages that use the “Virtual Breadboard” license so these packages can be added 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 use the Virtual Breadboard license and are ready to be used in Virtual Breadboard. Alternatively a package may require a unique license. In this example the 3RDPARTY package requires its own special license. This licensing system has been designed to provide rd easy revenue access to encourage 3 party developers to build new and exciting package extensions to Virtual Breadboard. rd

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

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Virtual Breadboard Links/Selector

Toolbar

Component Preview

Components Pallete

Component Properties

Package Navigator

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

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Toolbar Icon

Function File New

Short-Cut Ctrl+N

File Open

Ctrl+O

File Save

Ctrl+S

Cut

Ctrl+X

Copy

Ctrl+C

Paste

Ctrl+V

Undo

Ctrl+Z

Run

F9

Halt

F5

Step

F7

Step Over

F8

Reset

F6

End

©1999 James Caska.

Description The file new button creates a new Breadboard. The new breadboard is added as a MDI form. Virtual Breadboard supports multiple open Breadboards The file open buttons starts a common control dialog to locate a previously saved breadboard to be opened. Virtual Breadboard files are saved with the *.VBB postfix The file save buttons saves the currently active breadboard to file. If it is a new file a common control dialog will open to select a new name for the breadboard to be saved as. Copies the currently selected components and mutual links to the clipboard and deletes them from the current breadboard Copies the selected components and mutual links to the clipboard. Pastes the contents of clipboard into the current breadboard. The pasted components are attached to cursor and placed into position on the next mouse click. Undoes the previous action. Virtual Breadboard supports multiple undo. Switches to runtime mode, and runs an interactive simulation for the current breadboard. Halts the current simulation but remains in runtime mode. Issues the step command to the breadboard. Switches to runtime mode if in design mode before issuing the step instruction. Steps over the next instruction. A component is free to determine what stepover means for it. For microcontrollers stepover means to execute a function call and step to the following instruction. Switches to runtime mode if in design mode before issuing the step-over instruction. Issues reset instruction to all breadboard components. Microcontrollers reset their PC and check for changes in their reference file, reloading if necessary. Switches to runtime mode if in design mode before issuing the step-over instruction. Halts the simulation and returns to design mode. Hides any runtime forms. Sets the simulated step frequency for the current Breadboard. This effects the timestep parameter to all components and the elapsed time calculations. Sets the animation speed which determines how often the screen is refreshed which can impact simulation performance.

www.virtualbreadboard.com

v1.0 November 1999

Links/Selector Icon

Function Selector

Description Sets the mode to component selection mode.

Rotate Left

Rotates the selected component right clockwise 90°. Is available when only one component is selected. Rotates the selected component left anti-clockwise 90°.. Is available when only one component is selected. Sets the mode to Link mode and sets the colour of the links to blue. Sets the mode to Link mode and sets the colour of the links to green. Sets the mode to Link mode and sets the colour of the links to red. Sets the mode to Link mode and sets the colour of the links to yellow. Sets the mode to Link mode and sets the colour of the links to yellow.

Rotate Right Blue Link Green Link Red Link Yellow Link Black Link

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 are present Remove a selected component from a group of selected components by clicking the component while holding down the SHIFT key Remove a sub-group of selected components from a group of selected components by dragging a bounding box around the components to unselect while holding down the SHIFT key Press ESC to unselect all components and return to select mode.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Functions for selected components Function Move

Cut Copy Paste

Delete Rotate Left Rotate Left

Description Selected components can be moved using drag-and-drop on the Breadboard. To drag-and-drop a selected component or group of selected components click and hold while the cursor is over at least one of the selected components. A preview bounding box will be attached to your pointer which can be used to determine where to drop the components. Releasing the button will place the components Selected components will be placed on copy buffer and deleted from Breadboard Selected components will be placed on copy buffer A bounding box preview of the components in the copy buffer will be attached to the mouse pointer. Use this preview to determine the location to place the pasted components. The next mouse click will place the components at the current cursor position All selected components and their common links are deleted Rotates the selected component right clockwise 90°. Is available when only one component is selected. 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 the mouse pointer will trace out a preview of the links. Release the mouse pointer over a second 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

©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 successful evaluation 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 components 3. Thou shall use feedback components for all feedback loops

Virtual Breadboard Components Virtual Breadboard Package Specification

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Tutorial 1: Binary Counter The best way to learn how to use a program is by example. This example takes you through the 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 the Evaluation Package. A CLOCK pulse generated by a 555 TIMER provides the input to be counted. This signal is the input to the RTCC (real time clock) pin of the PIC16c54. The PIC counts the pulses and uses PORT B to show the binary value of the count on a LED display. 555 Timer

Binary Count Output ©1999 James Caska.

PIC Debug Toolbar

PIC Micro Component www.virtualbreadboard.com

PIC Counter Source v1.0 November 1999

♦To create a New Breadboard 1. On the Windows task bar, click the Start button, point to Programs, and then click Virtual Breadboard Virtual Breadboard opens and starts as a Multiple Document Interface (MDI) parent application. ! New or select the New Toolbar button. 2. In the File menu select File! A new breadboard will start as a MDI child to Virtual Breadboard.

New button

Your screen should now look like this:

The next thing to do is to add the components to the breadboard. There are three components 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 want to familiarise yourself with its functionality, properties and use. Each component has a specification associated with it that fully described its functionality and use.

©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 the component appears in the component preview panel at the bottom left of the Virtual Breadboard main screen. Immediately above the preview panel is the properties panel, which now shows the available properties for the 555 Timer component. The specification for the component and its properties is available by clicking the PDF button at the top right edge of the preview panel.

Timer Component button

2. Click the Component Specification Button Component The specification document for the component will load as a PDF and appear as a MDI child in the document panel. The specification is the Specification button complete description of the component functionality. Including description 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. Component Properties

Component Specification

Component Specification button Package Specification button Timer Component button We would normally use the component properties editor is used to change component property values. However, the TIMER default settings of ASTABLE Timer, Duty = 0.5 and PERIOD 10 cycles are satisfactory so we are ready to add the component to the breadboard.

©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 created earlier using the Window ! Breadboard0 menu option as shown.

Component Preview

Virtual Breadboard is a MDI application. MDI means Multiple Document Interface. That is more than one document can be open at any one time. The two document types in Virtual Breadboard are component specifications and breadboards. Multiple breadboards and multiple specifications can be open at any one time in Virtual Breadboard. Virtual Breadboard supports the standard Window MDI menu options including Cascade, Tile Horizontally, Tile Vertically, arrange icons and the listing of currently open documents. You can manipulate your 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 dragging and dropping the component on the breadboard. In the bottom left corner of Virtual Breadboard is the component preview. Move your mouse pointer over the component preview.of the 555 Timer and Click and hold your left-mouse-button. A bounding box will appear around your mouse pointer to indicate you have picked up the component. Move the mouse to the approximate location you want to place the component on your breadboard. The bounding box will follow your mouse pointer as you move it to indicate where the component will fit on the breadboard. Don’t worry if you don’t place it exactly you can always move it again later on.

©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 real component onto a real breadboard. Think of the component selector as your component bin and your breadboard as well.. your breadboard. You get the idea. Repeat the previous two steps to add the LED8 component. (Bottom right hand corner of the component palette.) Leave a little room for the PIC16c54 micro to be added in the middle. You might notice the component is upsidedown. Later, I will show you how to turn it around.

LED8 Component button

Your screen should now look something like this.

Package Tree 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. Packages enable Virtual Breadboard to expand and grow. If you know a little about programming you can 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, the evaluation version of Virtual Breadboard can only use the EVALUATION package. The EVALUATION package contains a selection of sample components from other packages including the PIC16c54. All packages have a package specification which provides important information about the components in the package including component selection and any shared run-time features of the components.

©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 clicking the name of the package. This pops up a package specification menu which can be selected to access the package specification. When selected the specification appears in its own form in the same way as a component specification. To open the evaluation package specification right click on EVALUATION in the package tree and select the package specification menu. Your screen should now have the EVALUATION package specification

Package Specification Button An alternative way to review the package specification is to select the Package Specification Button. This opens the package specification for the currently selected component. Ie The component that is showing in the Component Preview panel.

Component Specification button

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

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

©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 will open the package to reveal the components as children. To add the PIC16C54 double-click on the EVALUATION and select PIC16C54 from the components in the list. Your screen should now look like this.

Component selected from Package Component Properties The PIC16C54 has now been selected as the current component. You will notice the Properties editor has been populated with properties for the PIC16C54. There are four properties. Type, Orientation, Filename and WatchDog. Type and Orientation are properties common to all components and are read only in the property editor. Type is the name of the component in the component package and obviously has the value of PIC16C54. Orientation determines which of four directions that component is facing 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 properties editor. As per the PICMICROS component specification. Filename locates the source code to be executed by the PIC. Two file formats are available, LST and HEX. LST is the MPLAB LST file generated when compiling source in MPLAB or any other development environment that supports MPLAB LST files. HEX is an Intel format HEX file containing the PIC execution code. Note that Debug facilities are only available for LST files.

©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 as Tutorials\Lesson1\Lesson1.LST. To select it as the source code for the PIC16C54 click on the Filename property in the property editor. The Filename property will become active and show the FileOpen button.

FileOpen Button Filename property is Active (Highlighted)

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

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

Completed Filename property

©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 look something like this.

LED8 PINS

PIC PORTB PINS

So now we are well down the track for building this application. All that remains is to link the components together and run the application. However what we really want to do is to tidy up the locations of the components so make the circuit nice and neat. A neat circuit is always easier to understand. Virtual Breadboard has a permanent grid and all components are designed to align to this grid which 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. At this point however the pins are facing the same way and a link between them is required to travel an unnecessary distance. What we really want is to turn the LED8 component around and buff it up against the PIC PortB so the links are short and unnoticeable. To turn the LED8 component around we need to first select it and then click one of the component rotation tools twice.

©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 Virtual Breadboard 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 the component. A number of things happen when you select a component. The first is that the component is surrounded by a selection bounding box. This indicates which component is currently selected. The second thing that happens is the selected component becomes selected into the component preview and its properties become available for in-place editing in the properties editor. Another thing is that component specific editing tools become available such as cut, copy, delete and the rotation tool. Which allow components to be cut -deleted from breadboard and placed in the copy buffer for later pasting, copied – copied into the copy buffer for later pasting, deleted – simply removed from the breadboard and rotation – which allows the orientation of the components to be modified. Component Rotation Tools Cut/Copy tools

Selected Component The other way to select a component is to use a bounding box. Bounding Box selection is primarily used for selecting multiple components is however a useful technique for component selection 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 the breadoard. 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 fully contained within the bounding box.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

♦To rotate a component Once a component is selected to rotate it simply click the rotation tools to rotate it 90° left or right. Notice however that rotation is only supported for individual components. Selecting a group of components disables the rotation tools.

Component Rotation Tools

Click either component Rotation tool to rotate LED8 180° so that its pins are facing the PIC PORTB pins. Note that the orientation property of the LED8 has changed from the default value of Down to Up. Your screen should now look like this.

Link Tools

LED8 has been rotated 180°° LED8 Orientation is Up

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

©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 by clicking on one of the link tool in the links toolbar. There are five available link colors to help you organise your breadboard. This puts the current breadboard into links mode and changes the cursor pointer to a cross-hair when Links Toolbar your cursor is over the breadboard. When you are in Links mode the only operation available is the creation links. To exit Links mode you need to reselect the Free Cursor mode by clicking the Free cursor icon or by pressing ESC which automatically resets to Free cursor mode. With the Link selected move your cursor to one of the pins you want to link and and clickand-hold your left mouse button down on the pin. There is a small area of snap-to-pin which will move the starting point exactly to the centre of the pin. Now with the left mouse button still held down move the mouse cursor (cross-hair) to the pin to link to, as you move the cursor a link is pulled from the starting pin to the current cursor position to provide a visual representation of the link being formed. When over the pin to link to release the button. If you got close enough to the second pin a link will be formed between the two pins. Free Cursor

Blue Link selected

Link Under construction.

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

©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 by aligning the components next to each other.

©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 the selected component or groups of components. Before moving components make sure the Breadboard 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 to move. A move selection box will be attached to the cursor and the cursor will change in to a move (NSEW) cursor. Moving the cursor will move the outline of the component which provides a preview of where the component will be moved to. Releasing the mouse button drops the component to the new location. Moving group selected components is also supported by the drag-and-drop move.

Run Simulation

Finally, the circuit is complete and we are ready to run the simulation. Virtual Breadboard operates 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 around the breadboard and so on. Runtime allows you to observe the circuit under simulated conditions. 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 only be available when in runtime mode. The PIC16C54 for example has an entire debugging tool suite 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 press the run button to start the simulation.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

♦To run a Virtual Breadboard simulation Running a simulation is as simple clicking the run Simulation button on the toolbar, selecting the Simulation!Run menu option or pressing the F9 shortcut key. This will put Virtual Breadboard into runtime mode, hiding the design time tools. Any runtime tools for the components will become available and the circuit will begin executing the simulation.

Run Simulation Button

In this example the PIC16C54 starts its debug menu and begins executing the counter source code. This results in the timing pulses being generated by the 555 Timer being counted by the PIC16C54 and the counted number appearing at PORTB and subsequently on the LED8 component in binary form. Simulated Step Frequency

Simulated Steps

Elapsed simulated real-time Steps/Second

During runtime there is some interesting performance and simulation information available in the toolbar. The simulated Step frequency, which by default is 1Mhz, is the number of simulated steps per second applied by virtual breadboard. Different components are effected differently by the steps frequency. The Timer component has the default period of 10 steps which in the real world makes it a 100Khz oscillator. The PIC16C54 in the real world has a divide by 4 clock which means 1Mhz step frequency is equivalent to running the PIC with a 4Mhz clock. The LED8 component is not effected by the step frequency. The simulated steps is the total number of steps the simulation has performed since this simulation session started. This is number is multiplied by the simulated step frequency to calculate the elapsed simulated real-time. To give some idea of the performance of the Virtual 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 single step through the simulation which provides good debugging opportunities. Before single stepping the simulation you need to halt the simulation.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

♦To halt a running Virtual Breadboard simulation To halt a running single step a simulation you first need to halt the simulation. Click the halt simulation button on the Halt Simulation Button toolbar, selecting the Simulation!Halt menu option or press the F5 shortcut key to halt the simulation. Note that halting the simulation is different to ending the simulation which returns Virtual Breadboard to design mode and hides any runtime tools associated with the components. With the simulation halted click the source button and the Special Function Registers button from the PIC16c54 debug toolbar to open the source code for the PIC. The complete documentation to the debugging tools available to components of the PICMICROS package are available in the PICMICROS package specification and are only covered here briefly as an example of component runtime tool usage. Single Step Buttons

PIC Debug Toolbar SourceCode Button

Current PIC SourceLine

PIC Source Code

PIC Special Function Registers

By having the Sourcecode and the Special Function Registers open as you single step you can see what is going on inside the PIC and how it correlates to the rest of the circuit. Single stepping is an invaluable debug tool and the ability to single step plus change values in other parts of the simulated circuit I am sure you will find an extremely powerful tools in the development of your microcontroller applications.

©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 Step Simulation button on the toolbar, select the Simulation!Step menu option or pressing the F7 shortcut key. This will step the simulation forward by one step.

Single Step Simulation Button

With the SourceCode and the Special Function Registers windows open what you will see is the 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 Registers window in RED to highlight the change. However sometimes when you click the step button nothing seems to happen but when you step a second time the soucecode steps again. This is because some PIC instructions require two steps to complete the instruction and the simulation executes in one step increments. Repeatedly pressing the single step button will show the sourcecode for this example going around a very simple loop that grabs the value from the TIMER0 register and then pushes it onto the PORTB output. Every ten steps, which is the period of the TIMER, the RTCC will receive the rising clock edge it requires to trigger the increment of TIMER0 which occurs independently of the main loop. All of this happens before your very eyes in single step mode which allows you view and compare expected values. Single stepping is a seriously useful tool, the other seriously useful tool you will use often in conjunction with single stepping are breakpoints. A breakpoint is a line of soucecode that when a running simulation comes to will automatically halt the simulation and allow you to single step from that point onwards. This allows you to set breakpoints in remote sections of the code and run the simulation up to that point before single stepping. Virtual Breadboard allows any component to support breakpoints. The PIC Debugger supports breakpoints using the sourcecode window.

©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 this case it is easy because the sourcecode is only small. For larger source code you will need to use the scrollbars and Find tools. The PICMICROS package specification more completely covers these additional tools. Once you have selected the line to set a breakpoint click either ! Break menu option, Right click to popup the Breakpoint toolbar button, Select the Source! the 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 a breakpoint set on a sourceline the breakpoint will toggle off. If the sourcecode is reset, that is if there is a change to the sourcecode and it is reloaded all breakpoints are reset.

Breakpoint Button

Sourceline with Breakpoint Set (RED)

Popup Breakpoint menu

Now that you have set a breakpoint when you run the simulation it will automatically halt at this line of code. In this example when you press run it probably will appear as if nothing has happened because there is only a few steps until the breakpoint is reached again. Nevertheless the simulation is running, repeatedly pressing run will step through the simulation 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 save the breadboard.

©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 toolbar or select the Simulation! End menu option. This action will stop End Simulation any running simulation, close any runtime forms, and return to design Button mode showing the design mode component selection and editing tools. It is important to know that ending the simulation does not reset the state of the simulation so that you can End the simulation and then run it again from design mode and the simulation will pick up from where it left off. When using Virtual Breadboad in conjunction with other development tools such as MPLAB you might find that the runtime forms remain on the top of your application even though Virtual Breadboard is only a background application. If this is undesireable, which is not always the case end runtime mode in Virtual Breadboard to 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 select the File! Save menu. This will start the filesave dialog which you use to create or locate a filename to save this breadboard as. Save Button

Save Button

FileSave Dialog

That’s all for Tutorial 1.

©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 they will see in when they are in their real-world application. Thus the Virtual Breadboard world is seen through the eyes of the microcontroller. If the microcontroller source code cannot tell the difference between the real-world and the Virtual Breadboard simulated world then Virtual Breadboard has done its job. Virtual Breadboard is not a spice simulation and doesn’t pretend to predict electronic circuit 1 behaviours For this reason you have to be very careful about the assumptions you make about the behaviour of your circuits especially for very high frequency signals where errors are most likely. In most circumstances the Virtual Breadboard simulation is sufficient to model the application as it will appear at the pinouts of the microcontrollers you are developing code for. Virtual Breadboard depends on the component models to take care of transient and complex circuit behaviours 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 modern software technique of a contracted interface. This allows the microcontroller implementation to be prototyped independently and often before the electronic design. This is a reversal of the 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 from the growing library of software and components in your designs. Secondly, the performance of Virtual Breadboard is better for the simplified circuit which is always important but especially so for debugging complex multiple processor systems. Thirdly, the Virtual Breadboard circuits are inherently simpler to construction where each component would often require many electrical components to do the job. However, it remains that Virtual Breadboard circuits are models of the real world and require special 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 designing 2 electronic circuits . There are already many excellent electronic circuit development tools such as Electronics Workbench, PSPICE, Protel and Circuit Maker. The role that Virtual Breadboard will play in the development cycle is to prototype your design before you even get to your Electronics circuit package and reduce the number of hardware development 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 of build a microcontroller application. The Virtual Breadboard simulation will suffice – although I must admit at the end of the day there is nothing quite like having the working thing in you hot little hands. Hardware seems more, well… real.

1

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

©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 which has a known input and a known output. A feedback loop is formed where a components output effects its own input. The evaluation model requires a component to resolve all of its inputs before it can determine its output so where its input depends on its undetermined output the simulation cannot find a solution. This is simply resolved by placing a feedback component in the feedback loop. One issue you need to be aware of is that a feedback loop induces a single step delay in the signal. This can be problem for complex feedback circuits especially 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 more than one link INTO a input. For example if a LED has two pins linking into it one link is attached to a switch with an open circuit and the other to a VDD power component the LED may well be OFF because it might think that it is open circuit. Depending on which link was made first. To resolve this situation you must use the JOIN component which is used to join multiple links into a single link. As always all voltages must be the same or open-circuit at a JOIN 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 simulation circuit. It just won’t work as expected. However being a visual environment it is usually pretty easy to detect when and what is not working as expected. I am however working to introduce error 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 but is not. It looks like it is linked but will cause a failure to link to the input of the component it forms an input to. The component cannot resolve its inputs and the circuit seems to fail. So double 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 on the breadboard when you are only editing the scratch component. This can sometimes mean you fail to set a filename or something.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Known Bugs Links to other documents fail in MDI-Child PDF help-files When you use the PDF with the embedded view, the PDFs will not link to other files through their links. If you find you want to link use the default external help viewer, ie Ensure the Help!Show Help in External Viewer is check. This is going to be a “feature” because unless abobe 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 can still use the menus and toolbars this annoying bug is remedied by closing and re-opening the breadboard.

Pasting can sometimes leave an extra copy of the component Copying and pasting can sometimes leave an extra component under the first parent component. This can mean you get a link confused because it is actually linked to the hidden component. 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. Not sure.

Screen Refresh The Screen refresh can sometimes leave artefacts. Eg. In place editing of the Label component will leave scribbles until the screen is refresh. If necessary you can use the scrollbars to move the breadboard forcing a refresh for now.

Editing Performance For many components and links on a single breadboard the refresh can get a little slow. I suggest you take advantage of the PCBInterconnect facilities to break your design into smaller chunks. Each breadboard can then be smaller and hence faster and easier to edit for now.

Lost Edit State When editing multiple breadboards at the same time the Select/Link button state can get confused. For example, on breadboard1 you are linking so you click a link and the cursor becomes a cross-hair. When you go to breadboard2 the cursor will become a selector arrow but the toolbar is still in link mode. Furthermore if you then click selector to pick and move components on breadboard2 when you return to breadboard1 the cursor returns to crosshairs even though the toolbar is in selector mode. Dilligence only required.

©1999 James Caska.

www.virtualbreadboard.com

v1.0 November 1999

Related Documents

User Guide
April 2020 41
User Guide
July 2020 29
User Guide
November 2019 71
User Guide
May 2020 41
User Guide
June 2020 31