PIC 16F677A .. Not working !!

Status
Not open for further replies.

mas

New Member
I am working on pic 16f677a chip

I wrote a short code just to test the IC ..

The code is desired to set PORTD to outputs
& assign all PORTD pins to HIGH

Here is the code

Code:
BSF STATUS,RP0
BCF STATUS,RP1

MOVLW 0X00
MOVWF TRISD
MOVLW 0X06
MOVWF ADCON1

BCF STATUS,RP0

MOVLW B'11111111'
MOVWF PORTD

Is there something wrong or missing with the code ??
 
There is nothing wrong in the code. Did you compile it correctly? Did you load the hex file into the chip correctly?
 
Do you have you configuration bits set to match what you are using for an osc?
 
hi mas,
Post the CONFIG details, also is this the complete code and what compiler are you using?
 
you can do a dummy loop or like this

Code:
[B]SHOW[/B]	MOVLW 	B'11111111'
	MOVWF 	PORTD
	GOTO	[B]SHOW[/B]
 
After looping it doesn't work also ..

I am using The Mplab ..

I am using a crystal oscillator 4MHz with capacitors 22 pF

I connected pin 1 (MCLR inverted) to Vdd through a resistance 200 ohm


soo .. what configurations should be made ??
 
hi mas,

Download from www.microchip.com the datasheet for the 16f677a chip.

This gives details of the Config header.

Config, covers issues like, Code protection, Brown out/Power On timers,
Osc freq, type of oscillator.....

It can be written a hex word example 0x3F1A or in MPLAB statements.
Example, __CONFIG CP1,,, WRT etc..... I prefer this way,
 
mas said:
After looping it doesn't work also ..

I am using The Mplab ..

I am using a crystal oscillator 4MHz with capacitors 22 pF

I connected pin 1 (MCLR inverted) to Vdd through a resistance 200 ohm


soo .. what configurations should be made ??

Check my tutorials, which give a similar program, flashing all pins, and also show how the hardware is connected.

You're only showing part of a program, much of it is missing, so it's unlikely to work.
 
This is what I do usually:
Code:
LIST P=16F877A
#include <P16F877A.inc>
__config 0x3F31
;
;source codes
end
and everything work fine.
 
PORTD is not available on the PIC16F677 and as far as I know Microchip hasn't made silicon revisions of this chip (I can't go to the Microchip's site right now, though ). So, did you mean PIC16F877A?
 
Last edited:
eng1 said:
PORTD is not available on the PIC16F677 and as far as I know Microchip hasn't made silicon revisions of this chip (I can't go to the Microchip's site right now, though ). So, did you mean PIC16F877A?
Oh, I'm really blurred. I didn't notice that it was PIC16F677. I thought it was a PIC16F877A
I have just read the datasheet of PIC16F677, there are only port a, b and c. Besides, there is no PIC16F677A.
 
mas,
their is no problem with your code,if your config is correct.select ossci as Xt as you are using 4MHz.then simulate your code and check the watch window from view menu. if its showing the changes in ur port then prblm may be with ur hardware, or else try with another IC .
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…