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.

Pic 16f877a Microcontroller

Status
Not open for further replies.

Aldous Mantiza

Newbie level 5
Joined
Aug 26, 2014
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
56
Good day!
I have here a PIC 16f877a. Do I really need to power up both pins (11 12 & 31 32) which are the Vss and Vdd even I have already supply voltage on Pin 1 which is Vpp. what is the difference between them? Thank you!
 

Both the pins are internally connected. For simple operation you can use any two pins to power up the device. As per the datasheet electrical specification, the microcontroller can handly upto 300mA at power supply pins. If your I/O pins are handling higher current, its advisable to power the controller at both sides.

Regards
Udhay
 
Thank you very much Sir! Can i use 200MHz on my clock input even though 20MHz is specified on the data sheet?
 

NO NO NO.

ALWAYS use both the VSS and VDD pins and ALWAYS connect at least one decoupling capacitor across BOTH sides of the IC. Under no circumstances use the pins as a connection to carry current from one side of the IC package to the other.

Why do you think 20MHz is specified as maximum in the data sheet?
You might be able to clock it a little faster but then there would be no guarantee it would work reliably or over the full supply voltage and temperature range. I would say 200MHz is out of the question.

Brian.
 
Thank you sir.
I just wonder if 200MHz is okay because we're making a line follower robot.
What program compiler can you suggest because we're using MPLab or MicroC.
 

you can do tons of work with 20mhz. if your code size is large go for mplab otherwise microc will be best bet
 
You do not need high speed for such simple applications.

I'm sure I could make a line follower with a processor running at 1MHz.
With 20MHz I could make it forget the line and use GPS instead.
With 200MHz I could make it use GPS, speak it's location, draw you a map, play music as it goes along and still have capacity to 3D print another robot to follow it!

Brian.
 
We are having trouble on our code. We also use Proteus to simulate our circuit but doesn't work also.
Here is the image of our schematic and our code. Thank you very much for your help.

Code:
#include <htc.h>
#include <pic.h>
#include "delay.c"
#define _XTAL_FREQ 20000000
#define LEFT RE2
#define CENTER RE1
#define RIGHT RE0

void main ()
{

TRISE=0X11111111;
TRISD=TRISC=0X00000000;
while(1){
PORTD=0b11001100;
PORTC=0b11111111;
if ((LEFT==1) && (CENTER==1) && (RIGHT==1)) //stop
{
PORTD=0b00000000;
PORTC=0b00000000;
DelayMs(10000);
}


if ((LEFT==0) && (CENTER==1) && (RIGHT==1)) //left2
{
PORTD=0b11001100;
DelayMs(1000);
PORTD=0b00110000;
DelayMs(1000);
}

if ((LEFT==1) && (CENTER==1) && (RIGHT==0)) //rht2
{
PORTD=0b11001100;
DelayMs(1000);
PORTD=0b00000011;
DelayMs(1000);
}
if ((LEFT==1) && (CENTER==0) && (RIGHT==1)) //forwrd
{
PORTD=0b00110011;
DelayMs(1000);
}
}
}
 
Last edited by a moderator:

I can't see anything in the flow of code that would stop it working but RE0, RE1 and RE2 default to being analog inputs, you probably want to make them digital inputs at the beginning of main();

Brian.
 
Thank you Sir, but How can i make that to digital inputs at the beginning of main() ?
Here is the schematic diagram that we are using.
schematic diagram.jpg
 

Read section 11 of the data sheet. Look at the ADCON1 register, it defaults to value 00000000 at reset which makes AN5, AN6 and AN7 analog inputs. These corespond to pins RE0, RE1 and RE2 which you use as the switch inputs. You need to set the PCFG bits to set the pins to digital mode.

You also have an electrical problem. When SW1, SW2 or SW3 are closed the RE pins go to logic high voltage but what happens when the switches are open? You need to add pull-down resistors to ensure they go low if the switches are not operated.

Brian.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top