Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Compiler

Status
Not open for further replies.

gimmix

New Member
Ok. So i finally got my programmer. and to my knowledge its working.
SO i've been doing Nigels tutorial and tried compiling it with MPLAB IDE 7.10

I followed a short tutorial on how to use it on microchip website. and used their device (18f452), linker (18f452.lkr) and code (used template and added to it f452tmp0.asm) and it worked fine, Now its my turn following the same steps:
- used the project wizard
- chose my device (16f628), project name and location, tool suite,
- chose my source file (nigels tutorial 1-1) and the linker file (16f628.lkr)

Then tried to build it all and got this error. I even tried using the template and that still gave an error without me editting the template, WHAT THE HELL !
soo can someone pls tell me what i'm doing wrong or missing. Notice it says "TRISB isn't in bank 0". I nigels code isn't editing bank 0, it tries to edit bank 1
 

Attachments

  • problem1.jpg
    problem1.jpg
    109.2 KB · Views: 999
Sorry, but I never use MPLAB (it seems FAR too complicated), I just use it's assembler MPASMWin, which is installed along with MPLAB - installing MPLAB seems to be the only way to get a recent version of MPASMWin.

If you're following the same steps as you did for the 18F chip, that could be a reason for the problem? - the 18F chips are quite a bit different, and MicroChip introduced a number of different options for them.

The bank switching 'message' isn't an error, it's just a warning to remind you that you're trying to access a register not in bank zero - it takes no notice of the fact you've just switched banks!. You can turn this warning off, and my later tutorials do so.

To use MPASMWin you simply run the program, select the assembler file you want in the requester (or type the path and name directly), and press the assemble button - it's that simple!.
 
The problem is wrong placement in program memmory. Make sure that sections fit in their locations (eg Interrupt routines). Also make sure your start vector is placed AFTER the ISR... (Use "ORG" to place certain code at certain Address)

Ignore thoose Warning messages, they are only informations, so you won't forget to place correct banking instructions in your code. If you don't want to see certain Warning, add this to your config:
Code:
	__CONFIG	_CP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON &_XT_OSC & _MCLRE_ON & _LVP_OFF ;ignore this, it's for 16F628
	ERRORLEVEL -302 ; disable banking warning
 
[quote="To use MPASMWin you simply run the program, select the assembler file you want in the requester (or type the path and name directly), and press the assemble button - it's that simple!.[/quote]

ARE YOU KIDDING ME!! THATS IT!! I SPENT ALL OF LAST NIGHT TRYING TO GENERATE THIS HEX FILE AND THATS ALL IT TAKES .. arggggh..

Thanx for the info nigel.. that significantly makes things easier..
I guess the night wasn't a total bust though. I still do wanna learn MPLAB so i can use the simulator. simulators have helped me in other programming languages to debug, so i think its definaltely be an asset. It has to completley compile successfully in order to use the simulator right?

to JaySlovak:
Do u use MPLAB IDE or do u just use the compiler aswell?
If so, did u do a tutorial or something that u can recommend?



Thanx for the info (both of u). It definately helped me to move along..
 
gimmix said:
to Jay.Slovak:
Do u use MPLAB IDE or do u just use the compiler aswell?
If so, did u do a tutorial or something that u can recommend?
Yes, I use Pure MPLAB Tools 7.11. I found it dfficult to move from old 5.40 versions to new 6.x and 7.x. But now it's not a problem for me. So I understand your frustration! (Took me a while to get it all moving.) It seems like you are doing everything OK about MPLAB. please post your Code, and I will try to add ORG sections where needed.
 
Jay.slovak said:
gimmix said:
to Jay.Slovak:
Do u use MPLAB IDE or do u just use the compiler aswell?
If so, did u do a tutorial or something that u can recommend?
Yes, I use Pure MPLAB Tools 7.11. I found it dfficult to move from old 5.40 versions to new 6.x and 7.x. But now it's not a problem for me. So I understand your frustration! (Took me a while to get it all moving.) It seems like you are doing everything OK about MPLAB. please post your Code, and I will try to add ORG sections where needed.

Thank you for the offer on the help, it'll be a little while now before i start writing my own code. But when i do start, I will definately take you up on that help for using MPLAB.. The one i was using for the problem stated earlier was a TEMPLATE. I would have thought the template would have everything in the correct place. But i guess not..

Thanx again.
 
Mike said:
Gimmix,

Don't use the Linker...

Regards, Mike

Wow.. that is an interesting way to solve the Linker problem, just dont use it.. Its GENIUS !!!
I would never have thought of it. I can now use the simulator..

Thanx man
 
gimmix said:
Mike said:
Gimmix,

Don't use the Linker...

Regards, Mike

Wow.. that is an interesting way to solve the Linker problem, just dont use it.. Its GENIUS !!!
I would never have thought of it. I can now use the simulator..

Thanx man
I find linker prety usefull. But if you don't need it, don't use it...
 
Nigel Goodwin said:
Sorry, but I never use MPLAB (it seems FAR too complicated)

If you are working on a BIG and complicated project you will want to write object code in stead of absolute code in wich case you NEED mplab.

But indeed for simple projects mplab adds extra difficulties.
 
Mike, K8LH wrote:
Gimmix,

Don't use the Linker...

Regards, Mike


Wow.. that is an interesting way to solve the Linker problem, just dont use it.. Its GENIUS !!!
I would never have thought of it. I can now use the simulator..

Thanx man

I know that probably sounded flippant, but I've only written code in absolute mode these first 15 or 16 months... A couple projects with over 1,000 lines in a single .asm file...

I'm sure I'll probably get into multiple files, relocatable code, and the linker sometime in the future as projects get larger...

Good luck... Best wishes... Regards, Mike
 
Ok soo i guess with all this talk about linkers. I have to ask it, sorry :S

What exactly does the linker do and what are the advantages of using it?

my understanding of what it did was assign mem config and register names. Atleast thats what the intro tutorial told me anyway. I guess there is a reason why it was termed INTRO. They leave out all the confusing details.

For now (seeing that i am just starting up). I think the lack of the linker will work. My own code that i right so far is less than 100 lines. :oops:


oh one last one. what is absolute code and object code business you are all talking about?
 
To the extent of my knowledge, the linker 'links' code separated among several files together to form a single object code, or binary file... And I don't think you should pass the 1000 lines to be 'elligible' to use the linker. If you have extensible program, want 2 make it upgradable, or just like to separate bigger task into smaller ones, the linker could come-in handy...
 
gimmix said:
oh one last one. what is absolute code and object code business you are all talking about?

Nigels tutorials use absolute code. In absolute code you assign adresses to program code & variables yourself explicitly (variable 1 goes on adress 0x30, this code at adress 0x100, ...)
When writing object code you let the linker assign adresses to program & variables automatically.

This has the advantage that it is much easyer to reuse code, as you can code it to be a "black box" wich you can put into future projects within minutes since the linker will handle memory organization.
With absolute code you would have to rethink all adresses for every project you use the code in order for it to 'fit'.

There's much more to it, too much to explain here really.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top