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.

MCLR with PIC16F877a software

Status
Not open for further replies.

mayasunny

Member level 3
Member level 3
Joined
Mar 21, 2019
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
481
Hi members,
im working on PIC16F877A micro controller with 20Mhz crystal and with xc8 compiler , my problem is the lcd working properly with icd3 connected(i flash the code into micro controller), when i remove icd3 tool and power off/on the main unit lcd not displaying anything, until I touch the MCLR pin to GND point through a wire once / pressing push button switch connected to MCLR , i dont know why? one more thing how to set MCLR in software, i tried #pragma config MCLRE = ON, but is showing error to me, i need help? here are my configuration bits
Code:
#pragma config FOSC = HS        // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = ON       // Power-up Timer Enable bit (PWRT enabled)
#pragma config BOREN = OFF      // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = ON        // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF        // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF        // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF         // Flash Program Memory Code Protection bit (Code protection off)  
[\ code]
 
Last edited:

Change this

Code:
#pragma config LVP = ON // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)

to this
Code:
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
 

yes i changed, but same problem
 

i don't have its schematics, but R1=10k , R2 =470ohms
 

Hi,

i don't have its schematics
Professionals draw schematics. Even hand drawn is good.

I think it prevents from pitfalls and errors..

Klaus
 

Hi,


Professionals draw schematics. Even hand drawn is good.

I think it prevents from pitfalls and errors..

Klaus

dear KlausST, im not familiar with schematics/hardware connections i have EVB board, a push button is connected to MCLR pin(two parallel resistors to Vdd) sorry for my bad knowledge, i don't think so this will help you, any other suggestions
 

Hi,

im not familiar with schematics/hardware connections
You have to learn it sooner or later. My recommendation: now

i have EVB board
Every EVB board should come with a schematic.

a push button is connected to MCLR pin(two parallel resistors to Vdd)
..and here we have the problem: This description makes no sense to me.
--> Any hand drawn sketch is more informative.

Klaus
 

can we set MCLR in software,
Not in the 16F877A. Most modern PICs have an option to internally connect MCLR to VDD so the pin is released for other uses but the venerable 877A is too old for that.

Brian.
 

Not in the 16F877A. Most modern PICs have an option to internally connect MCLR to VDD so the pin is released for other uses but the venerable 877A is too old for that.

Brian.

thank you so much betwixt, u cleared my doubt.
can i use POR(power on Reset) in software like PCONbits.nPOR = 0; or is there any methods for software reset
 

Hi

you really need to read the datasheet about reset. It contains all information you need to know.

Software reset is no hardware reset. With many microcontrollers a software reset does not clear all the values that a hardware reset does. It is not equal.
POR is - like the name says - the PowerOnReset. It will be activated at power ON. Usually there is no chance to do the same with software.
Often a Watchdog reset is the one hardware Reset that may be controlled with software.
Whether this applies for your controller is written in the datasheet.

Klaus
 

You can't exactly simulate a hardware reset because the reason for the last reset is held in one of the registers and set at the time it happens.
The easiest way to force a restart rather than a full reset is to enable the watchdog timer then go into a tight loop so it times out. For example call this routine:

ForceRestart()
{
while();
}

Note that it might not work if you reset WDT in an interrupt routine but you shouldn't ever do that anyway!

You can also force a call to the reset vector, you might have to do this as an assembly language instruction "#asm goto 0".
Another method that might work, possibly not in early versions of XC8 though, is to use the RESET(); instruction. Note it is in upper case.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top