Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Issue with MCLR of pic16f648a

2 posters

Go down  Message [Page 1 of 1]

1Issue with MCLR of pic16f648a Empty Issue with MCLR of pic16f648a Fri Jan 22, 2021 12:11 pm

vas641



I made a simple pic16f648a program (xc8 compiler) to display numbers from 0 to 9 on 7segLED. The xc8 program 
is following:

#define __PICPRO__

#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = ON       // Power-up Timer Enable bit (PWRT enabled)
#pragma config MCLRE = ON       // RA5/MCLR/VPP Pin Function Select bit (RA5/MCLR/VPP pin function is MCLR)
#pragma config BOREN = OFF      // Brown-out Detect Enable bit (BOD disabled)
#pragma config LVP = OFF        // Low-Voltage Programming Enable bit (RB4/PGM pin has digital I/O function, HV on MCLR must be used for programming)
#pragma config CPD = OFF        // Data EE Memory Code Protection bit (Data memory code protection off)
#pragma config CP = OFF         // Flash Program Memory Code Protection bit (Code protection off)


#include
#define _XTAL_FREQ 10000000 //define crystal frequency to 20MHz


// This array stores binary bit pattern that will be send to PORTD
unsigned char binary_pattern[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};


void main(void) 
{
    TRISB = 0x00; //define PORTB as a output pin
    while(1)
    {
        //this loop sends all binary patterns to PORTB
        for (int i=0;i<10;i++)
        {
            PORTB = binary_pattern[i];
            __delay_ms(1000);  //add delay of one second
        }
    }
    return;
}
The attached image shows the SimulIDE circuit.

The program works well when MCLR is set to HIGH (i.e. the switch is OFF).and stops working
However, when the SWITCH is ON, the circuit stops (LED becomes black) instead of starting from the beginning of the program.
What is wrong?

2Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Fri Jan 22, 2021 12:46 pm

arcachofo

arcachofo

Hi.

Do you mean that you set MCLR low and then HIGH again and it doesn't restart?

Btw... the image failed to be attached.

3Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Fri Jan 22, 2021 2:42 pm

vas641



The MCLR pin is connected to GND (via a push switch) and to VCC (5V) (via the 1K Ohm resistance). When the switch is pushed and pulled back to the initial (ON) state, the MCLR voltage to 0 and then to 5V (confirmed by the probe). But the LED goes to a black state (no lights on any of 7 segments, similarly as you power it off). Neither a push nor re-loading the program nor changing the switch to another type (e.g. switch all) nor switching the power OFF and ON helps. Only shutting down the SimulIDE and rebooting the circuit and reloading the program allows to reactivate the circuit.

4Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Fri Jan 22, 2021 2:56 pm

vas641



I tried attaching the image several times, it does not go though the image is 36KB only...

5Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Fri Jan 22, 2021 2:56 pm

arcachofo

arcachofo

I will have a look.

By now the only you can do is not using MCLR Pin, but power Off and On again the circuit to reset the PIC.

6Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Fri Jan 22, 2021 2:57 pm

vas641



Issue with MCLR of pic16f648a 7segci14

7Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Sat Jan 23, 2021 8:34 am

arcachofo

arcachofo

Hopefully solved in branch 0.4.14 rev 13.

8Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Sat Jan 23, 2021 1:02 pm

vas641



Could you please give me a hint (URL) how to access the branch 0.4.14 rev 13?

9Issue with MCLR of pic16f648a Empty Re: Issue with MCLR of pic16f648a Sat Jan 23, 2021 1:29 pm

arcachofo

arcachofo

Ohh...  sorry

Here is the repository: https://launchpad.net/simulide

Here last commits for 0.4.14: https://bazaar.launchpad.net/~arcachofo/simulide/simulide_0.4.14/changes

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum