Seemingly unstable basic PIC18F2550 circuit

  • Thread starter Thread starter zxcvb
  • Start date Start date
  • Tags Tags
    Circuit
Click For Summary
SUMMARY

The discussion centers on the intermittent functionality of a PIC18F2550 circuit designed for basic MCU experimentation. Users identified issues related to grounding, specifically the necessity of grounding the Vss pin and the implications of not grounding Vusb, which is an output. The provided code toggles an LED but experiences erratic behavior, prompting suggestions to use a debugger and ensure all pins are properly configured. The importance of avoiding floating pins and setting all configuration options is emphasized for stable operation.

PREREQUISITES
  • Understanding of PIC18F2550 microcontroller architecture
  • Familiarity with embedded C programming and the MPLAB IDE
  • Knowledge of circuit design principles, particularly grounding techniques
  • Experience with debugging tools for microcontroller applications
NEXT STEPS
  • Research proper grounding techniques for microcontroller circuits
  • Learn how to use MPLAB debugger with PIC18F series microcontrollers
  • Explore configuration settings for the PIC18F2550, including oscillator and watchdog timer settings
  • Investigate the effects of floating pins on circuit stability and performance
USEFUL FOR

This discussion is beneficial for hardware developers, embedded systems engineers, and hobbyists working with PIC microcontrollers, particularly those troubleshooting circuit stability and performance issues.

zxcvb
Messages
10
Reaction score
1
From my work I've had quite a bit of experience with hardware development, but purely from a supervisory role, and so recently I've been playing around with ground up MCU circuit design to try to get a better understanding.

I put the following circuit together to allow me to play around with the MCU registers a bit and it does work - only intermittently.

The LED blinks as intended, then stops for an arbitrary time, flashes again a different number of times, off again etc. There doesn't seem to be any cyclic behaviour to it. It starts working without any external input (i.e. nudging it) so doesn't seem like a loose connection either. I realize the second Vss pin isn't grounded in the schematic, but this didn't help the circuit either when I tried it. Could it be because Vusb isn't grounded? I would have thought this would only affect USB operation.

proxy.php?image=http%3A%2F%2Fi.stack.imgur.com%2FfF8BQ.png

Code:
Code:
#include <stdio.h>
#include <stdlib.h>

#include <p18f2550.h>
#include <delays.h>

#pragma config FOSC = INTOSCIO_EC    

#pragma config WDT = OFF            

void main() {

   TRISAbits.TRISA1    = 0;    // Set RA1 as output
   LATAbits.LATA1      = 1;    // Set RA1 as HIGH

   while (1)
   {
       LATAbits.LATA1 = ~LATAbits.LATA1;   // Toggle LED pin
       Delay10KTCYx(25);                   // Delay
   }
}
Datasheet of the PIC18F2550: http://www.kynix.com/uploadfil...668338.pdf
 
Engineering news on Phys.org
Ceci n'est pas une pipe

Your schematic is not your circuit.

Why wouldn't you ground pin 8 (VSS)?

[edit]: Oh I see you tried that. Did you really ground that?
[edit]: VUSB should not be grounded, it is an output.
[edit]: Have you tried stepping through the code with a debugger?
 
Last edited:
As I write this I am working with an 18F2520. I don't like to leave pins floating. Also, there are a lot of settings that I don't see in your code that I prefer to define. In other words, if it can be configured, set it to what it should be. Are you powering this through the USB port on the PC/programmer? That could be a problem.
 

Similar threads

Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
7K