Topics Topics Edit Profile Profile Help/Instructions Help Member List Member List  
Search Last 1|3|7 Days Search Search Tree View Tree View  

Programming the EEPROM in a PIC16F1829

:: EPE Chat Zone ­:: ­Radio Bygones Message Board :: » EPE Chat Zone » Archive through 21 October, 2016 » Programming the EEPROM in a PIC16F1829 « Previous Next »

  Thread Last Poster Posts Pages Last Post
  ClosedClosed: New threads not accepted on this page        

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 523
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 30 June, 2016 - 09:06 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi All,
I am trying to put data into the EEPROM of the PIC16F1829 along with the assembly language program code, after compiling. I am using MPLAB v8.91 and a PICkit3 on an XP + SP3 PC.

As per the MPLAB Help file for EEPROM I am using an 'org 0x2100' directive, and 'de' statements :-

org 0x2100 ; Start of EEPROM memory space.

de b'00000011' ; 'bd_tflags_ee', Tracked flags register.
de d'04' ; 'bd_sys_track_count_ee', System Track count.
de h'24' ; 'bd_track_1_lo_ee', Track 1 Displacement.
de h'00' ; 'bd_track_1_hi_ee',
de h'20' ; Track 2 Displacement.
de h'03'
de h'D0' ; Track 3 Displacement.
de h'07'
de h'70' ; Track 4 Displacement.
de h'17'

etc., etc.

The compilation gives this error :-

Error - section '.org_6' can not fit the absolute section. Section '.org_6' start=0x00002100, length=0x00000014
Errors : 1

Link step failed.

The '.org_6' referred to is the 6th 'org' that the compiler comes across when assembling.
I can't find any explanation in Help about this error.

Can anyone shed some light on what the problem is ?

With thanks, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 11
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 30 June, 2016 - 11:35 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

There's a discussion of the error message here:

http://www.microchip.com/forums/m97134.aspx

I'm C and Pascal man myself, so it's all Double Dutch to me ;)
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 12
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 12:36 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Actually I think you have the EEDATA address wrong... according to the linker file for the PIC16F1829:

CODEPAGE NAME=eedata START=0xF000 END=0xF0FF

whereas you're using 0x2100 which I believe was for the "un-enhanced" PIC16s.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 524
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 01:20 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi trevor,
Thanks for your reply. I have never got involved with the Linker before, as all my projects to date have been with a single '.asm' master file, assembled as absolute code. The '.asm' file includes many Header files of the type '.inc' to complete the project.

I thought it might be because I put an 'org' statement in the EEPROM's '.inc' file, instead of in the '.asm' - where all the other 'org's are - but having tried moving it to the '.asm' file didn't make any difference.

I must admit that having read through the discussion you posted, I didn't understand very much of what they said - I lack their knowledge of the topic.

With regards, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 525
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 01:24 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi trevor,
Ah! I wondered about the address from the outset, but couldn't find any other data in the Help file.

I'll give it a go - thanks for your input.
( Bit of a late night session here!)

With regards, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 526
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 01:31 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi trevor,
Brilliant - compilation now succeeded !!
I viewed the EEPROM, and my data is now in there.

Many thanks for your help, Paul.

(Message edited by bowden_p on 01 July, 2016)
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 13
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 01:36 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

No worries. Now you can turn in for the night while I wonder what I'll have for lunch :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 527
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 11:32 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi all,
Euphoria short-lived - when recalling the EEPROM data in my program I find it doesn't appear to be correct. I've tried various settings in the Programmer - Settings - Program Memory tab of MPLAB without success.

Initially I thought that View - EEPROM would display the device memory - not so. The screen shows the same data whether a device is in the socket or not - so that comes from a file.

Any suggestions on getting a PICkit3 to put data into the EEPROM would be welcome !

With regards, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 14
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 11:50 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Have you tried reading the memory back with the PICkit 3 to check the EEPROM contents? It would rule out issues with your program.
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 15
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 01 July, 2016 - 11:58 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

From a quick look at a template for a PIC16F1827 in MPASM in MPLABX, I think:

org 0xF000 ; Start of EEPROM memory space.

should instead be:

DATAEE ORG 0xF000

Not sure whether capitalisation is important or whether the assembler in MPLABX is different to MPLAB minus the X. Worth a shot though :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 16
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 02 July, 2016 - 12:08 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

I checked the same template file in MPLAB v8.92 (the last version before it was discontinued) and it is the same as in the current MPLABX.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 528
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 02 July, 2016 - 12:18 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi trevor,
I'm really showing my ignorance here - but how do you read back the EEPROM ? I can't figure this out from the Help files for either the Programmer or Debugger for PICkit3.

I much appreciate your interest, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 529
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 02 July, 2016 - 12:31 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi trevor,
DATAEE, dataee, DATA, or data appears to be treated as a label for assembly language, or 'data' a directive for inputting characters into program memory. 'dataee' is not found by a search of the Assembler Help file.
Is this a directive for 'C' ?

With regards, Paul.

(Message edited by bowden_p on 02 July, 2016)
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 17
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 03 July, 2016 - 06:43 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

1) To read back the EEPROM I would use the PICkit 3 standalone programming software (screenshot)


2) No, DATAEE is nothing to do with C. I took it from the .asm file in MPLAB at c:\Program Files (x86)\Microchip\MPASM Suite\Template\Code\PIC1827TEMP.ASM which is in the same device family as your chip.

[Excuse the delayed response; Federal Election fever intervened :-]
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 530
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 03 July, 2016 - 02:47 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi trevor,
That software looks useful - where can I download it from ?

I've looked on Microchip's website, but not found it there. Google did point me to 2 downloads on a Microchip forum :-
PICkit3 Programmer Application v3.10
pk3cmd

Is your screen shot from the first App ?

With regards, Paul.

p.s. We've just had a referendum on leaving the EU - heartily glad that is over now !!

(Message edited by bowden_p on 03 July, 2016)
Top of pagePrevious messageNext messageBottom of page Link to this message

rollestonian
Regular Contributor
Username: rollestonian

Post Number: 45
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 03 July, 2016 - 03:44 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi Paul,

I think you will find the software you require already installed here :-
"C:\Program Files\Microchip\PICkit 3 v3\"
I have had a few problems with it, mainly when trying to quit.

Regards.
Ken
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 531
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 03 July, 2016 - 11:08 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi Ken,
Thanks for the suggestion. I checked my Microchip folder - no such luck there. I have sub-folders featuring the "PICkit3" or "PK3" string, but they don't have .exe files, but .dll, .sig, .hex. Looks like it was excluded from my download - MPLAB v8.91.

I gather from forum comments found by Google that it is now unavailable from Microchip.

Hi trevor,
I found the "DATAEE" string in the file you refer to :-
DATAEE ORG 0xF000
DE "MCHP" ; Place 'M' 'C' 'H' 'P' at address 0,1,2,3

In this case "DATAEE" is a label for the line, should you wish to jump to that line from elsewhere.

With regard, Paul.

(Message edited by bowden_p on 03 July, 2016)
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 18
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 04 July, 2016 - 12:17 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Re: DATAEE - I didn't know whether it was significant or not, not being an asm programmer. The closest I've come to that is programming a 6502 CPU in machine code back in the 80s. That was fun (but I was younger :-).

As for the PICkit 3 software, Microchip still have it available in the "software archive" though they make it pretty hard to find. You can still download the program from:

http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit_3_Programmer_1_0_Setup_A.zip
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 532
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 04 July, 2016 - 12:19 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi Ken,
I have just installed the "PICkit3 Programmer Application v3.10" mentioned above, and now have the folder you mentioned in my "C:\Program Files\Microchip\" folder.

Thanks to you both for your help - I'll run it tomorrow.

With regards, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

trevor
Valued Member
Username: trevor

Post Number: 19
Registered: 06-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 04 July, 2016 - 12:31 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

"PICkit3 Programmer Application v3.10" is the wrong program - that turns your PICkit 3 into a PICkit 2 !

You want the one I linked to above which is the "PICkit 3 Programmer 1.0" assuming you didn't just get the names mixed up.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 533
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 04 July, 2016 - 01:36 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi Trevor,
I'll follow that through tomorrow - thanks for the warning! I haven't run the v3.10 with my PICkit3 connected yet - I was wary about other warnings seen on the web.
With regards, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

evanvenn
Just joined
Username: evanvenn

Post Number: 3
Registered: 07-2016

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 09 July, 2016 - 08:09 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

I just posted, see http://www.chatzones.co.uk/discus/messages/7/17064.html?1468047944

The installer discussed here has both Pickit2 and Pickit3 as part of the package.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 535
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 09 July, 2016 - 05:25 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi trevor,
Thanks for the warning - I have been busy with another issue this week, but hope to get back to my EEPROM topic soon.

I have the "PICkit 3 Programmer 1.0" files now, will try them soon.

Hi evanvenn,
Thanks for the info on your GCBasic IDE. I will look at that sometime. I used to do a lot of BASIC programming on an Amstrad 6128 years ago, then got interested in assembler coding, writing Z80 code on that machine.

With regards, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

james
Frequent Contributor
Username: james

Post Number: 675
Registered: 02-2007

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 09 July, 2016 - 06:28 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi Paul,

My earliest memories of learning to program are when I used to go into Dixons as a "customer" and play on the computers in the shop such as the VIC20, typing in programs such as

10 PRINT "CHRIS"
20 GOTO 10

This was about 1982/83, later furthering my BASIC skills on the BBC micro.
My first job out of college, working for the MOD, saw me programming in FORTH on a TDS 9090 dedicated FORTH board and subsequently on one of the early PCs in Turbo C.
Apart from a little assembly language at college I didn't really get into assembly until the mid-range PICs came along, although I did go through a phase at home of hand assembling short assembly language programs for a Z80 microprocessor and programming them one byte at a time into EPROM using an EPROM programmer which had a keypad on it.

Cheers

James
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 536
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 09 July, 2016 - 11:12 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi James,
"programming them one byte at a time into EPROM using an EPROM programmer" - ouch!!

I remember the company I worked for offering engineers a college course in another early micro, learning assembler for that, and the practicals were with a similar programmer. A painfully slow process.

I had a commercial ROM by ARNOR, attached to my Amstrad in a ROMBOX, which allowed editing and compiling, and the code could then be called from BASIC. This was very convenient, especially if hardware the code controlled was also attached to the expansion port at the back of the machine. That really allowed decent length programs to be developed.

With regards, Paul.
Top of pagePrevious messageNext messageBottom of page Link to this message

james
Frequent Contributor
Username: james

Post Number: 676
Registered: 02-2007

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 10 July, 2016 - 01:52 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Yes Paul, hand assembling followed by programming the EPROM one byte at a time was painfully slow and could at times be described as "ball aching" but it was a process that really taught the programmer the intracate realities of what was actually going on which perhaps explains why the technique was made use of on your training course.
To be more precise the data was entered one byte at a time, using the keypad, into the EPROM programmers RAM memory until the whole program had been entered at which point the EPROM would be "blown" in one fell swoop.

I've not been back in from the pub long so if this post doesn't make sense please ignore it!

Cheers

James
Top of pagePrevious messageNext messageBottom of page Link to this message

james
Frequent Contributor
Username: james

Post Number: 677
Registered: 02-2007

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 10 July, 2016 - 10:10 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

...Ah that's better, a clearer head now.

That Cornish Real Ale is good stuff but it doesn't do much for my immediate post writing abilities!
Top of pagePrevious messageNext messageBottom of page Link to this message

james
Frequent Contributor
Username: james

Post Number: 678
Registered: 02-2007

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 10 July, 2016 - 01:59 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

... usage of the descriptive term "ball aching", although not an electronic purist's technical expression, does accuratly reflect a particular technical set of circumstances and therefore it may well be worthwhile enthusiastically campaigning to have it included in subsequent editions of the Newnes Dictionary Of Electronics.
Top of pagePrevious messageNext messageBottom of page Link to this message

bowden_p
Frequent Contributor
Username: bowden_p

Post Number: 537
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 11 July, 2016 - 12:13 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi James,
I notice your post of :-
"I've not been back in from the pub long . . ."
was at 01:52 am, so I guess you had a good time!!

I managed to read back the EEPROM data using my current project hardware, accessing the device via the SPI interface, for display on an LCD, quite independently from programmer hardware. The data was the same as the program source, so I now have confidence in the programmer to download, even if I don't believe the MPLAB readback.

I need to press on with this project, but many thanks to trevor and rollestonian. I have the ""PICkit 3 Programmer 1.0" files and will try out its facilities later. I don't want to risk any upset to my PICkit3 functionality just now!

With regards, Paul.

Administration Administration Log Out Log Out   Previous Page Previous Page Next Page Next Page