What could be causing the unusual issue with PIC16f628a?

  • Thread starter mishobg12
  • Start date
In summary, if you want to use RB4 to control something that needs 5V, you need to disable LVP in the configuration bit.
  • #1
mishobg12
25
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
  • #2
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.
 
  • #4
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.
 
  • #5
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.
 
  • #6
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'.
 

1. What is the PIC16f628a and how does it differ from other PIC microcontrollers?

The PIC16f628a is a type of microcontroller that is commonly used in embedded systems and electronic devices. It is part of the PIC16 family of microcontrollers, which are known for their low cost, low power consumption, and wide range of applications. The PIC16f628a specifically has 18 pins and 2KB of program memory, making it suitable for smaller projects compared to other PIC microcontrollers with more pins and memory.

2. What is the most common issue encountered when using the PIC16f628a?

The most common issue with the PIC16f628a is programming errors. This can occur due to incorrect connections or settings, improper use of programming tools, or issues with the code itself. It is important to carefully follow the datasheet and programming guidelines to avoid these errors.

3. Can the PIC16f628a be used for both analog and digital applications?

Yes, the PIC16f628a has both analog and digital capabilities. It has an 8-channel analog-to-digital converter that allows it to read analog signals, as well as digital input/output pins for interfacing with digital devices. This makes it versatile for a wide range of applications.

4. Is the PIC16f628a suitable for beginners in microcontroller programming?

Yes, the PIC16f628a is a popular choice for beginners due to its low cost, simplicity, and availability of resources and support. There are many tutorials and guides available online for programming this microcontroller, making it a great option for those new to microcontrollers.

5. Are there any known issues or limitations with the PIC16f628a?

One limitation of the PIC16f628a is its limited program memory of 2KB. This may not be enough for larger or more complex projects. Additionally, it does not have built-in hardware support for common communication protocols such as I2C or SPI, which may require additional components and programming. However, these limitations can be overcome with careful planning and optimization of code.

Similar threads

Replies
12
Views
2K
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Electrical Engineering
Replies
4
Views
6K
  • General Engineering
Replies
2
Views
3K
  • Electrical Engineering
Replies
19
Views
7K
  • Classical Physics
Replies
3
Views
944
  • Computing and Technology
Replies
10
Views
3K
  • Mechanical Engineering
Replies
3
Views
2K
  • Programming and Computer Science
Replies
29
Views
3K
Back
Top