Maybe MPASM don't follow or just consider the newer device... I'll not be surprise if so...
Let's see what Melanie will discover with her brand new version.
Maybe MPASM don't follow or just consider the newer device... I'll not be surprise if so...
Let's see what Melanie will discover with her brand new version.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Acetronics, Last year I worked on a project for almost 4 months trying to get an 18F1320 to operate @ 40 Mhz. and then @ 20 Mhz. with eratic results. After looking at the data sheet I decided to use the 16F88 and have never gone back to the 18F1320. The errata sheets tell all. I ordered parts from DigiKey and they said that they had the latest hardware on hand but after receiving 50 parts of an old revision I gave up ordering from them. I was on the MicroChip forum for about 2 months and found out that they wern't very stable as far as the PLL goes and very sensitive to power supply variations. Like I said after looking at the data sheets of the 2 I decided to go with the 16F88 and haven't looked back yet. LOL
Dave Purola,
N8NTA
Alain,
The oscillator speed of your PIC is 20MHz.
Can you try to change "DEFINE OSC 20" in "DEFINE OSC 25" and flash
the PIC running at 20 MHz with this code? If you try that you will
probably increase the EEPROM writing time and see if ONE write is
enough. This is just a test.
Best regards,
Luciano
EDIT:
Are you absolutely sure that the oscillator speed is correct?
-
Last edited by Luciano; - 7th April 2006 at 15:39.
Hi,LucianoOriginally Posted by Luciano
Sorry, but that won't give anything ... as the EEPROM writing time is controlled by the PIC Hardware ...
For the Osc speed, it's correct : 1.52 ms input signals give ( 279 + 7H ) Hex.
( EEPROM addresses are: 01 high byte, 02 low byte, and 30 Offset )
Thanks for the idea ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Alain,
I understand that at completion of the write cycle, the WR
bit is cleared in hardware and the EEPROM Interrupt Flag bit
(EEIF) is set. The user may either enable this interrupt
or poll the WR bit. There is also a third barbarous method which
is just wait 10 ms.
In your post you say that PbP uses the polling method. This
should be ok if the microcontroller hardware has no bug.
Can you put a "PAUSE 10" after each WRITE in your code?
(10 ms pause).
Best regards,
Luciano
Sorry one more time, Luciano ... the problem only occurs with a single writing !!!
a Pause won't change anything ... and won't change the EEPROM writing time.
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Alain,
From the revision history of the 3 documents....
- PIC18F1220/1320 Rev. B1 Silicon/Data Sheet Errata
- PIC18F1220/1320 Rev. B4 Silicon/Data Sheet Errata
- PIC18F1220/1320 Rev. D0 Silicon/Data Sheet Errata
... I can see that the silicon B1 and B4 have suffered from
silicon EEPROM issues. For the silicon D0 there is only a
change in the Data Sheet. No silicon EEPROM issues. (For now).
Your project is going to be published in a magazine.
Will your readers have always the right silicon version of
the 18F1320, the right MPASM version and the right PBP version?
Are you going to publish three different software versions
with the workarounds suggested by Microchip? This will be
difficult to manage for your readers.
From your replies in this thread I only see your determination
to make your project work with this chip, regardless if the chip
has a problem or not. I am surprised when you say that the problem
only occurs with single byte writing. As you already know, if
you look at your EEPROM dump file you will see that the same 11
values are written 3 times at different addresses. This is one
problem. The "FF" you get when your PBP program writes only one
byte is one more problem. (When PBP WRITE is called only once).
Note that this byte is also written 3 times, first time "FF" and
then twice again with the correct value "7F" at different addresses.
The "FF" is probably an incomplete write. (EEPROM auto clear
before write).Is the EEPROM dump file correct? Can you confirm it
by reading the 256 bytes with a test program? How many chips did
you try? There are many questions still open. If you can only program
with PBP, then a pause of 10 ms after each of the 11 WRITE could maybe
show something new in the dump file. If you don't have time to write
some test code then just use a 16F648 or a 16F88 for your publication
in the internet magazine.
Best regards,
Luciano
===============================================
===============================================
===============================================
PIC18F1220/1320 Rev. B1 Silicon/Data Sheet Errata
http://ww1.microchip.com/downloads/e...Doc/80160f.pdf
DOCUMENT REVISION HISTORY
Rev A Document (06/2003)
First revision of this document, silicon issues 1 (Data
EEPROM), 2 (Data EEPROM), 3 (Core), 4 (INTOSC),
5 (Internal Oscillator Block), 6 (Internal Oscillator
Block), 7 (Electrical Specifications), 8 (EAUSART),
9 (EAUSART) and 10 (EAUSART) and Data Sheet
Clarification issues 1 (Internal RC Accuracy) and 2 (DC
Characteristics Table).
Rev B Document (10/2003)
Added silicon issue 1 (Core).
Rev C Document (12/2003)
Removed silicon issue 2 (Data EEPROM). Changed
silicon issue 8, 9 and 10 (was issue 9, 10 and 11) from
EAUSART to USART. Added silicon issue 11 (Data
EEPROM).
Rev D Document (05/2005)
Removed silicon issue 7 (Electrical Specifications),
added silicon issue 11 (Reset), changed previous label
of USART to EUSART in silicon issues 7, 8 and 9 (to be
consistent with the data sheet) and added Data Sheet
Clarification issue 1 (CCP).
Rev E Document (08/2005)
Added Data Sheet Clarification issue 2 (Data EEPROM
Memory).
Rev F Document (03/2006)
Corrected part number revision IDs in the table on page
one.
===============================================
===============================================
===============================================
PIC18F1220/1320 Rev. B4 Silicon/Data Sheet Errata
http://ww1.microchip.com/downloads/e...Doc/80175e.pdf
DOCUMENT REVISION HISTORY
Rev A Document (12/2003)
First revision of this document, silicon issues 1 (Core),
2 (EUSART) and 3 (Data EEPROM) and Data Sheet
Clarification issues 1 (Internal RC Accuracy) and 2 (DC
Characteristics Table).
Rev B Document (2/2004)
Added silicon issue 4 (EUSART). Added Data Sheet
Clarification issue 3 (Timer1 Oscillator and In-Circuit
Serial Programming).
Rev C Document (4/2004)
Added Data Sheet Clarification issues 4 (DC
Characteristics) and 5 (LVD Characteristics).
Rev D Document (05/2005)
Added silicon issue 5 (Reset) and removed all Data
Sheet Clarification issues with the exception of former
issue 3 (Timer1 Oscillator and In-Circuit Serial
Programming™), now numbered issue 1 and added
issue 2 (CCP).
Rev E Document (08/2005)
Removed Data Sheet Clarification issue 1 and added
issue 2 (Data EEPROM Memory).
===============================================
===============================================
===============================================
PIC18F1220/1320 Rev. D0 Silicon/Data Sheet Errata
http://ww1.microchip.com/downloads/e...Doc/80244b.pdf
DOCUMENT REVISION HISTORY
Rev A Document (08/2005)
First revision of this document. Includes silicon issues 1
(Core), 2 (EUSART), 3 (Reset) and 4 (Oscillator
(INTOSC Source)), and Data Sheet Clarification issues
1 (Timer3 (Special Event Trigger)) and 2 (Data
EEPROM).
Rev B Document (03/2006)
Removed previous silicon issue 4 and added new silicon
issues 4 (Oscillator/INTOSC) and 5 (Oscillator/INTRC).
Data Sheet Clarification issue 1 (CCP) clarified as
Timer3/Special Event Trigger.
================================================== ============
================================================== ============
================================================== ============
I've studied two chips...
Both have a Batch Code of 05250SE and a Silicon Revision of DEVID2=07h DEVID1=C4h (located at 3FFFFEh and 3FFFFFh respectively).
This is my Test Code, run on internal Oscillator at 4 and then at 8MHz... compiled with PBP2.46 with patches and MPASM 5.01.
And the result?Code:' ' EEPROM Test Program for PIC18F1320 ' ---------------------------------- ' Melanie ' 07/04/2006 ' ---------- ' ' PIC Defines ' ----------- @ __CONFIG _CONFIG1H, _IESO_OFF_1H & _FSCM_OFF_1H & _INTIO1_OSC_1H @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _BORV_20_2L @ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_32K_2H @ __CONFIG _CONFIG3H, _MCLRE_OFF_3H @ __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L @ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H ' ' Hardware Defines ' ================ ' ' PIC Speed ' --------- Define OSC 8 ' ' LCD Display ' ----------- Define LCD_DREG PORTB ' Port for LCD Data Define LCD_DBIT 4 ' Use upper 4 bits of Port Define LCD_RSREG PORTB ' Port for RegisterSelect (RS) bit Define LCD_RSBIT 3 ' Port Pin for RS bit Define LCD_EREG PORTB ' Port for Enable (E) bit Define LCD_EBIT 2 ' Port Pin for E bit Define LCB_BITS 4 ' Using 4-bit bus Define LCD_LINES 2 ' Using 2 line Display Define LCD_COMMANDUS 2000 ' Command Delay (uS) Define LCD_DATAUS 50 ' Data Delay (uS) ' ' Other Ports ' ----------- LED var PortB.0 ' ' Software Defines ' ---------------- CounterA var BYTE ' Just a Counter DataA var BYTE ' Byte Variable for Data DataB var BYTE EEPROMError var BIT ' Error Flag ' ' EEPROM Presets ' -------------- Data @0,"This is a Test String that should be overwritten" Data "by the Write to EEPROM routine" ' ' Start Program Here ' ================== ' ' Initalise PIC ' ------------- OSCCON=%01110010 ADCON1=%01111111 TRISB=%00000000 Low LED Pause 2000 High LED ' ' Write to EEPROM ' --------------- LCDOut $FE,1,"Writing EEPROM",$FE,$C0,"A=" For CounterA=0 to 255 DataA=255-CounterA LCDOut $FE,$C2,#CounterA Write CounterA,DataA Next CounterA LCDOut $FE,1,"Write Complete" Pause 2000 ' ' Read & Verify EEPROM ' -------------------- EEPROMError=0 LCDOut $FE,1,"Verifying EEPROM",$FE,$C0,"A=" For CounterA=0 to 255 LCDOut $FE,$C2,#CounterA Read CounterA,DataA DataB=255-CounterA If DataA<>DataB then LCDOut $FE,$C6,"E=",HEX2 DataB LCDOut $FE,$CB,"R=",HEX2 DataA EEPROMError=1 Pause 2000 LCDOut $FE,$C6,REP 32\11 endif Next CounterA LCDOut $FE,1,"Write Complete" ' ' Result ' ------ LCDOut $FE,$C0,"Chip Test " If EEPROMError=0 then LCDOut "Pass" else LCDOut "Fail" endif EndLoop: Pause 500 Toggle LED Goto EndLoop end
One chip fails miserably, and the other works perfectly. The appended picture shows the good PIC passing at 8MHz... frequency counter is measuring Internal Oscillator OUT on RA6 which is fosc/4.
The PIC that failed did NOT write to EEPROM... it's previous contents were untouched, the Read section reported $FF from every memory Location (that had not previously been preset by a DATA statement). I have not had time to impliment the ERRATA (Section 10 Page 3) suggestions from Microchip and verify if the dud PIC works with one or both of them.
Alain, email or message me your address off-list and I'll send you the working PIC - you can then see if your program works on that.
Bookmarks