Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] in MPLAB X, how does the #include command now work?

Status
Not open for further replies.

maark6000

Member level 5
Member level 5
Joined
Jan 15, 2013
Messages
92
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Visit site
Activity points
2,270
I'm working out of a book written in 2008... and apparently there have been some changes in MPLAB X. When I use the command:

include p16f84a.inc

the program build fails due to the fact that none of the subsequent SFRs have been equated.

I know most of you work in C, but I'm still trudging along in assembler. I am using the right compiler, and the p16f84a file is in the mpasmx folder. Does anybody know the correct protocol for getting this to work now in X?

Thanks.
 

Hi,

I actually reloaded X last night and this works fine.

Plenty of folk still use or have good knowledge of Assembler so no lack of support here.

Code:
	LIST P=18F4520,r=hex,n=80,x=off,st=off
	errorlevel -302		; no bank warnings

	#include <P18F4520.INC>
 

I added your code, except changed it for the PIC16F84A. It's still failing to build, here is a screenshot:

 

You didn't show the actual errors lines. Apparently, the assembler is complaining about undefined lowercase labels. Do you consider that labels are case sensitive by default?
 

In the build option or by a command line option, I think. You can also try to make your labels upper case, as in the include file.
 

how can I turn off the case sensitive thing?

Hi,

Did you find the Case Sensitivity options as FVM mentioned , its shown on the pic below, though its every ones own choice but I do find it better to have it On and always have the system and user registers in caps.

A few tips you might find useful.

If you double click on the error message line it takes you directly to that line in your code, very useful in a large program.

Don't know what book you have, but some of the earlier ones instruct folk to address the system and user register by their direct address
example movwf 0x05 when it should be movwf PORTA
They often did the same for the user registers
example mowf 0x0C
As you can see its gets very complicated with all those hex numbers.

Your User registers should be assigned labels ( names ) and the easiest way to do that is by using a Directive.
cblock 0x0C ;start address of user memory
name1
name2
endc

One of the other bug bears of assembler and the earlier chips in the constant switching between the various memory banks.
Its often shown as bsf STATUS,RP0 etc which can again make it difficult to follow,again you can use a Directive
banksel TRISA ; or whatever register you are going to, to move to bank1
banksel PORTA ; to move to bank 0 or you can use banksel 0 ( banksel 1 does not work)

These tutorials are widely used and can prove helpful.

http://www.winpicprog.co.uk/pic_tutorial.htm
**broken link removed**
http://www.amqrp.org/elmer160/lessons/
http://www.epemag.wimborne.co.uk/resources.htm
http://www.mikroe.com/chapters/view/5/chapter-4-timers/
 

Attachments

  • 000081.jpg
    000081.jpg
    55.4 KB · Views: 146

Yeah, turned out to be a case sensitivity thing. Under the "Run" Menu Bar option, I clicked on "Set Project Configuration" and then "Customize..." Once that window opens, under mpasm (global options) title, I clicked on mpasm. There I was able to turn of the Case Sensitivity box.

Thanks for the links WP100... you rock! It is very hard going thru this book written for MPLAB 8 when now I'm working with MPLAB X. They are very different.

Mark
 

Yeah, turned out to be a case sensitivity thing. Under the "Run" Menu Bar option, I clicked on "Set Project Configuration" and then "Customize..." Once that window opens, under mpasm (global options) title, I clicked on mpasm. There I was able to turn of the Case Sensitivity box.

Thanks for the links WP100... you rock! It is very hard going thru this book written for MPLAB 8 when now I'm working with MPLAB X. They are very different.

Mark

Hi,

Glad you found those things helpful.

Afraid you will find X a bit different from 8, though with X being so new there is little written on the web about it to guide the beginner.

As well as this forum you should always be able to find extra help on X at the Microchip forum. Below are just 3 of the many sections of their forum.
( be aware that there have been a lot of bugs with X since its introduction, the majority of those problems relate to folk using C rather than assembler)
https://www.microchip.com/forums/f238.aspx ; X
https://www.microchip.com/forums/f16.aspx ; Assembler
https://www.microchip.com/forums/f15.aspx ; Pickits2/3
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top