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.

MPLAB v7.21

Status
Not open for further replies.

ljcox

Well-Known Member
I have just downloaded this version and it is quite different to the v5.7 that I was using. I have read the Quick Start and parts of the User Guide but cannot find an explanation of the data initialisation syntax. I opened the template for the PIC16F84A and this is an exract:-

INT_VAR UDATA 0x0C
w_temp RES 1 ; variable used for context saving
status_temp RES 1 ; variable used for context saving

; example of using Overlayed Uninitialized Data Section
; in this example both variables are assigned the same GPR location by linker
G_DATA UDATA_OVR ; explicit address can be specified
flag RES 2 ; temporary variable (shared locations - G_DATA)

G_DATA UDATA_OVR
count RES 2

From this I gather that one or more bytes can be reserved using RES 1, RES 2, etc.
Does this mean that a variable can be 16 bits long? This appears to be the case in the example above for the variable "count". So does this mean that the variable "count" is 16 bits and that the programmer can use "count" in the same manner as if it were only 8 bits?

What does INT_VAR UDATA mean? It appears to be the heading for general variables. They do not use cblock and endc.

What does G_DATA UDATA_OVR mean? They have used this heading for the variable "flag" and also for "count".

Does this mean that very RES 2 variable has to be preceeded by G_DATA UDATA_OVR ?

I looked in PICLIst for guidence and could not find any. Any assistance will be appreciated.
 
Len,

MPLAB 7.21 doesn't redefine the PIC assembly language!!! Stop trying to make sense of that file!

[misleading advice edited out]

MPLAB will work with any source you wrote using older versions.
 
Len,

I got carried away there, your installation is fine. :lol: You just got the wrong file. Use the templates off the C:\Program Files\Microchip\MPASM Suite\Template\Code folder, not C:\Program Files\Microchip\MPASM Suite\Template\Object...
 
Joel Rainville said:
Len,

I got carried away there, your installation is fine. :lol: You just got the wrong file. Use the templates off the C:\Program Files\Microchip\MPASM Suite\Template\Code folder, not C:\Program Files\Microchip\MPASM Suite\Template\Object...
Thanks Joel, I'll look at that folder. I was following the Quick Start tut.
 
ljcox said:
Thanks Joel, I'll look at that folder. I was following the Quick Start tut.

Allright, but remember, the language hasn't changed. If something looks alien to you, you probably are doing something the wrong way. The upgrade to 7.21 shouldn't be a big deal.
 
Joel,
I was able to use the \code file as you suggested and have loaded a programme that I wrote on the previous version of MPLAB.

However, I'm seeing the following error message and cannot find the problem.
Make: The target "D:\Projects32\PIC_A.o" is out of date.
Executing: "D:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84A "PIC_A.asm" /l"PIC_A.lst" /e"PIC_A.err" /o"PIC_A.o" /w2
Make: The target "D:\Projects32\PIC_A.cof" is out of date.
Executing: "D:\Program Files\Microchip\MPASM Suite\MPLink.exe" "D:\Program Files\Microchip\MPASM Suite\LKR\16f84a.lkr" "D:\Projects32\PIC_A.o" /o"PIC_A.cof" /M"PIC_A.map"
MPLINK 3.94, Linker
Copyright (c) 2005 Microchip Technology Inc.
Error - section '.org_0' can not fit the absolute section. Section '.org_0' start=0x00000000, length=0x00000244
Errors : 1

BUILD FAILED: Tue Oct 11 09:11:40 2005

Here it the first few lines of the prog.

porta equ 05 ;
portb equ 06 ;

trisa equ 85 ;PORTA DIRECTIONAL REGISTER = 85
trisb equ 86 ;PORTB DIRECTIONAL REGISTER = 86

cblock 0x20
boolean
count0 ;used as a general counter
count1 ;used in division routine
count2 ;used in division routine

counta ;used in delay routine
countb ;used in delay routine

const0 ;constant - used in division routine
const1 ;constant - used in division routine
const2 ;constant - used in division routine

index ;holds switch data
offset ;holds index - 8 value
swval ;switch value, taken from portb

endc

#define arm porta, 0 ;hardware control
#define preset porta, 1 ;preset hardware
#define en_clk porta, 2 ;enable clock hardware
#define o_1 porta, 3 ;O1 signal
#define Q_8 porta, 4 ;counter IC8/Q4

#define start0 boolean, 0 ;start0/512 indicator
#define _50k boolean, 1 ;sample rate = 50 kHz
#define jmp2spd boolean, 2 ;jump to spd (start point decision)
#define sl_bit boolean, 3 ;slope switch indicator, taken from RA3
#define o_1s boolean, 4 ;remembers that O1 has been set
#define sw_ch boolean, 6 ;port change indicator
#define data boolean, 7 ;temp

#define mode swval, 7 ;Setup/Run indicator
#define slopesw porta, 3 ;to be RD7 slope switch

ORG 0x000 ; processor reset vector
main (this came from the template)
start call Init

sw_chg call reset ;

btfsc swval, 7 ;check mode
goto setup ;

I could build this prog in the previous MPLAB.
 
Just to make sure : you manually merged the template with your program?

If so, why didn't you just use your program as is?

Also, it looks like you are using relocatable sections? If not, just remove the linker script from the MPLINK command line (Project->Build Options)... Basically make the project look identical to what it was in MPLAB 5.7...
 
Joel Rainville said:
Just to make sure : you manually merged the template with your program? Yes

If so, why didn't you just use your program as is? I thought I had to use the template. So I assume you mean that I simply use the existing file, ie. the one produced in the v5.7 MPLAB. I'll try that

Also, it looks like you are using relocatable sections? I don't know what "relocatable sections" are. If not, just remove the linker script from the MPLINK command line (Project->Build Options)... Basically make the project look identical to what it was in MPLAB 5.7...

Thanks for the response, I'll try your suggestions.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top