A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
Problem in assembling - chadalawadabalakrishna - Apr 17 11:18:53 2008
I use Microchip MPASM to assemble. But it doesn't accept keywords like
PORTA etc. Kindly inform me if there is any error in the logic of the
program:
#include
ORG 00H
MOVLW b'00000000'
TRIS PORTB
MOVLW b'00000011'
TRIS PORTA
MOVF PORTA,0
SUBLW 00000000
BTFSS STATUS,2
GOTO LOOP1
MOVF PORTA,0
SUBLW 00000001
BTFSS STATUS,2
GOTO LOOP2
MOVF PORTA,0
SUBLW 00000010
BTFSS STATUS,2
GOTO LOOP3
MOVF PORTA,0
SUBLW 00000011
BTFSS STATUS,2
GOTO LOOP4
LOOP1:
MOVLW 00000000
MOVWF PORTB
END
LOOP2:
MOVLW 00000001
MOVWF PORTB
END
LOOP2:
MOVLW 00000010
MOVWF PORTB
END
LOOP3:
MOVLW 00000011
MOVWF PORTB
END
error file:
Message[301] C:\PROGRA~1\MPLAB\P16F84A.INC 35 : MESSAGE:
(Processor-header file mismatch. Verify selected processor.)
Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 : Found directive in
column 1. (ORG)
Error[147] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 : Directive not allowed
when generating an object file (ORG)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 6 : Illegal opcode (b)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 7 : Illegal opcode (PORTB)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 9 : Illegal opcode (b)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 10 : Illegal opcode (PORTA)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 12 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 13 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 14 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 15 : Illegal opcode (LOOP1)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 17 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 18 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 19 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 20 : Illegal opcode (LOOP2)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 22 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 23 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 24 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 25 : Illegal opcode (LOOP3)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 27 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 28 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 29 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 30 : Illegal opcode (LOOP4)
Error[150] C:\DOCUME~1\BALU\DESKTOP\1.ASM 32 : Labels must be
defined in a code or data section when making an object file
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 33 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 34 : Illegal opcode (PORTB)
Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 35 : Found directive in
column 1. (END)
Error[131] C:\DOCUME~1\BALU\DESKTOP\1.ASM 36 : Processor type is
undefined
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com ) Re: Problem in assembling - Dennis Clark - Apr 17 11:48:53 2008
Please read the MPLAB getting started manuals. Column 1 is reserved for
labels, you put assembly instructions at the next tab stop.
DLC
> I use Microchip MPASM to assemble. But it doesn't accept keywords like
> PORTA etc. Kindly inform me if there is any error in the logic of the
> program:
>
> #include
ORG 00H
>
> MOVLW b'00000000'
> TRIS PORTB
>
> MOVLW b'00000011'
> TRIS PORTA
>
> MOVF PORTA,0
> SUBLW 00000000
> BTFSS STATUS,2
> GOTO LOOP1
>
> MOVF PORTA,0
> SUBLW 00000001
> BTFSS STATUS,2
> GOTO LOOP2
>
> MOVF PORTA,0
> SUBLW 00000010
> BTFSS STATUS,2
> GOTO LOOP3
>
> MOVF PORTA,0
> SUBLW 00000011
> BTFSS STATUS,2
> GOTO LOOP4
>
> LOOP1:
> MOVLW 00000000
> MOVWF PORTB
> END
>
> LOOP2:
> MOVLW 00000001
> MOVWF PORTB
> END
>
> LOOP2:
> MOVLW 00000010
> MOVWF PORTB
> END
>
> LOOP3:
> MOVLW 00000011
> MOVWF PORTB
> END
>
> error file:
> Message[301] C:\PROGRA~1\MPLAB\P16F84A.INC 35 : MESSAGE:
> (Processor-header file mismatch. Verify selected processor.)
> Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 : Found directive in
> column 1. (ORG)
> Error[147] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 : Directive not allowed
> when generating an object file (ORG)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 6 : Illegal opcode (b)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 7 : Illegal opcode (PORTB)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 9 : Illegal opcode (b)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 10 : Illegal opcode (PORTA)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 12 : Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 13 : Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 14 : Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 15 : Illegal opcode (LOOP1)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 17 : Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 18 : Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 19 : Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 20 : Illegal opcode (LOOP2)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 22 : Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 23 : Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 24 : Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 25 : Illegal opcode (LOOP3)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 27 : Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 28 : Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 29 : Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 30 : Illegal opcode (LOOP4)
> Error[150] C:\DOCUME~1\BALU\DESKTOP\1.ASM 32 : Labels must be
> defined in a code or data section when making an object file
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 33 : Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 34 : Illegal opcode (PORTB)
> Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 35 : Found directive in
> column 1. (END)
> Error[131] C:\DOCUME~1\BALU\DESKTOP\1.ASM 36 : Processor type is
> undefined
>
> ------------------------------------
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )Re: Problem in assembling - Arazi Kdin - Apr 28 19:28:11 2008
You need to declare PORTA refers to HEX,BINARY,DECIMAL
number
eg.
PORTA equ 05H
Good luck
--- chadalawadabalakrishna
wrote:
> I use Microchip MPASM to assemble. But it doesn't
> accept keywords like
> PORTA etc. Kindly inform me if there is any error in
> the logic of the
> program:
>
> #include ORG 00H
>
> MOVLW b'00000000'
> TRIS PORTB
>
> MOVLW b'00000011'
> TRIS PORTA
>
> MOVF PORTA,0
> SUBLW 00000000
> BTFSS STATUS,2
> GOTO LOOP1
>
> MOVF PORTA,0
> SUBLW 00000001
> BTFSS STATUS,2
> GOTO LOOP2
>
> MOVF PORTA,0
> SUBLW 00000010
> BTFSS STATUS,2
> GOTO LOOP3
>
> MOVF PORTA,0
> SUBLW 00000011
> BTFSS STATUS,2
> GOTO LOOP4
>
> LOOP1:
> MOVLW 00000000
> MOVWF PORTB
> END
>
> LOOP2:
> MOVLW 00000001
> MOVWF PORTB
> END
>
> LOOP2:
> MOVLW 00000010
> MOVWF PORTB
> END
>
> LOOP3:
> MOVLW 00000011
> MOVWF PORTB
> END
>
> error file:
> Message[301] C:\PROGRA~1\MPLAB\P16F84A.INC 35 :
> MESSAGE:
> (Processor-header file mismatch. Verify selected
> processor.)
> Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 :
> Found directive in
> column 1. (ORG)
> Error[147] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 :
> Directive not allowed
> when generating an object file (ORG)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 6 :
> Illegal opcode (b)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 7 :
> Illegal opcode (PORTB)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 9 :
> Illegal opcode (b)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 10 :
> Illegal opcode (PORTA)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 12 :
> Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 13 :
> Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 14 :
> Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 15 :
> Illegal opcode (LOOP1)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 17 :
> Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 18 :
> Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 19 :
> Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 20 :
> Illegal opcode (LOOP2)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 22 :
> Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 23 :
> Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 24 :
> Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 25 :
> Illegal opcode (LOOP3)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 27 :
> Illegal opcode (PORTA)
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 28 :
> Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 29 :
> Illegal opcode (STATUS)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 30 :
> Illegal opcode (LOOP4)
> Error[150] C:\DOCUME~1\BALU\DESKTOP\1.ASM 32 :
> Labels must be
> defined in a code or data section when making an
> object file
> Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 33 :
> Illegal character (0)
> Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 34 :
> Illegal opcode (PORTB)
> Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 35 :
> Found directive in
> column 1. (END)
> Error[131] C:\DOCUME~1\BALU\DESKTOP\1.ASM 36 :
> Processor type is
> undefined
>
Send instant messages to your online friends http://uk.messenger.yahoo.com
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )Re: Problem in assembling - Guy Martin - Apr 28 19:28:47 2008
You have to tell it that when you write PORTA you mean register 5
use:
#define PORTA 0x05
at the start of your prog
Not sure about your loop statements. I normally put loop statements in col 1, operator on
col 2 etc
loop1 movlw 0
movwf portb
so on
Cheers, Guy
----- Original Message -----
From: chadalawadabalakrishna
To: p...@yahoogroups.com
Sent: Tuesday, March 18, 2008 8:09 AM
Subject: [piclist] Problem in assembling
I use Microchip MPASM to assemble. But it doesn't accept keywords like
PORTA etc. Kindly inform me if there is any error in the logic of the
program:
#include
ORG 00H
MOVLW b'00000000'
TRIS PORTB
MOVLW b'00000011'
TRIS PORTA
MOVF PORTA,0
SUBLW 00000000
BTFSS STATUS,2
GOTO LOOP1
MOVF PORTA,0
SUBLW 00000001
BTFSS STATUS,2
GOTO LOOP2
MOVF PORTA,0
SUBLW 00000010
BTFSS STATUS,2
GOTO LOOP3
MOVF PORTA,0
SUBLW 00000011
BTFSS STATUS,2
GOTO LOOP4
LOOP1:
MOVLW 00000000
MOVWF PORTB
END
LOOP2:
MOVLW 00000001
MOVWF PORTB
END
LOOP2:
MOVLW 00000010
MOVWF PORTB
END
LOOP3:
MOVLW 00000011
MOVWF PORTB
END
error file:
Message[301] C:\PROGRA~1\MPLAB\P16F84A.INC 35 : MESSAGE:
(Processor-header file mismatch. Verify selected processor.)
Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 : Found directive in
column 1. (ORG)
Error[147] C:\DOCUME~1\BALU\DESKTOP\1.ASM 4 : Directive not allowed
when generating an object file (ORG)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 6 : Illegal opcode (b)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 7 : Illegal opcode (PORTB)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 9 : Illegal opcode (b)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 10 : Illegal opcode (PORTA)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 12 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 13 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 14 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 15 : Illegal opcode (LOOP1)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 17 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 18 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 19 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 20 : Illegal opcode (LOOP2)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 22 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 23 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 24 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 25 : Illegal opcode (LOOP3)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 27 : Illegal opcode (PORTA)
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 28 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 29 : Illegal opcode (STATUS)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 30 : Illegal opcode (LOOP4)
Error[150] C:\DOCUME~1\BALU\DESKTOP\1.ASM 32 : Labels must be
defined in a code or data section when making an object file
Error[108] C:\DOCUME~1\BALU\DESKTOP\1.ASM 33 : Illegal character (0)
Error[122] C:\DOCUME~1\BALU\DESKTOP\1.ASM 34 : Illegal opcode (PORTB)
Warning[205] C:\DOCUME~1\BALU\DESKTOP\1.ASM 35 : Found directive in
column 1. (END)
Error[131] C:\DOCUME~1\BALU\DESKTOP\1.ASM 36 : Processor type is
undefined

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )Re: Problem in assembling - "John J. McDonough, WB8RCR" - Apr 28 20:02:36 2008
----- Original Message -----
From: Guy Martin
To: p...@yahoogroups.com
Sent: Thursday, April 17, 2008 11:44 AM
Subject: Re: [piclist] Problem in assembling
> You have to tell it that when you write PORTA you mean register 5
>
> use:
>
> #define PORTA 0x05
>
> at the start of your prog
> Not sure about your loop statements. I normally put loop
> statements in col 1, operator on col 2 etc
DO NOT DO THIS. DO NOT EVER DO THIS. I'm not sure why so many hobbyists do
this, the only thing I can see is that it is a leftover from back in the
days when we assembled from a floppy disk and we could save a few seconds by
not using the include file. Hand coding #defines that are in the include
file make the program harder to read, less maintainable, and are a potential
for many errors. Microchip provides an include file, use it.
Now, here's the actual problem:
>
> ----- Original Message -----
> From: chadalawadabalakrishna
> To: p...@yahoogroups.com
> Sent: Tuesday, March 18, 2008 8:09 AM
> Subject: [piclist] Problem in assembling
> I use Microchip MPASM to assemble. But it doesn't accept keywords like
> PORTA etc. Kindly inform me if there is any error in the logic of the
> program:
>
> #include
This isn't C. The include does not require a #, it is preceeded by
whitespace, and the filename does not have angle brackets surrounding it.
include p16f84a.inc
>
> ORG 00H
>
Get over this as soon as possible. Absolute code is OK for your first
outing or two, but once you have your head around the PIC, learn relocatable
code. It can be a little weird getting your head around it at first, but it
will make you far more productive in the long run.
Ditto with the F84. It is *THE* PIC to learn on, but once you have, every
other PIC is cheaper or better, most are both.
72/73 de WB8RCR http://www.qsl.net/wb8rcr
didileydadidah QRP-L #1446 Code Warriors #35
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )Re: Problem in assembling - dlc - Apr 28 23:17:46 2008
John J. McDonough, WB8RCR wrote:
> ----- Original Message -----
> From: Guy Martin
> To: p...@yahoogroups.com
> Sent: Thursday, April 17, 2008 11:44 AM
> Subject: Re: [piclist] Problem in assembling
>> You have to tell it that when you write PORTA you mean register 5
>>
>> use:
>>
>> #define PORTA 0x05
>>
>> at the start of your prog
>> Not sure about your loop statements. I normally put loop
>> statements in col 1, operator on col 2 etc
>
> DO NOT DO THIS. DO NOT EVER DO THIS. I'm not sure why so many hobbyists do
> this, the only thing I can see is that it is a leftover from back in the
> days when we assembled from a floppy disk and we could save a few seconds by
> not using the include file. Hand coding #defines that are in the include
> file make the program harder to read, less maintainable, and are a potential
> for many errors. Microchip provides an include file, use it.
>
> Now, here's the actual problem:
>
>> ----- Original Message -----
>> From: chadalawadabalakrishna
>> To: p...@yahoogroups.com
>> Sent: Tuesday, March 18, 2008 8:09 AM
>> Subject: [piclist] Problem in assembling
>> I use Microchip MPASM to assemble. But it doesn't accept keywords like
>> PORTA etc. Kindly inform me if there is any error in the logic of the
>> program:
>>
>> #include
This isn't C. The include does not require a #, it is
preceeded by
> whitespace, and the filename does not have angle brackets surrounding it.
>
> include p16f84a.inc
>> ORG 00H
>> Get over this as soon as possible. Absolute code is OK for your first
> outing or two, but once you have your head around the PIC, learn relocatable
> code. It can be a little weird getting your head around it at first, but it
> will make you far more productive in the long run.
Lets be more clear. The interrupts and reset address are fixed and
there is NO problem with "ORG" when you want direct access to them - And
very often you _do_.
Sometimes you aren't writing relocatable code, sometimes you are
doing a very discrete thing in a small PIC. We're not always writing
libraries to use with other programs.
> Ditto with the F84. It is *THE* PIC to learn on, but once you have, every
> other PIC is cheaper or better, most are both.
I don't see any reason to use this part. It is a real PIC dinosaur.
> 72/73 de WB8RCR http://www.qsl.net/wb8rcr
> didileydadidah QRP-L #1446 Code Warriors #35
Just my $0.02 worth,
DLC
DLC
> ------------------------------------
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )