OT: PIC MPLAB problem (long lines)

Linker barfed for no reason i know of.

Warning[215] D:\COMMON\ELF\DTMF4.ASM 1 : Processor superseded by command line. Verify processor symbol. Message[305] D:\COMMON\ELF\DTMF4.ASM 405 : Using default destination of

1 (file). Message[305] D:\COMMON\ELF\DTMF4.ASM 411 : Using default destination of 1 (file). Message[302] D:\COMMON\ELF\DTMF4.ASM 647 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] D:\COMMON\ELF\DTMF4.ASM 653 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] D:\COMMON\ELF\DTMF4.ASM 657 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] D:\COMMON\ELF\DTMF4.ASM 663 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] D:\COMMON\ELF\DTMF4.ASM 675 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] D:\COMMON\ELF\DTMF4.ASM 683 : Register in operand not in bank 0. Ensure that bank bits are correct. **

---------------------------------------------------------------------- Debug build of project `D:\COMMON\ELF\DTMF4.mcp' started. Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01 Preprocessor symbol `__DEBUG' is defined. Wed Aug 19 23:20:01 2015

---------------------------------------------------------------------- Make: The target "D:\COMMON\ELF\dtmf4.o" is up to date. Make: The target "D:\COMMON\ELF\dtmf4.cof" is out of date. Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p16F648A "dtmf4.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"dtmf4.cof" /M"dtmf4.map" /W /x MPLINK 4.30.01, Linker Copyright (c) 2009 Microchip Technology Inc. Error - section '.org_7' can not fit the absolute section. Section '.org_7' start=0x00000e00, length=0x00000204 Errors : 1 ^---** I SEE NO REASON FOR THIS**

Link step failed.

---------------------------------------------------------------------- Debug build of project `D:\COMMON\ELF\DTMF4.mcp' failed. Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01 Preprocessor symbol `__DEBUG' is defined. Wed Aug 19 23:20:02 2015

---------------------------------------------------------------------- BUILD FAILED

** Parts of output listing (edited out blank lines):

0EFE 3411 04951 RETLW 0x11

0EFF 3411 04953 RETLW 0x11 0F00 3412 04955 RETLW 0x12 0F01 3412 04957 RETLW 0x12 04959 ; ==============================================

MEMORY USAGE MAP ('X' = Used, '-' = Unused)

0000 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXX--------- 0200 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0240 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0280 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 02C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0300 : XX-------------- ---------------- ---------------- ---------------- 0500 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0540 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0580 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 05C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0600 : XX-------------- ---------------- ---------------- ---------------- 0800 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0840 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0880 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 08C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0900 : XX-------------- ---------------- ---------------- ---------------- 0B00 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0B40 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0B80 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0BC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0C00 : XX-------------- ---------------- ---------------- ---------------- 0E00 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0E40 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0E80 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0EC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0F00 : XX-------------- ---------------- ---------------- ---------------- 2000 : XXXX---X-------- ---------------- ---------------- ----------------

All other memory blocks unused.

Program Memory Words Used: 1473 Program Memory Words Free: 2623

Errors : 0 Warnings : 1 reported, 0 suppressed Messages : 8 reported, 0 suppressed

** Part of linker listing: MPLINK 4.30.01, Linker Linker Error Map File - Created Wed Aug 19 23:20:02 2015

*Warning* - This is only a partial map file due to a link time error. Only sections which were allocated prior to the error are shown below.

CODEPAGES: Memory Start End Section Address Size(Bytes) --------- --------- --------- --------- --------- --------- page 0x0000 0x0eff .org_0 0x0000 0x0000 .org_1 0x0000 0x0008 .org_2 0x0004 0x0166 .org_3 0x0200 0x0204 .org_4 0x0500 0x0204 .org_5 0x0800 0x0204 .org_6 0x0b00 0x0204 ** WHERE IS ORG_7, ADDR 0x0E00 SIZE 0x0204 **

Reply to
Robert Baer
Loading thread data ...

Are you using the correct linker script?

Cheer

Reply to
Martin Riddle

Could be that 0x0E00 + 0x0204 puts it beyond the memory size limit for that device? Either reduce the waveform table size or go to a bigger pic.

piglet

Reply to
piglet

I believe that its the debugger, Its placed in the upper memory area. There is a linker script for the debugger.

Cheer

Reply to
Martin Riddle

Will reduce the table sizes to give a (reasonable?) gap. How do i find out that debugger size and location?

** I have a nasty Q about code.. MOVLW wav_tab ;; 0x02 here to W (for 1st table) MOVWF PCLATH ;; copy to high part of W for "page" offset ;; I use "page" because I don't completely understand "bank" MOVF inp_val,W ;; ph1hi --> W (supposedly offset to table) BTFSC PORTB,inp_pin ;; skip if switch is closed/ 0 => enabled MOVLW 0 ; force first array element when disabled CALL lookup ; ie: wave1 Now, the idea is that the accumulator (NON-intuitive and rather confusing name of "W") is zero if switch is open and equal to ph1hi if closed. Well all of that work to "set" W is not useful as W is not used as the program continues.. ORG 0x0200 wave1: ; Sinusoid at maximum amplitude (255) RETLW 0x80 RETLW 0x83 etc.. TWO problems,going by the book: 1) value in "W" is not used in table wave1 as the first instruction is to over-write it with a fixed value; 2) there is nothing that changes the pointer into the table, so the intent of the switch test is lost and no scanning thru the table is done.

So,a mod: ORG 0x0200 wave1: ; Sinusoid at maximum amplitude (255) ADDWF PCL,W ;; add comprehensible accumulator to program counter RETLW 0x80 ; note W zero as switch open means 0x00 RETLW 0x83 ; note if W not zero means ph1hi is offset for lookup etc..

BY THE BOOK, the above should be required to make the scan and switch option work as intended. BY THE BOOK,the first the program cannot work as intended. But.. I am told that it does... Nasty question, how?

Thanks.

Reply to
Robert Baer

W is for "working" register, its usage goes right back to the 1950s and possibley earlier, it may even predate the term accumulator.

piglet

Reply to
piglet

There are two "banks" to consider in the PIC; there is the program counter PC LATCH HIGH and there are the completely differenr banksel bits in the status word that select RAM or special purpose i/o locations. You are probably right to use the word "page" for one and the word "bank" for the other. I find the PIC datasheets are precise but sometimes need re-reading!

piglet

Reply to
piglet

Have you checked what is going on at the label "lookup" ? Often the entry value in W is written to the program counter or added to PCL to make a computed jump into a table.

piglet

Reply to
piglet

'W'orking register. Good as any other name.

Now where is the subroutine starting at the label lookup: ????

--sp

--
Best regards,  
Spehro Pefhany 
Amazon link for AoE 3rd Edition:            http://tinyurl.com/ntrpwu8 
Microchip link for 2015 Masters in Phoenix: http://tinyurl.com/l7g2k48
Reply to
Spehro Pefhany

CALL wave1

I don't see it either.

Cheers

Reply to
Martin Riddle

Ahh. Thanks.

Reply to
Robert Baer

Sounds worse than the "good old" IBM PC segment addressing mess. Thanks.

Reply to
Robert Baer

So far, i cannot do any debugging (need a special header board that MicroChip is busy not selling). So, all i can do is go by what is in their book; i read the CALL as being exactly that; the explanation sez no more. Your suggested interpretation would do the (complete) job. Following the ASM code only goes so far in that exact code interpretation is a must.

Thanks for saying "often..". Gives hope.

Reply to
Robert Baer

Look at the added comment in CALL lookup ; ie: wave1 Code was generated via a macro.."lookup" is name used in macro def and "wave1" is the arg used in this case.

Reply to
Robert Baer

Not in the code you posted, of course. Are you sure it's not more than just a equate?

See this:

formatting link

Another reason to use 18F or 24F parts - they have table read SFRs and (you can get built-in debugging hardware. retlw on midrange MCUs wastes 6 bits per 8-bit table entry.

--sp

--
Best regards,  
Spehro Pefhany 
Amazon link for AoE 3rd Edition:            http://tinyurl.com/ntrpwu8 
Microchip link for 2015 Masters in Phoenix: http://tinyurl.com/l7g2k48
Reply to
Spehro Pefhany

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.