Go to Post ... hey which end of the robot faces the wall anyways? Oops.... :rolleyes: - dhitchco [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-08-2007, 20:25
funkstar funkstar is offline
Registered User
no team
 
Join Date: Aug 2007
Location: sweden
Posts: 4
funkstar is an unknown quantity at this point
simple MPLAB quest

Hi All.
My program is getting big and hard to overview. I want to add more files to my project so that each file can contain one or a few of my subroutines.
This should be easy stuff i figured but I have been surfing around a lot over the last couple of hours without getting anywere.
So could someone just give a short description on how to get two .asm files compiled and linked together in one project, or point me in the right direction?

Any help, much much apreciated.

Best

Per

Last edited by funkstar : 29-08-2007 at 04:26.
  #2   Spotlight this post!  
Unread 29-08-2007, 08:34
xrabohrok's Avatar
xrabohrok xrabohrok is offline
hunter of errors
FRC #1208 (The Metool Brigade)
Team Role: Programmer
 
Join Date: Jan 2006
Location: O'Fallon
Posts: 62
xrabohrok is an unknown quantity at this point
Re: simple MPLAB quest

you will need to manually add the files using "add file" or copy and paste to new files. Then, you will need to use #include statements to get it all together. This is something I don't understand very well, so google "making C header files". That should work out for you.
__________________
"It's programming's fault" may be a viable excuse for just about everything, except the robot falling apart.

It will 'cause it can!

constants aren't. variables won't.
  #3   Spotlight this post!  
Unread 29-08-2007, 11:51
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,511
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
Re: simple MPLAB quest

Quote:
Originally Posted by xrabohrok View Post
you will need to manually add the files using "add file" or copy and paste to new files. Then, you will need to use #include statements to get it all together. This is something I don't understand very well, so google "making C header files". That should work out for you.
If you really want to make it easy, just copy one of the .c files (and it's relevent .h) that is just a few subroutines, gut it, rename it, and put what you want in it.

I'm not sure if it's good practice, but I've saved some time doing that before.
  #4   Spotlight this post!  
Unread 29-08-2007, 11:58
funkstar funkstar is offline
Registered User
no team
 
Join Date: Aug 2007
Location: sweden
Posts: 4
funkstar is an unknown quantity at this point
Re: simple MPLAB quest

Hey,
Thanks for the answers. Thing is that I do not use C at all. I do everything in Assembler. Is there a way to do this with asm? Do you know of any simple sample code for me to look at.. found some PIC USB protocol that had multiple asm files but it was quite a hassle to go thrugh.
I know how to program C, so I have tried a lot of ways with the #include statement but I get errors, so i figured i was on the wrong path..
Again, any further help is much much appreciated.

Be good.

Per
  #5   Spotlight this post!  
Unread 29-08-2007, 12:05
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,511
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
Re: simple MPLAB quest

Quote:
Originally Posted by funkstar View Post
Hey,
Thanks for the answers. Thing is that I do not use C at all. I do everything in Assembler. Is there a way to do this with asm? Do you know of any simple sample code for me to look at.. found some PIC USB protocol that had multiple asm files but it was quite a hassle to go thrugh.
I know how to program C, so I have tried a lot of ways with the #include statement but I get errors, so i figured i was on the wrong path..
Again, any further help is much much appreciated.

Be good.

Per

In C, I believe the include statements are;
#include "file.h"

I'm not 100% sure, I've been doingmore mechanical stuff recently (but like to keep in touch with my good friend C). you could check the code on kevinwatson.org to see some examples.

EDIT: I got your post completely backwards, I thought you meant you needed to do it in C.

Hmmm, 99% of the time I have a syntax problem or don't know how to code something, I google it and it usualy comes up.

try;
assembly programming include

or something like that.
  #6   Spotlight this post!  
Unread 29-08-2007, 12:09
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: simple MPLAB quest

try
Code:
LINK yourfile.asm
  #7   Spotlight this post!  
Unread 30-08-2007, 07:59
funkstar funkstar is offline
Registered User
no team
 
Join Date: Aug 2007
Location: sweden
Posts: 4
funkstar is an unknown quantity at this point
Re: simple MPLAB quest

I have googled alot..
The "LINK" command does not seams to work..
Maybe I should post some code here to clarify things:
My first file: agraal08.asm

;************************************************* *
list p=16f819 ; list directive to define processor
#include <p16F819.inc> ; processor specific variable definition
#include <test.asm>
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _WRT_ENABLE_OFF & _CPD_OFF & _CCP1_RB2 & _DEBUG_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_ON & _WDT_OFF & _PWRTE_ON & _INTRC_IO

;************************************************* *********************
; RESET VEKTOR
;************************************************* *********************
ORG 0x0000 ;här ska vi börja vid reset.
goto Init ; go to beginning of program

Init ORG 0x0005
call Sub_Test
clrf PORTA
goto Init
END ; directive 'end of program'
;***********************************


and my second file with the subrotine: test.asm

;******************************************
list p=16f819 ; list directive to define processor
#include <p16F819.inc> ; processor specific variable definitions
Sub_Test
movlw .99
movwf PORTA
return
END
;********************************************

I am using MPLAB 7.30.00.00 and have no C compiler (and would preferably keep it this way).

If you could modify the code so that this works (one way or the other) I would be off with a smile.

Thanks
Per
  #8   Spotlight this post!  
Unread 30-08-2007, 19:17
funkstar funkstar is offline
Registered User
no team
 
Join Date: Aug 2007
Location: sweden
Posts: 4
funkstar is an unknown quantity at this point
Re: simple MPLAB quest

Ok, sorted it myself.. hehe
If I rename the "test.asm" to "test.inc" and include this by: #include <test.inc> in the beginning of the "agraal08.asm" file. Then put a ORG statment on the Sub_Test routine:
Sub_Test ORG 0x0050

and remove the "END" of the .inc file then it seams to work. Have not tried it much but it looks like it behave the way I want. Tomorrow (its quater past 1 at night here.. sould go home form work really..)

Thanks to you trying to help me (probably I am just too novice on this to make your suggestion work for me..).

Best

Per
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Peasant's Quest Pat McCarthy Chit-Chat 6 14-02-2005 07:17
pic: Cooney Quest Render 1 CD47-Bot Extra Discussion 12 21-02-2004 10:52
using the MPLAB IDE MPLAB SIM simulator WizardOfAz Programming 1 03-11-2003 01:24
MY QUEST HAS BEEN COMPLETED! (yay!) AlbertW Chit-Chat 15 30-04-2003 10:51
Disney Quest Chicago Closed D.J. Fluck Chit-Chat 3 01-05-2002 22:18


All times are GMT -5. The time now is 19:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi