From Srecko
Vukadinovic. He is doing our PIC Programming Course.
Question: I
am programming a PIC16F84 with the Multi-Chip Programmer using the windows IC-PROG
software. If CP (Code Protection is set in the configuration) does this
mean you can't erase the chip?
Answer: No. The Code Protection feature only means
you cannot read the program in the chip. The chip can be erased and
re-programmed about 1,000 times with the CP bit (bits) SET or NOT
SET.
Question:
The PIC12C509 is a OTP device but the
data sheets talk about 1,000,000 erase/write cycle EEPROM. What does this mean?
Answer:
You must be confusing two different data
sheets. The PIC12C509 does not have internal EEPROM for storing variables
(variables are values generated by a program or an input from external sources).
The PIC16F84 has 64 bytes of internal EEPROM and they can be written/erased about one million times.
Re-check your data sheets and confirm this.
And from Dave Sutherland:
Dear Colin,
I would like to congratulate you on your brilliant website! I have paid a lot of money for similar courses here in South Africa which you
offer on your new site. I have just purchased a PIC programmer and will be following your PIC
programming course very shortly.
Yours is by far the best PIC orientated course I have found.
Thanks for your effort and time - people like myself appreciate it.
Kind Regards,
Dave.
email: davepsutherland@hotmail.com
A very good question came from a reader last week.
He wanted to get the hex code for a program such as: (or any program)
ORG 0x00
BSF 03,5 ;Go to page1 for setting-up the ports
MOVLW 00h ;Put 00 into W
MOVWF 05h ;Make all RA lines output
MOVWF 06h ;Make all RB lines output
BCF 03,5 ;Go to Page0 for programming
MOVLW 02h ;Put 02 into W to
MOVWF 05h ;Reset the 4017
The first thing you have to
know is the type of microcontroller you will be using. In this case it is a
PIC16F84:
Open MPASM
v2.07
Tick Radix default, untick case sensitive, tick warning level default, tick
macro expansion default, tick HEX output default, tick generated files: Error
file and List file. Select processor 16F84A, tab size 8.
In the browse window, find the file you want to "work with" on your computer.
It will have an extension .asm Put the location of the file into the window.
Click the button ASSEMBLE.
MPASM will take
the .asm file and produce a .lst file and .hex file
This .hex file is only suitable for a PIC16F84A
The chip can be "burnt" (programmed) with the file by following the next set of
instructions:
Open IC-PROG
Select PIC16F84A as the processor and untick WDT, PWRT and CP.
Select Oscillator: RC.
Click on the file ICON at the top left of the screen.
A window will open up and show the .asm .lst and .hex files that you have
created (if not, find the folder with the files).
Click on the file you want and click on OPEN.
The .hex values will be loaded into the window.
Click on the icon with the lightening arrow and the chip will be “Burnt”
(provided you have it fitted to the multi chip programmer.)
The job is done.
More FEEDBACK
This page is all about feedback. If you have similar questions, let me
know. I am especially interested in items involving the use of our
projects.
Colin Mitchell
Editor - TALKING
ELECTRONICS
Interactive