What could be causing the unusual issue with PIC16f628a?

  • Thread starter Thread starter mishobg12
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around an issue with the PIC16F628A microcontroller, specifically concerning the behavior of the RB4 pin when connected to +5V. Participants explore potential causes and solutions related to configuration bits and programming settings.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports that connecting RB4 to +5V causes the microcontroller to hang, affecting all ports regardless of their input/output configuration.
  • Another participant suggests that the issue may be related to the configuration bits and implies that RB4 may not be set up correctly for its intended use.
  • A participant references a pinout diagram to clarify the functionality of RB4, noting that it could be used for low voltage programming (LVP) if not configured properly.
  • Further discussion highlights that configuration bits are set during programming and cannot be altered during execution, which may affect the behavior of the RB4 pin.
  • One participant confirms that disabling LVP through a configuration bit resolved the issue, indicating that proper configuration is crucial for the pin's functionality.
  • Another participant shares a personal approach to configuring all settings in the configuration line to avoid potential issues later on.

Areas of Agreement / Disagreement

Participants generally agree that the configuration bits play a significant role in the behavior of the RB4 pin, but there is no consensus on the best practices for configuring these bits or the necessity of configuring all settings in every application.

Contextual Notes

Limitations include the potential for missing assumptions regarding the specific configuration settings and the implications of using LVP on the functionality of RB4.

mishobg12
Messages
25
Reaction score
0
Hi,
So I have this strange issue with 16f628a. If I connect RB4 it to +5V, everything hangs, all ports go to 0. It does that no matter whether it is set to input or output.

My program is very complex, so to make sure that it is not because of a logical mistake, I tried with this simple program instead - http://pastebin.com/mDNvixWv . The problem stays.

Is there some sort of trick for this port/controller that I don't know of or am I mistaking somewhere?
 
Engineering news on Phys.org
I don't have time at the moment to look at a data sheet to see everything that this port is capable of doing. My first hunch would be that you need to change something in the configuration bits. This port is probably not set up to do what you think it is.
 
Are you familiar with the configuration bits on PICs? It isn't part of the executable program. They are registers that are set upon programming and cannot be changed during execution.
 
I am familiar with them. But until then I did not know that RB4 can be used only if LVP is disabled trough a configuration bit as you suggested.
So adding _LVP_OFF to my _CONFIGURE line fixed this for me.

Thank you very much again and all the best.
 
You are quite welcome. When I first got started with PICs I decided it is a good idea to configure EVERYTHING even if I didn't think it needed to be in my specific application. Something always come up later so I decided it was just a good idea to list everything in the configure line right away. Maybe it's my obsessive-compulsive nature, but I hate 'loose ends'.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
Replies
12
Views
3K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 10 ·
Replies
10
Views
5K
  • · Replies 4 ·
Replies
4
Views
33K
Replies
29
Views
5K
Replies
8
Views
4K