![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hello All Currently in the process of learning ASM and trying to use MPLAB to do so. But I'm having trouble even getting an LED to blink using a 16F876. No matter what I try nothing happens. Think its my config and "inc" settings causing the issuse. Recieve errors when BUILDING..... Error[113] C:\PIC\BLINK 16F876-B.ASM 8 : Symbol not previously defined (cmcon) Error[113] C:\PIC\BLINK 16F876-B.ASM 15 : Symbol not previously defined (trisc) Error[113] C:\PIC\BLINK 16F876-B.ASM 16 : Symbol not previously defined (status) Error[113] C:\PIC\BLINK 16F876-B.ASM 17 : Symbol not previously defined (portc) Error[113] C:\PIC\BLINK 16F876-B.ASM 20 : Symbol not previously defined (portc) Skipping link step. Not all sources built successfully. BUILD FAILED: Tue Jan 10 19:10:57 2006 Will someone show me the right way to set the _config and "inc" settings for a 16F876 using 10Mhz. If possible maybe a small piece of code that blinks an LED. Thanks any help or ideas in advance Gordon | |
| |
| | (permalink) |
| You are probably missing an include file. It has all the definitions you need (porta, trisa and so on). Make sure that you import the correct file, see example image. PS: The Linker file is not necessary, but I find it very useful. Don't include it if it causes problems to you...
__________________ "I share, thus I am" Jay.slovak Read this! ICD2 Clone Best PIC/DsPIC Bootloader Read my Inchworm ICD2 review! | |
| |
| | (permalink) |
| In addition to Jay's suggestion, you can include the location of the "include_file", a PIC specific file with the file extension .inc (p16F876.inc in your case) into your ASM source file like one of the followings, so MPLAB IDE can find it during compiling: Code:
Syntax
Preferred:
#include include_file
#include "include_file"
#include <include_file>
Supported:
include include_file
include "include_file"
include <include_file>
Simple Example
#include p18f452.inc ;standard include file
#include "c:\Program Files\mydefs.inc" ;user defines This is all clearly described in the hlpMpasmAsm.chm help file as part of the MPLAB IDE installation. Looks under the MPASM Assembler/Directives branch of the help file for details.
__________________ L.Chung | |
| |
| | (permalink) |
| Hi Guys Thanks for your help and tips. Well I fianlly found the header files. Still no luck. Reciecving... Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\Program Files\MPLAB IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F876 "Test Header.asm" /l"Test Header.lst" /e"Test Header.err" /o"Test Header.o" Warning[205] C:\PIC\TEST HEADER.ASM 1 : Found directive in column 1. (list) Error[108] C:\PIC\TEST HEADER.ASM 3 : Illegal character (0) Message[302] C:\PIC\TEST HEADER.ASM 12 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\PIC\TEST HEADER.ASM 13 : Register in operand not in bank 0. Ensure that bank bits are correct. Skipping link step. Not all sources built successfully. BUILD FAILED: Wed Jan 11 13:40:31 2006 What am I doing wrong. This is getting real frustrating. I know its something simple but what it is I don't know. | |
| |
| | (permalink) |
| Hello again Heres my code, for some unknown reason my computer will not let me post the code inside the code box. Sorry for that. LIST P=PIC16F876 #include "P16F876.INC" _config, _WDT_OFF, _LVP_OFF, _PWRTE_ON, _CP_OFF, BODEN_OFF, _DEBUG_OFF org 0 nop nop bsf H'0003 ;"status" label gives error message bcf trisb, 4 bcf H'0003 start bcf portb, 4 nop nop ;short pause nop nop nop bsf portb, 4 goto start END After trying to BUILD this the following error is displayed Error[129] C:\PIC\BLINK.ASM 1 : Expected (END) Any thought about this? L.Chung, thanks for the hlpMpasmAsm.chm tip. Took a while, but it was finally found. | |
| |
| | (permalink) | ||
| Quote:
To change bank, you use: Code: BSF status,RP0 ;bsf needs two arguments Code: start bcf portb, 4
nop
nop ;short pause
nop
nop
nop
bsf portb, 4
goto start Quote:
__________________ L.Chung | |||
| |
| | (permalink) |
| Thank you for the reply. After playing around with MPLAB for awhile, finally got my code working. Do not recall the "END" directive being in the 1st column, but some how got around this. Perhaps a double check will make more sense of this. Thanks for tips and help Gordon | |
| |
| | (permalink) |
| I use always for heaxadecimal values this notation: H'04' Please note the apostrophe at the end.
__________________ Agustín Tomás In theory, there is no difference between theory and practice. In practice, however, there is. | |
| |