Searching \ for '[PIC] - Very Newbie - Progress!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/begin.htm?key=pic
Search entire site for: '- Very Newbie - Progress!'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] - Very Newbie - Progress!'
2005\10\10@120936 by Ed Edmondson

flavicon
face
> Hi Ed, it will compile
>
>> "Symbol not previously defined"
>
> In the Build Options (or in MPASM if this isn't opened as a  project) turn
> off case sensitivity. The .inc file has >definitions in  upper case, the
> program is in lower case (does anybody actually ever use case sensitivity
> for >asm ????).

Spent most of yesterday in MPASM tring to find a switch to turn off case
sensitivity. I read the MPASM manual front to back, read the online
tutorial, and looked in MPASM without any luck. How about a hint?

I looked at the .inc file and changed the program to uppercase where
necessart and guess what it compiled with no errors. However MPLINK had one
error: I read the MPLINK manual and found the error message but have no idea
what it means.

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=0x0000005e
Errors    : 1



2005\10\10@122840 by Aaron

picon face
Ed Edmondson wrote:

> Spent most of yesterday in MPASM tring to find a switch to turn off
> case sensitivity. I read the MPASM manual front to back, read the
> online tutorial, and looked in MPASM without any luck. How about a hint?

In MBLAB v6.22,

Project Menu -> Build Options
Select your filename and click the checkbox to "disable case sensitivity"

Aaron

2005\10\10@123413 by Jan-Erik Soderholm

face picon face
Ed Edmondson wrote :

> Spent most of yesterday in MPASM tring to find a switch to
> turn off case sensitivity...

Project -> Build options/Project -> MPASM tag -> "Disable case
sens...".

> I looked at the .inc file and changed the program to uppercase...

Disable case sensitivity instead.

> 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=0x0000005e
> Errors    : 1

Need to see the source (if large, just a small test case
that shows the error...)

Jan-Erik.



2005\10\10@124335 by Jan-Erik Soderholm

face picon face
Aaron wrote :

> In MBLAB v6.22,
>
> Project Menu -> Build Options
> Select your filename and click the checkbox to "disable case
> sensitivity"

Better to disable it project-wide, not for each file separately...

Jan-Erik.



2005\10\10@125236 by Ed Edmondson

flavicon
face

> I looked at the .inc file and changed the program to uppercase where
> necessart and guess what it compiled with no errors. However MPLINK had
> one error: I read the MPLINK manual and found the error message but have
> no idea what it means.
>
> 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=0x0000005e
> Errors    : 1

Here is the source. It is a very short program.

; testprog.asm
;
; 8th October 2005
;
; LED blinky

  list P = 16F877
  include "P16F877.inc"

errorlevel -302, -305, -306

; turn off some MPASM messages

; 302 not in bank0
; 305 default destination of 1
; 306 crossing page boundary


; Instruction cycle time = 400ns with 10MHz crystal

;set configuration

 __CONFIG _CP_OFF & _WRT_ENABLE_ON & _HS_OSC & _WDT_OFF & _PWRTE_OFF &
_BODEN_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF

        cblock 0x20

        varname1             ;some variables
        varname2
        varname3

        endc

; define a pin name

#define  led     PORTB,1      ;pin to drive LED

;program address start in memory

      ;  org     0x00         ;start address
       ; goto    delay

        org     0x000         ;start address
        goto    DELAY



; interrupt vector

;         org     0x04         ;REM if interrupts not used
;         goto    isr          ;REM if interrupts not used

init     clrf    STATUS       ;bank0

        clrf    PORTA
        clrf    PORTB
        clrf    PORTC
        clrf    PORTD
        clrf    PORTE

        banksel TRISA        ;set data direction on pins

        movlw   b'00000000'  ;all PortA as output
        movwf   TRISA


        movlw   b'00000000'  ;all PortB as output
        movwf   TRISB


        movlw   b'10000000'  ;all PortC as output
        movwf   TRISC

        movlw   b'10000000'  ;all PortD as output
        movwf   TRISD

        movlw   b'10000000'  ;all PortE as output
        movwf   TRISE

        movlw   b'10000000'
     ;            1           internal pull-ups off

        movwf   OPTION_REG   ;INTEDG = 0, falling edge for microswitch

        banksel PORTA        ;return to bank0

;===============================================

led_loop bsf     led          ;turn LED on
        call    DELAY        ;0.2s delay
        bcf     led          ;turn LED off
        call    DELAY        ;0.2s delay
        goto    led_loop     ;blink forever (what a life)

DELAY   movlw   .56          ;call 1ms delay 200 times
        movwf   varname1
ms1      call    msec01
        incfsz  varname1
        goto    ms1
        return

msec01   movlw   .30          ;delay approx 1ms @ 10MHz
        movwf   varname2
loop     nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        incfsz  varname2
        goto    loop
        return

 end

>
>
>
> --

2005\10\10@132314 by Maarten Hofman

face picon face
>
> Here is the source. It is a very short program.
>
>  Ah, get ready for people commenting on the source code, like me :). With
my comments I base myself on the subject line, that you consider yourself
"Very Newbie". Some of the comments might not be appropriate if you have
more experience.


{Quote hidden}

is happening. The 302 warning can be avoided by adding the appropriate caret
to the variable, which indicates that you understand that the correct bank
bits have to be set (initially BANKSEL is the recommended way of switching,
as far as I understood from this list). The 305 warning can be avoided by
adding ,w or ,f to the instruction. The 306 warning should not occur in your
software until your code is really growing in size. If that happens, you
really want to be warned about this happening.


{Quote hidden}

PICmicros. If you have a solid high level and low level design of your
project, I think it is fine to use the absolute model, as you know why you
chose the particular PICmicro, and you can always recreate the sourcecode in
any form you wish based on the low level design. However, if you are
creating your design by coding, it is highly recommended that you use the
relocatable model. Ask about it, and you will be pointed in the right
direction.


{Quote hidden}

your linker problem: the linker is, as far as I know, only necessary in
relocatable mode. You're in absolute mode, so linking is not necessary.


> goto DELAY
>
>  DELAY is a subroutine. You should not use "goto" to go to a subroutine,
unless you are in a subroutine and want to save a "call-return" combination.
As this would be an advanced use, just avoid it in general. You probably
want to do "call DELAY", or leave out the line alltogether.


{Quote hidden}

BANKSEL.


{Quote hidden}

source code look unprofessional, and even though the joke might be funny at
first, it will grow pretty boring quickly.


>
> DELAY movlw .56 ;call 1ms delay 200 times
> movwf varname1
> ms1 call msec01
> incfsz varname1
> goto ms1
> return
>
>  There are better delay loops in the world, but it should work. Note that
varname1 and varname2 don't really say anything about what the variable
means. It would also be good to comment that the routines affect these
variables. In the relocatable model, these could obviously become local
variables that then could be reused elsewhere without you having to worry
about them.


{Quote hidden}

>

2005\10\10@133636 by Jan-Erik Soderholm

face picon face
This code at least *builds* without errors. But I have no idea
at all if it *works* as intended, but that wasn'ty you problem.
*The* problem was that you tried to build absolute mode code
using the linker (MPLINK) when relocatable mode code
is expected.

And Maarten faild to see *that*, even if his other
comments might be OK... :-)

Jan-Erik.

Here is the code, the changes are marked "J-E"...

; testprog.asm
;
; 8th October 2005
;
; LED blinky

  list P = 16F877
  include "P16F877.inc"

errorlevel -302, -305, -306

; turn off some MPASM messages

; 302 not in bank0
; 305 default destination of 1
; 306 crossing page boundary


; Instruction cycle time = 400ns with 10MHz crystal

;set configuration

 __CONFIG _CP_OFF & _WRT_ENABLE_ON & _HS_OSC & _WDT_OFF & _PWRTE_OFF
& _BODEN_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF

        udata  ; J-E

varname1 res 1            ;some variables J-E
varname2 res 1            ; J-E
varname3 res 1            ; J-E

; define a pin name

#define  led     PORTB,1      ;pin to drive LED

;program address start in memory

      ;  org     0x00         ;start address
       ; goto    delay

        code  0x000         ;start address J-E
        goto    init    ; J-E



; interrupt vector

;         org     0x04         ;REM if interrupts not used
;         goto    isr          ;REM if interrupts not used

prog1    code  ; J-E

init     clrf    STATUS       ;bank0

        clrf    PORTA
        clrf    PORTB
        clrf    PORTC
        clrf    PORTD
        clrf    PORTE

        banksel TRISA        ;set data direction on pins

        movlw   b'00000000'  ;all PortA as output
        movwf   TRISA


        movlw   b'00000000'  ;all PortB as output
        movwf   TRISB


        movlw   b'10000000'  ;all PortC as output
        movwf   TRISC

        movlw   b'10000000'  ;all PortD as output
        movwf   TRISD

        movlw   b'10000000'  ;all PortE as output
        movwf   TRISE

        movlw   b'10000000'
     ;            1           internal pull-ups off

        movwf   OPTION_REG   ;INTEDG = 0, falling edge for
microswitch

        banksel PORTA        ;return to bank0

;===============================================

led_loop bsf     led          ;turn LED on
        call    DELAY        ;0.2s delay
        bcf     led          ;turn LED off
        call    DELAY        ;0.2s delay
        goto    led_loop     ;blink forever (what a life)

DELAY   movlw   .56          ;call 1ms delay 200 times
        movwf   varname1
ms1      call    msec01
        incfsz  varname1
        goto    ms1
        return

msec01   movlw   .30          ;delay approx 1ms @ 10MHz
        movwf   varname2
loop     nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        incfsz  varname2
        goto    loop
        return

 end



2005\10\10@134702 by Maarten Hofman

face picon face
>
> And Maarten faild to see *that*, even if his other
> comments might be OK... :-)
>
I did? I thought one of my comments was "Again, expect comments on your use
of absolute mode. This is also causing your linker problem: the linker is,
as far as I know, only necessary in relocatable mode. You're in absolute
mode, so linking is not necessary."
But I agree that it might have been too unclear. I'm glad you fixed the
source code, though.



>

2005\10\10@134925 by Jim Robertson

flavicon
face

>
>This code at least *builds* without errors. But I have no idea
>at all if it *works* as intended, but that wasn'ty you problem.
>*The* problem was that you tried to build absolute mode code
>using the linker (MPLINK) when relocatable mode code
>is expected.
>
>And Maarten faild to see *that*, even if his other
>comments might be OK...  :-)
>
>Jan-Erik.

Actually, it was you who failed to see that Maarten DID point out this very
error... :-)

Here is what he said.

>Again, expect comments on your use of absolute mode. This is also causing
>your linker problem: the linker is, as far as I know, only necessary in
>relocatable mode. You're in absolute mode, so linking is not necessary.


Regards,

Jim





2005\10\10@135546 by William Chops Westfield

face picon face

On Oct 10, 2005, at 9:28 AM, Aaron wrote:

>> Spent most of yesterday in MPASM tring to find a switch to turn off
>> case sensitivity. I read the MPASM manual front to back

> In MBLAB v6.22,
> Project Menu -> Build Options
> Select your filename and click the checkbox to "disable case
> sensitivity"
>
But that's NOT MPASM.

It's "mpasm /c-"   - perhaps you were looking for an internal keyword
instead of a command line option?  It's on "page 22" of the mpasm
manual  (DS33014g) (which my PDF reader says fall on page 37.)

BillW

2005\10\10@140349 by Jan-Erik Soderholm

face picon face
Maarten Hofman wrote :

> Jan-Erik wrote:
> >
> > And Maarten faild to see *that*, even if his other
> > comments might be OK... :-)
> >

> I did? I thought one of my comments was "Again, expect
> comments on your use of absolute mode..."


I missed that part.
I'm terribly sorry, forget my prev comment!

Regards,
Jan-Erik.



2005\10\10@141303 by Maarten Hofman

face picon face
>
> I missed that part.
> I'm terribly sorry, forget my prev comment!
>
>  It's quite ok... I should've stated it at the beginning instead of
somewhere among the listing. I am very glad to see your conversion to
relocatable code, it makes a very good example which I can use to convert a
fun program based on the PicKit 2 that I won in the StartNOW contest which I
wanted to share. A version using relocatable code would, in this case, be
superior.
Greetings,
Maarten Hofman.

2005\10\10@143712 by Jan-Erik Soderholm

face picon face
Maarten Hofman wrote :

> I am very glad to see your conversion to
> relocatable code, it makes a very good example...

Ahem, well, it was mainly some quick changes to get
the source throught MPASM/MPLINK without error(s).
I'm not sure I'd call it a *good* example... :-)

> A version using relocatable code would, in
> this case, be superior.

It's is, in general, yes.

Jan_Erik.



2005\10\10@164728 by Jinx

face picon face
> It's "mpasm /c-"  

If you have a Desktop shortcut for MPASM and run that, the
case sensitivity box is on the program's one and only window

2005\10\10@164733 by Jinx

face picon face
>  Ah, get ready for people commenting on the source code

Er, hi Maarten, the program sample (and comments) is mine.
Snipped from another project, slightly re-written (in a hurry) and
it did lose some of the features that you point out should be there.

I did say to Ed that there would be comment on absolute mode
etc. The program is simply so he can see a LED blinking. Worry
about how to do the next program later

> ; org 0x00 ;start address
> ; goto delay

*************************************************
Ed,  the goto delay MUST MUST MUST be changed to goto init
or the program will never work properly
*************************************************



2005\10\10@165036 by olin piclist

face picon face
Ed Edmondson wrote:
> 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=0x0000005e
> Errors    : 1

First, you should use CODE instead of ORG.  Second, don't use the Microchip
linker files.  They have some serious problems.  My free PIC development
environment comes with a bunch of linker files.  They will be in the SOURCE
> PIC directory after installation.  http://www.embedinc.com/pic.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

2005\10\10@180557 by Jan-Erik Soderholm

face picon face
Olin Lathrop wrote :

> First, you should use CODE instead of ORG.

Together with RES instead of CBLOCK and so on, yes.

> Second, don't use the Microchip linker files.
> They have some serious problems.  My free PIC
> development environment.....

Well now, here are some HO's of mine... :-)

First, personaly, I see no reason to not use the LNK
files as supplied with MPLAB when just trying to get
"my first program" to work.
They do work. And they do produce working HEX files.

There is very little reason for a beginner to try to dig
into your PIC development environment just to get a
simple "blink-a-LED" program to work, IMO.

Judging from earlier threads on this subject, it seems
that the actual meeing of "serious", to some degree
depends on your own standpoint and preferences.

It's very much a question about opinions, and IMHO,
a *beginner* is best helped *at this stage* by using
the LNK's as they are supplied with MPLAB as-is.

Best Regards,
Jan-Erik.
>



2005\10\10@204530 by olin piclist

face picon face
Jan-Erik Soderholm wrote:
> First, personaly, I see no reason to not use the LNK
> files as supplied with MPLAB when just trying to get
> "my first program" to work.

Exactly the reason the OP ran into.  They have a separate memory region from
0-4.  This is guaranteed to break for a simple program that starts at the
reset vector and just continues from there, like a first LED blinker should.

> They do work. And they do produce working HEX files.

Perhaps you haven't looked at them lately.  The latest ones generally do NOT
work right out of the box.

> There is very little reason for a beginner to try to dig
> into your PIC development environment just to get a
> simple "blink-a-LED" program to work, IMO.

I agree that my PIC development environment is too overwhelming for a
beginner.  That's why I only said to grab my linker files for now.  They
should work without modification for a simple LED blinker (and a lot of more
sophisticated stuff too).


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

2005\10\10@221559 by Chen Xiao Fan

face
flavicon
face
They are working right out of the box in the relocatable
mode if one follows the templates from
C:\Program Files\Microchip\MPASM Suite\Template\Object.

It is part of Microchip's fault not pointing to this
folder. For absolute mode the templates are in
C:\Program Files\Microchip\MPASM Suite\Template\Code.

It is also the problem of so many legacy codes around
the web. 16F877 itself is a legacy part (16f877A should
be the part to be used). Lots of the code are still dealing
with 16F84A.

I think the mentality of Microchip is that beginners
should still use the absolute mode code. I get this
impression from the PICkit 2 lessons. All the 12
lessons are using absolute mode. The older product
PICkit 1 comes with some lessons written in
relocatable mode and PICC Lite C examples. I guess
that they think it is too difficult for beginners
to blink an LED in PICkit 1 so they changed the
design in the LPC demo board which comes with the
PICkit 2/Demo board package.


Regards,
Xiaofan

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...