Readers should also study the page data sheet that covers the devices,. Microchip code DSA (see later). The following EPE subject material is. Note: The datasheet of PIC16FA Microcontroller and more detailed Features can be found at the bottom of this page. (Consult Sections of the 16F87x Data Sheet and of the Midrange Reference Manual for more detail.) Inside the 16F87x’s PWM module, the period is.
|Published (Last):||26 November 2009|
|PDF File Size:||14.64 Mb|
|ePub File Size:||1.81 Mb|
|Price:||Free* [*Free Regsitration Required]|
WLoader – a 16f application loader. Compared to is older brethren the 16f has much more to offer at around twice the price. Microchip keeps changing its website, so when these links turn out to be invalid you might have to look around a little.
The 16f supports three methods to get a program into the chip: Self-programming uses a program executed by the 16f itself.
This is the approach used by loader firmware. HVP is always available.
This is the programming method common to all PIC chips. LVP seems to be available on all new flash chips 16f87x, 16f62x. Self-programming is unique to the 16f and its close relatives 16f87x. LVP is available only when it is enabled by a bit in the fuses word which can only be changed using HVP. LVP claims pin B3 as enable pin. By default a 16f is delivered with LVP enabled. Loading the WLoader firmware disables it, so B3 is freed for use by the application. Self-programming means that the 16f87x can program its own code FPROM, so – once you have loaded suitable application loader firmware in your target 16f87x – a simple serial interface to your PC is all you need to download and run an application.
The pro’s datasheer con’s of the three loading methods are summarized below. If neither WLoader nor any of the other bootloaders satisfies datashet particular needs for instance because you want I2C, SPI or another exotic interface do not hesitate to develop your own bootloader, it is not very difficult.
Feel free to ask my assistance for such a project, but I will have to charge you a commercial rate – beside my hobbies I must make a living! The block diagram shows the taget circuit as far as relevant for WLoader.
WLoader – a 16f877 application loader
The remote reset circuit can be omitted when the target circuit already has a manual reset pushbutton switchbut it is very convenient to be able to reset the target and hence activate WLoader from the PC. The block diagram also suggests how the circuits can be divided between the target datashfet and a download dongle.
A production system could just provide the relevant signals on a 2×4 pin header, and rely on a download dongle that contains the remote reset and the RS circuitry. Note the resistor on the single line from the PIC used for communication. This resistor determines the level on the line when either the rest of the circuit or the PC is not connected, so in that case the application is started automatically when the PIC is reset.
Note that conform good practice both sets of power pins of the 16F are connected. Except for the crystal which must be 20 MHz and the reset see below adtasheet can vary this part of the target circuit to suit your needs, or use what you already have in your design. The send-receive combiner is just R3. R1 is needed when the MAX can be removed from the circuit when it is part of a download dongle to provide a low level on the RE2 pin of the 16F, so WLoader will start the application.
R2 is daasheet when the MAX is datasheer permanent part of the circuit, again to provide the low level on RE2, in this case when no PC is connected. This ‘el-cheapo’ version of the WLoader hardware uses a few resistors and a zener diode as RS interface. It is shown here mainly because this was the original WLoader hardware.
I recommend this version only to those who are enthousiastic about minimal-hardware solutions and can solve the problems that might occur. Don’t ask me for help. The right side or the circuit is the same 16F target circuit as used with the MAX The RS interface R2, D1, R7, R3 avoids current through the 16f protection diodes, which is outside Microchip’s operating specs and is rumored to cause all kinds of nasty effects.
When the RS input is negative the zener now acting as diode and the same resistors put a voltage on the interface pin that is close to zero. When nothing is connected to the RS connector R1 keeps the 16f input high, which causes the loader to start the application when a reset occurs.
When the circuit is split between a dongle and the real target R1 must be included in the target so the application will be started on a reset. The loader interface hardware can be part of the final circuit, and the loader interface pin can be shared with its operational function, but some attention must paid to its use: When the target circuit must be kept as simple as datasheey the real or el-cheapo RS interface, and the remote reset circuit can be put in a download dongle.
When the pin assignment shown in the table is used the interface can be used datassheet for HVP programming Wisp programmer and self-programming WLoader. The whole gadget can be plugged in where a 16f would fit and adds in-circuit downloading to a circuit. The 33k reset pull-up and a LED for power indication can be disabled by pulling two pin header jumpers for low-current tests.
A reset either manually or via the remote reset circuit activates the loader. When no PC or download dongle is connected a resistor forces the interface pin to the opposite polarity of what it would be with the PC etc. The loader detects this and will immediately activate the application.
When a PC is connected the input is low the RS idle level is negative and the loader will wait for instructions from the PC.
The Wisp PC command-line tool can be used to download the application code, to verify dtaasheet downloading, to start the application program, and provides a simple TTY interface that can be used to communicate with the application. The user must disconnect the RS cable when the application program must run automatically after a reset. The loader puts a goto instruction at addresses The user application instructions at these addresses are put at a location within the loader, and are executed before the jump to the rest of the user application program, starting at address 3.
Hence the application loaded by the loader can be exactly the same as a stand-alone program downloaded to the 16f Luckily most compilers are not that clever. For dataasheet overly-clever compiler you can try to let the application start with three NOPs.
The loader accepts instructions from the PC to write the configuration fuses and the code locations occupied by the loader. It does not actually perform the write, but does verify against the stored value, or in case of the configuration fuses word, against a copy of the actual fuses value.
PIC16FArchitecture-Memory Organization with Block Diagram
Hence the loading will not be hindered by the configuration fuses in the hex file, and a copy can be made of the application and configuration fuses and this copy can be downloaded using either the loader or a normal programmer.
Note that in such a copy the loader will be disabled because the applications code for the addresses The protocol adheres to the WBus definition, but the WLoader is always in active mode after a reset of the 16F, so it does not support multiple devices on the same bus. Hence the break condition and the hello commands are not needed, but do no harm. This discription mentions only the aspects that are specific to WLoader. The pseudo RS interface circuit is self-echoing: When the optional remote reset circuit is implemented the DTR line can be made high to reset the target.
After this is done an appropriate delay must be observed for the target to start. Besides the standard WBus-defined commands the WLoader firmware implements a number of specific commands which are described in the next table, together with the WLoader-specific aspects of the WBus-defined commands.
I Increment The current memory location pointer is incremented. The final W is echoed as W when programming is not necessarry or the programming is succesfull. The L is echoed as? For the data memory the higher 8 bits a and b are ignored. R Read The current memory location 4 hexadecimal digits is read and coped the content to the communication buffer. For program memory the higer two bits are set to 0.
For data and configuration the higher 8 bits are set to 0. T Type The type name WLdr is copied to the communication buffer. V Version The version number 4 hex digits is copied to the communication buffer. The current version The final W is echoed as W when the programming is succesfull. It will echo as? For program and configuration memory the higer two bits of a are ignored. The current location is set to the first location of the program memory. The current location is set to the first location of the data memory.
The current location is set to the first location of the configuration memory.
WLoader – a 16f application loader
A typical program – run sequence would be: Note that you must use the correct version because the two version use different polarity of the RS signal. It might be necessarry to copy the p16f I tested 20 and 10 MHz xtals at the WBus default baudrate of 19k2.
For a 4 MHz Xtal 19k2 is too fast, 9k6 works. I did this using my own HVP 16×84 programmer Wisp. 16c87x problem has been reported with programming the 16f with a HVP programmer when LVP is enabled in the configuration which it is in a fresh chip. Once LVP is disabled in the configuration fuses word this pull-down might no longer be needed, but some people have reported that it is datasgeet needed for succesfull HVP programming. Datasyeet is not needed 16c87x downloading using WLoader.
The loader disables the analoge functions of port A to make it possible dxtasheet use the port A pins as digital inputs. Before the application is started port A is put back in its power-on state analog functions enabled, port A pins can not be used datasheeet digital inputs. WLoader is designed for and tested with the 16f only, but it should be useable with other 16f87x chips when some modifications are made: Two test programs are provided, written in Jal. The wisp tool will notice that it communicates with the WLoader firmware, so it sets the default target to 16f The hex value abcd is written to the current memory location if and only if the current location differs from abcd.
The current memory location 4 hexadecimal digits is read and coped the content to the communication buffer. The version number 4 hex digits is copied to the communication buffer. The hex value abcd is written to the current memory location.