![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
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 | |
| |
| | #2 |
|
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!. | |
| |
| | #3 |
|
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
__________________ "I share, thus I am" Jay.slovak Read this! ICD2 Clone Best PIC/DsPIC Bootloader Read my Inchworm ICD2 review! | |
| |
| | #4 |
|
[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.. | |
| |
| | #5 | |
| Quote:
__________________ "I share, thus I am" Jay.slovak Read this! ICD2 Clone Best PIC/DsPIC Bootloader Read my Inchworm ICD2 review! | ||
| |
| | #6 | ||
| Quote:
Thanx again. | |||
| |
| | #7 |
|
Gimmix, Don't use the Linker... Regards, Mike | |
| |
| | #8 | |
| Quote:
I would never have thought of it. I can now use the simulator.. Thanx man | ||
| |
| | #9 | ||
| Quote:
__________________ "I share, thus I am" Jay.slovak Read this! ICD2 Clone Best PIC/DsPIC Bootloader Read my Inchworm ICD2 review! | |||
| |
| | #10 | |
| Quote:
But indeed for simple projects mplab adds extra difficulties. | ||
| |
| | #11 | |
| Quote:
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 | ||
| |
| | #12 |
|
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. ops: oh one last one. what is absolute code and object code business you are all talking about? | |
| |
| | #13 |
|
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...
| |
| |
| | #14 | |
| Quote:
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. | ||
| |
|
| Tags |
| compiler |
| Thread Tools | |
| Display Modes | |
| |