![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I am using 16F84 microchip,
Code:
;EQUATES SECTION TMR0 EQU 1 STATUS EQU 3 PORTA EQU 5 POTRB EQU 6 TRISA EQU 85H TRISB EQU 86H OPTION_R EQU 81H ZEROBIT EQU 2 COUNT EQU 0CH ;****************************************************** LIST P=16F84; ORG 0; GOTO start; ;****************************************************** ;CONFIGURATION BITS __CONFIG H'3FF0' ;********************************************************* ;SUBROUTINES SECTION ;1 SECOND DELAY DELAY1 CLFR TMR0 LOOPA MOVF TMR0,W SUBLW .32 BTFSS STATUS, ZEROBIT GOTO LOOPA RETLW 0 ;0.5 SECOND DELAY DELAYP5 CLFR TMR0 LOOPB MOVF TMR0,W SUBLW .16 BTFSS STATUS, ZEROBIT GOTO LOOPB RETLW 0 ;***************************************************************** ;CONFIGURATION SECTION start BSF STATUS,5 MOVLW B'00011111' MOVWF TRISA MOVLW B'00000000' MOVWF TRISB MOVLW B'00000111' MOVWF OPTION_R BCF STATUS,5 CLRF PORTA CLRF PORTB ;********************************************************************** ;PROGRAM STARTS NOW END Using Mplab i press control+F10 and these are the error that i faced 27error! Code:
----------------------------------------------------------------------
Debug build of project `C:\Documents and Settings\Hisham\Desktop\Spring 2008\Design 2\Design II modified\Open loop\Test.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Thu Mar 27 20:58:34 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84 "C:\Documents and Settings\Hisham\Desktop\Hesham.asm" /l"Hesham.lst" /e"Hesham.err" /o"Hesham.o" /d__DEBUG=1
Warning[205] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 14 : Found directive in column 1. (LIST)
Warning[205] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 15 : Found directive in column 1. (ORG)
Warning[203] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 16 : Found opcode in column 1. (GOTO)
Warning[205] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 22 : Found directive in column 1. (__CONFIG)
Error[122] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 30 : Illegal opcode (CLFR)
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 31 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 32 : Executable code and data must be defined in an appropriate section
Error[128] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 33 : Missing argument(s)
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 33 : Executable code and data must be defined in an appropriate section
Warning[207] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 34 : Found label after column 1. (ZEROBIT)
Error[115] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 34 : Duplicate label ("ZEROBIT" or redefining symbol that cannot be redefined)
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 35 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 36 : Executable code and data must be defined in an appropriate section
Error[122] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 39 : Illegal opcode (CLFR)
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 40 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 41 : Executable code and data must be defined in an appropriate section
Error[128] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 42 : Missing argument(s)
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 42 : Executable code and data must be defined in an appropriate section
Warning[207] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 43 : Found label after column 1. (ZEROBIT)
Error[115] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 43 : Duplicate label ("ZEROBIT" or redefining symbol that cannot be redefined)
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 44 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 45 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 51 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 52 : Executable code and data must be defined in an appropriate section
Message[302] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 53 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 53 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 54 : Executable code and data must be defined in an appropriate section
Message[302] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 55 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 55 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 56 : Executable code and data must be defined in an appropriate section
Message[302] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 57 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 57 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 58 : Executable code and data must be defined in an appropriate section
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 59 : Executable code and data must be defined in an appropriate section
Error[113] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 60 : Symbol not previously defined (PORTB)
Error[152] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 60 : Executable code and data must be defined in an appropriate section
Warning[205] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 67 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Documents and Settings\Hisham\Desktop\Spring 2008\Design 2\Design II modified\Open loop\Test.mcp' failed.
Preprocessor symbol `__DEBUG' is defined.
Thu Mar 27 20:58:35 2008
FAILED
----------------------------------------------------------------------
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
http://www.ghmicro.com/index.php/pic...84-simple-demo
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
||
|
|
|
|
|
(permalink) |
|
Woops. I just noticed that my schematic didn't match the photos. It would work just fine, but might confuse you since they didn't match. I just changed it to match.
So if you just looked at it or downloaded it, refresh your browser by going to the page and hitting F5 and go look at it or download it again.
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 27th March 2008 at 05:18 PM. |
|
|
|
|
|
|
(permalink) |
|
And here's your code cleaned up and with many corrections. There were misspellings and indentation errors and things that were done just plain strangely. It now assembles with no errors. Ignore those two warnings. They're taken care of in the code, but it warns you anyway.
By the way, this code does nothing yet. Just sets a few registers and falls into empty memory. Then it runs thru the nops (empty memory) and rolls over and starts again... and goes again and again and again, doing nothing. Code:
LIST P=PIC16F84 #INCLUDE "P16F84.INC" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC cblock 0x0c COUNT endc ZEROBIT EQU 2 org 0 goto start ;SUBROUTINES SECTION ;1 SECOND DELAY DELAY1 clrf TMR0 LOOPA movf TMR0,W sublw .32 btfss STATUS,ZEROBIT goto LOOPA retlw 0 ;0.5 SECOND DELAY DELAYP5 clrf TMR0 LOOPB movf TMR0,W sublw .16 btfss STATUS,ZEROBIT goto LOOPB retlw 0 ;********************* ;CONFIGURATION SECTION start banksel TRISA ;bank 1 movlw B'00011111' movwf TRISA movlw B'00000000' movwf TRISB movlw B'00000111' movwf OPTION_REG banksel PORTA ;bank 0 clrf PORTA clrf PORTB ;PROGRAM STARTS NOW end
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 27th March 2008 at 06:16 PM. |
|
|
|
|
|
|
(permalink) |
|
Thank alot, Most of the error disapear thanks alot.
Code:
---------------------------------------------------------------------- Debug build of project `C:\Documents and Settings\Hisham\Desktop\Spring 2008\Design 2\Design II modified\Open loop\Test.mcp' started. Preprocessor symbol `__DEBUG' is defined. Thu Mar 27 21:47:33 2008 ---------------------------------------------------------------------- Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84 "C:\Documents and Settings\Hisham\Desktop\Hesham.asm" /l"Hesham.lst" /e"Hesham.err" /o"Hesham.o" /d__DEBUG=1 Message[302] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 38 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\DOCUMENTS AND SETTINGS\HISHAM\DESKTOP\HESHAM.ASM 40 : Register in operand not in bank 0. Ensure that bank bits are correct. Executing: "C:\Program Files\Microchip\MPASM Suite\MPLink.exe" "..\..\..\..\..\..\..\Program Files\Microchip\MPASM Suite\LKR\16f84.lkr" "Hesham.o" /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"Test.cof" /M"Test.map" /W MPLINK 4.15, Linker Copyright (c) 2007 Microchip Technology Inc. Error - section '.org_0' can not fit the absolute section. Section '.org_0' start=0x00000000, length=0x0000002e Errors : 1 Link step failed. ---------------------------------------------------------------------- Debug build of project `C:\Documents and Settings\Hisham\Desktop\Spring 2008\Design 2\Design II modified\Open loop\Test.mcp' failed. Preprocessor symbol `__DEBUG' is defined. Thu Mar 27 21:47:35 2008 FAILED ---------------------------------------------------------------------- |
|
|
|
|
|
|
(permalink) |
|
hi,
I would suggest you create a folder on your hard drive thats dedicated to your assembler output. This will make your error messages easier to read and the assembled files more accessible. You should add near the top of your program. errorlevel -302 this will stop the 'Bank' warning messages
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Code:
Release build of project `C:\MCU\16F84A\blinky\blinky.mcp' started. Thu Mar 27 10:57:34 2008 ---------------------------------------------------------------------- Make: The target "C:\MCU\16F84A\blinky\uae_test.o" is out of date. Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84 "uae_test.asm" /l"uae_test.lst" /e"uae_test.err" Message[302] C:\MCU\16F84A\BLINKY\UAE_TEST.ASM 38 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\MCU\16F84A\BLINKY\UAE_TEST.ASM 40 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\MCU\16F84A\BLINKY\UAE_TEST.ASM 42 : Register in operand not in bank 0. Ensure that bank bits are correct. Loaded C:\MCU\16F84A\blinky\uae_test.cod. ---------------------------------------------------------------------- Release build of project `C:\MCU\16F84A\blinky\blinky.mcp' succeeded. Thu Mar 27 10:57:35 2008 ---------------------------------------------------------------------- BUILD SUCCEEDED
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
||
|
|
|
|
|
(permalink) | |
|
Quote:
Code:
LIST P=PIC16F84 #INCLUDE "P16F84.INC" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC errorlevel -302 cblock 0x0c COUNT endc ZEROBIT EQU 2 org 0 goto start ;SUBROUTINES SECTION ;1 SECOND DELAY DELAY1 clrf TMR0 LOOPA movf TMR0,W sublw .32 btfss STATUS,ZEROBIT goto LOOPA retlw 0 ;0.5 SECOND DELAY DELAYP5 clrf TMR0 LOOPB movf TMR0,W sublw .16 btfss STATUS,ZEROBIT goto LOOPB retlw 0 ;********************* ;CONFIGURATION SECTION start banksel TRISA ;bank 1 movlw B'00011111' movwf TRISA movlw B'00000000' movwf TRISB movlw B'00000111' movwf OPTION_REG banksel PORTA ;bank 0 clrf PORTA clrf PORTB ;PROGRAM STARTS NOW end Code:
Release build of project `C:\MCU\16F84A\blinky\blinky.mcp' started. Thu Mar 27 11:00:46 2008 ---------------------------------------------------------------------- Make: The target "C:\MCU\16F84A\blinky\uae_test.o" is out of date. Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84 "uae_test.asm" /l"uae_test.lst" /e"uae_test.err" Loaded C:\MCU\16F84A\blinky\uae_test.cod. ---------------------------------------------------------------------- Release build of project `C:\MCU\16F84A\blinky\blinky.mcp' succeeded. Thu Mar 27 11:00:47 2008 ---------------------------------------------------------------------- BUILD SUCCEEDED
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 27th March 2008 at 06:16 PM. |
||
|
|
|
|
|
(permalink) |
|
I did as ericgibbs told me, I change the file path.
Code:
Debug build of project `D:\Openloop\test.mcp' started. Preprocessor symbol `__DEBUG' is defined. Thu Mar 27 22:18:04 2008 ---------------------------------------------------------------------- Clean: Deleting intermediary and output files. Clean: Deleted file "D:\Openloop\test.mcs". Clean: Done. Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84 "C:\Documents and Settings\Hisham\Desktop\hesham2.asm" /l"hesham2.lst" /e"hesham2.err" /o"hesham2.o" /d__DEBUG=1 Executing: "C:\Program Files\Microchip\MPASM Suite\MPLink.exe" "C:\Program Files\Microchip\MPASM Suite\LKR\16f84.lkr" "hesham2.o" /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"test.cof" /M"test.map" /W MPLINK 4.15, Linker Copyright (c) 2007 Microchip Technology Inc. Error - section '.org_0' can not fit the absolute section. Section '.org_0' start=0x00000000, length=0x0000002e Errors : 1 Link step failed. ---------------------------------------------------------------------- Debug build of project `D:\Openloop\test.mcp' failed. Preprocessor symbol `__DEBUG' is defined. Thu Mar 27 22:18:05 2008 FAILED I am using linker file 16F84.lkr |
|
|
|
|
|
|
(permalink) | |
|
Quote:
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
||
|
|
|
|
|
(permalink) |
|
OMG, Problem solved i can't belive it.
I assembled for the first time. OMG. Thanks everyone I just removed the linker and it worked thanks alot. |
|
|
|
|
|
|
(permalink) |
|
Thanks everyone specially "futz" For helping me around.
I am looking for a way to improve these codes Code:
LIST P=PIC16F84 #INCLUDE "P16F84.INC" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC errorlevel -302 cblock 0x0c COUNT endc ZEROBIT EQU 2 org 0 goto start; ;SUBROUTINES SECTION ;1 SECOND DELAY DELAY1 clrf TMR0 LOOPA movf TMR0,W sublw .32 btfss STATUS,ZEROBIT goto LOOPA retlw 0 ;0.5 SECOND DELAY DELAYP5 clrf TMR0 LOOPB movf TMR0,W sublw .16 btfss STATUS,ZEROBIT goto LOOPB retlw 0 ;********************* ;CONFIGURATION SECTION start banksel TRISA ;bank 1 movlw B'00000010' movwf TRISA movlw B'00000000' movwf TRISB movlw B'00000111' movwf OPTION_REG banksel PORTA ;bank 0 clrf PORTA clrf PORTB ;program starts here begin bsf PORTB,0 call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second bcf PORTB,0; call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second call DELAY1; wait 1second goto begin end |
|
|
|
|
|
|
(permalink) | |
|
Quote:
The d1, d2, d3, d4 variables go in the cblock. There are better ways, but I use it all the time. It's quick and easy, and I don't have to think too much about it.
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
||
|
|
|
|
|
(permalink) |
|
Great way and i will thanks you all day.
Code:
LIST P=PIC16F84 #INCLUDE "P16F84.INC" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC errorlevel -302 cblock 0x0c COUNT endc ZEROBIT EQU 2 org 0 goto start; ;SUBROUTINES SECTION ;1 SECOND DELAY DELAY1 clrf TMR0 LOOPA movf TMR0,W sublw .32 btfss STATUS,ZEROBIT goto LOOPA retlw 0 ;0.5 SECOND DELAY DELAYP5 clrf TMR0 LOOPB movf TMR0,W sublw .16 btfss STATUS,ZEROBIT goto LOOPB retlw 0 ; Delay = 60 seconds ; Clock frequency = 0.032 MHz ; Actual delay = 60 seconds = 480000 cycles ; Error = 0 % cblock d1 d2 d3 endc ;479995 cycles movlw 0xDA movwf d1 movlw 0x0C movwf d2 movlw 0x02 movwf d3 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_0 ;5 cycles goto $+1 goto $+1 nop ;********************* ;CONFIGURATION SECTION start banksel TRISA ;bank 1 movlw B'00000010' movwf TRISA movlw B'00000000' movwf TRISB movlw B'00000111' movwf OPTION_REG banksel PORTA ;bank 0 clrf PORTA clrf PORTB ;program starts here begin bsf PORTB,0 bcf PORTB,0; goto begin end |
|
|
|
|
|
|
(permalink) |
|
Dude, don't make a second cblock. Put the variables in the first one.
Like this: Code:
LIST P=PIC16F84 #INCLUDE "P16F84.INC" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC errorlevel -302 cblock 0x0c COUNT,d1,d2,d3 endc ZEROBIT EQU 2 org 0 goto start; To call the delay, you have to put a label at the beginning of the delay routine and a return at the end. Then use Code:
call delay The delay routine would look like Code:
delay movlw 0xDA movwf d1 movlw 0x0C movwf d2 movlw 0x02 movwf d3 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_0 return
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 27th March 2008 at 08:36 PM. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Visual Basic for Electronics Engineering Applications | ThermalRunaway | Electronic Books | 22 | 27th August 2008 07:40 PM |
| It is BASIC or is it BABL | 3v0 | Micro Controllers | 22 | 7th May 2007 02:08 PM |
| free pic basic complier | dstich | Micro Controllers | 7 | 1st August 2006 07:13 PM |
| Assembly to Basic Coding | AZdave | Micro Controllers | 3 | 23rd January 2005 02:27 PM |
| PIC basic and Basic stamp | Cyborg | Micro Controllers | 5 | 21st April 2004 08:44 AM |