Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with PIC16F877A

Status
Not open for further replies.

xylynn

Member level 2
Joined
Nov 26, 2007
Messages
47
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,579
pic16f877a icsp

Dear all
I'm newbie with PIC16F877A. I've already familiar with 16F84A.... Now I found a problem with 16F877A... First at all I try to write very simple program with it. Blinking LED. But I can't..... I connect the Vdd and MCLR with power supply 5V and Vss with ground. My program is very simple.... when I press the push buttom which connects with RB0, the LED will blink. The LED is connected with RA1...
My problem is when I switch on the power, the LED is always lighting even I didn't press the key.....I'm sure I put the push buttom between the RB0 and the 5V supply line.......


Here is my source code


porta equ 5
portb equ 6
status equ 3
trisa equ 85h
trisb equ 86h
count1 equ 0ch
count2 equ 0dh

list p=16f877a
include "p16f877a.inc"
__config h'3ff1'
errorlevel -302
org 0
goto start

start bsf status, 5
movlw 0
movwf trisa
movlw b'11111111'
movwf trisb
bcf status, 5
clrf porta
test btfss portb,0
goto test
bsf porta,1
loop bsf porta,1
call delay
call delay
call delay
bcf porta,1
call delay
call delay
call delay
goto loop


delay clrf count2
movlw 255
movwf count1
delay1 decfsz count1,1
goto delay1
decfsz count2,1
goto delay1
return

end
 

datasheet of pic16f877a

I think you should configure also the registers ADCON0 and CMCON disabling the analog features. Make a try, check the datasheet for details.
 

port a 16f877a

xylynn said:
Dear all
... I connect the Vdd and MCLR with power supply 5V and Vss with ground ...

May be your input at the power on keep a spike, try to code a simple debouncing routine or put a RC filter on the input.

Bye
Pow
 
p16f877a datasheet

So do I need to configure ADCON register???
OK I will try again.......
Sometime I feel upset about this 16F877A..... hee..hee..hee...
By the way where should I study about 16F877A???
please kindly shou me the sites....
Thank a lot
Best Regard
 

+pic16f877a+push button blinking led source code

just go through the data sheet of pic16f877a. there you can read all abt this.

Added after 1 seconds:

just go through the data sheet of pic16f877a. there you can read all abt this.
 

adcon 16f877

xylynn said:
So do I need to configure ADCON register???
OK I will try again.......
Sometime I feel upset about this 16F877A..... hee..hee..hee...
By the way where should I study about 16F877A???
please kindly shou me the sites....
Thank a lot
Best Regard

ADCON1 = 0b00000110; // All lines configured as digital I/O

At the power up the ADC module is in off state then no need to force it off, anyway if you like to set it look at the ADCON0 register bit 0 and force it to 0 (bit ADON).

Bye
Pow
 

adcon0 register pic16f877a

Thanks a lot....
It is very good for me.....
Why we need to configure this ADCON1 register? I don't even use the analog to digital conversion.
Thank you very much

Best Regards
 

manual delays on pic16f877a

xylynn said:
Thanks a lot....
It is very good for me.....
Why we need to configure this ADCON1 register? I don't even use the analog to digital conversion.
Thank you very much

Best Regards

Because at the power on the ADCON1 register is initialized with all the bit set to 0, look at the attached figure above you can understand that default input is analogue type.

Bye
Pow
 

simple icsp for pic16f877a

What is ICSP? When I try to program the 16F877A with the programmer, it need the ICSP. The programmer is from China and it's a universal programmer...
 

pic16f877a adcon1 all digital

ICSP = In Circuit Serial Programming

With this feature you can program and debug your microcontroller directly on board using the microntroller resource and the ICD2 debugger/programmer tool from Microchip.
For PIC you need just only these lines:

VCC
GND
MCLR/VPP
PGC
PGM

here in attachement a image that show how to connect these line to the microcontroller, of course this isn't related to this micro but can be used also for also PIC micro, just see the datasheet for the pins assignement.
One drawback of the ICSP is that two pin are dedicated to the programming/debugging, but you can also share these pins by using a resistor in series with the pin in order to do some separation from the programmer and the all circuit part (again see datasheet about ICSP in order to know how this can be do).
To gain more knowledge about ICSP look at the Microchip web site, here below the direct link to the pdf about ICSP.

https://ww1.microchip.com/downloads/en/DeviceDoc/30277d.pdf

Hope it help.

Bye
Pow
 

pic16f877a movlw led vpp

Thank brother
by the way there is a programmer board belong to my friend. This board use the software MP929 for programming the PIC16F877A. When I try to program the chip, this chip is under ICSP group. Normally I don't need to do anything with 16F84A. Just connect printer port with computer and programmer board. But for 16F877A the computer dosen't recognized the chip. What should I do? This programmer have not only printer port but also ICSP.

Best Regards
 

datasheet pic16f877a icsp dat

Dear
I don't know the MP929 programming software that you're using, I've did a little search trough the web and I've find this manual:

**broken link removed**

seems about your programmer, see at page 3, your PIC seems supported, may be you need just to upgrade the programmer software? Really I don't know how help you further, also manual isn't in english...

Bye
Pow
 

set pull-up portb 16f877

Where can I find the programmer circuit board and related software for PIC16F877A??
Thanks all... brothers...

Best Regards
Lynn
 

pic16f877a icsp portb problem

Thanks a lot...
By the way where can I study about PIC16F877 and the LCD 2x16 and Unipolar Stepper motor?
 

what is pull-ups for port b of pic16f877a

Hope you have made progress with 16F877a with the above help.
I have noticed that you connect the I/P push button between Rb0 and +V. If you read the data sheet you will find that 16F877, etc. has pull-up resistors on port B.This means that you need to connect the push button between Rb0 and 0V to switch the I/P to 0V.In your case the I/P never change state whether the switch is made or not.Try this.
Cheers
PS: Please keep trying with 16f877. It is really a nice PIC to work with.
 

configure +adcon0 +pic16f877a

Yes, you are right..
I will try what you tell me.... I forget about the pull up resistors....:idea::idea:
Thanks a lot for helping me....


Best Regards
xylynn
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top