Searching \ for '[PIC]: 16f871 assembler problems?? no support?? H' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/ios.htm?key=port
Search entire site for: '16f871 assembler problems?? no support?? H'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16f871 assembler problems?? no support?? H'
2000\09\27@081644 by Hardware Engineering

picon face
I've been working on a project using the 16F871 chip, I got two samples from
Microchip, updated MPLAB to the latest version, and set to get going on this.


The first thing I always do is something simple, just to let me know that the
chip is working, rather than do something elaborate and try to figure out what
I did wrong.  So I did the simple, read a port switch, and turn on an LED when
the switch activates.  No go.  I used portA for the input, set the TRIS to
0xFF, and used portC as the output, setting TRIS to 0x00

Seems the portC is not behaving as an output.  I'm using a 4MHz TTL oscillator
(yes its working, have it hooked to OSC1 input, and get an output on OSC2,
input is set to HS.

I even backed off and made the program simple by just TURNING on the LED but
portC seems to be...not working or intializing.

Now, one thing that is strange is I get the following error in MPLAP when I
assemble.

Building TEST.HEX...

Compiling TEST.ASM:
Command line: "C:\PROGRA~1\MPLAB\MPASMWIN.EXE /p16F871 /q D:\A_STC\TEST.ASM"
Message[301] D:\A_STC\P16F871.INC 35 : MESSAGE: (Processor-header file
mismatch.  Verify selected processor.)
Warning[224] D:\A_STC\TEST.ASM 19 : Use of this instruction is not
recommended.
Warning[224] D:\A_STC\TEST.ASM 22 : Use of this instruction is not
recommended.

Build completed successfully.

Whats the deal with the processor header file mismatch?

here is the source file


       list      p=16F871            ; list directive to define processor
       #include <p16F871.inc>        ; processor specific variable definitions
PORTA                        EQU     H'0005'
PORTB                        EQU     H'0006'
PORTC                        EQU     H'0007'
PORTD                        EQU     H'0008'
PORTE                        EQU     H'0009'
PCLATH                       EQU     H'000A'


       org     0x000       ; The main line code starts here
main
       goto init
       org     0x010
init
       movlw   0xFF
       tris    PORTA
       
       movlw   0x00
       tris    PORTC
here    
       bcf     PORTC,2
       bsf     PORTC,0
       bcf     PORTC,1
       bsf     PORTC,2
       nop
       nop
       nop
       goto    here

       end

____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use spam_OUTlistservTakeThisOuTspammitvma.mit.edu?bodyT%20PICList%20DIGEST


2000\09\27@100359 by Paul

flavicon
face
dont know never used them but l do know that microchip is fazing out the
tris command,

try

movlw   0xFF
movwf   TRISA

etc...making sure TRISA,B,C are defined properly to their correct register
addresses of course...l have always done it this way anyway, l could never
understand the TRIS command being there seems like a waste of time to
me...it does the same as movwf anyway...maybe they just wanted to fill a
spare hole in their command set ???

{Original Message removed}

2000\09\27@101822 by Byron A Jeff

face picon face
>
> dont know never used them but l do know that microchip is fazing out the
> tris command,
>
> try
>
> movlw   0xFF
> movwf   TRISA

Some short notes. Make sure you correctly set the bank bit (RP1 I believe)
because the TRIS registers are in the second ram bank. BTW this is the
primary value of the TRIS instructions, they don't require changing banks
back and forth to set the TRIS bits. Probably isn't a big deal unless you
have a set of IO ports that flop back and forth from inputs to outputs.

Also remember to reset the RP1 bit after you've done the move.

And in your code below you should have at least one NOP between changes to the
same port as the change actually doesn't happen until a cycle in the next
instruction IIRC.

The PORTA bits on the 16F87X chips pop up as analog inputs. So be
sure to change those bits to digital inputs before you try to use them.
Along those same lines you may want to triple check that PORTC isn't
configured to something strange.

And a special note on the 16F87X chips: if low voltage programming is enabled
make sure the PORTB3 is strapped correctly otherwise the chip may wander into
programming mode. The easiest way to alleviate this program is to set the
chip is HVP mode only using the config bits.

Hope this helps you get started.

BAJ
>
> etc...making sure TRISA,B,C are defined properly to their correct register
> addresses of course...l have always done it this way anyway, l could never
> understand the TRIS command being there seems like a waste of time to
> me...it does the same as movwf anyway...maybe they just wanted to fill a
> spare hole in their command set ???
>
> {Original Message removed}

2000\09\27@103107 by staff

flavicon
face
With the header file mismatch, go into MPLAB, open options/development
mode,
then set the processor type for editor or sim (whatever you're using)
to 16F871, I am sure you will find this is set to something else.

Other wise check your p16F871.inc file to see if someone
has edited it (never edit them).

Good luck.






Hardware Engineering wrote:
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use listservspamKILLspammitvma.mit.edu?body=SET%20PICList%20DIGEST


2000\09\27@120620 by Olin Lathrop
flavicon
face
>>
       list      p=16F871            ; list directive to define processor
       #include <p16F871.inc>        ; processor specific variable
definitions
PORTA                        EQU     H'0005'
PORTB                        EQU     H'0006'
PORTC                        EQU     H'0007'
PORTD                        EQU     H'0008'
PORTE                        EQU     H'0009'
PCLATH                       EQU     H'000A'
<<

Why are you manually trying to define the port registers?  This is all done
in the include file.  That's part of its job.

>>
       tris    PORTA
<<

Don't use TRIS.  It is an old instruction that is not supposed to be used on
this family, and isn't in the documentation for this processor.  Do a MOVWF
TRISA instead.

Above all, read the manual.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, .....olinKILLspamspam.....cognivis.com, http://www.cognivis.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu?body=SET%20PICList%20DIGEST


2000\09\27@120830 by mike

flavicon
face
On Thu, 28 Sep 2000 01:03:57 +1000, you wrote:

>dont know never used them but l do know that microchip is fazing out the
>tris command,
>
>try
>
>movlw   0xFF
>movwf   TRISA
>
>etc...making sure TRISA,B,C are defined properly to their correct register
>addresses of course...l have always done it this way anyway, l could never
>understand the TRIS command being there seems like a waste of time to
>me...it does the same as movwf anyway...maybe they just wanted to fill a
>spare hole in their command set ???
TRIS is very useful as it does not require page-select bits to be
twiddled to access it.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use listservspamspam_OUTmitvma.mit.edu?bodyT%20PICList%20DIGEST


2000\09\27@121022 by Andre Abelian

picon face
as  far as Processor-header mismatch you may have different MCU in emulator
or simulator
setup. Now back to portC. once similar thing happened with  me and I found
that portC bit 0 and 1 also
has timer1 external OSC setup add this  BCF    T1CON,3  this will make sure
timer1 is disabled.
include file already has PORTA    EQU    0x05 all that you do not need to
type them again
remove PORTA thru PCLATH.  instead of

>         movlw   0xFF
>         tris    PORTA

use this

       movlw    0xFF
       movwf    TRISA

PORTC,2  will turn on and off too fast you can't see it unless you are using
step by step.

{Quote hidden}

I guess that is all for now since you didn't mention your name I do not know
who you are. hope this helps

Andre Abelian






{Original Message removed}

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