• AVR Freaks

LED Switch Gone Bad (PIC16F687)

Author
medinaev
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/07/02 12:34:02
  • Location: 0
  • Status: offline
2019/07/06 09:19:32 (permalink)
0

LED Switch Gone Bad (PIC16F687)

I made a short C code that I thought turn an LED on when i connected the input pin to VSS( 5V). However the LED is off ALL the time and will only turn off when i disconnect ground. Here is the code i made,
 
#include <xc.h>
#include <stdio.h>
#define _XTAL_FREQ 2000000
 
 void main() {

TRISC = 0b00000010;

if(PORTCbits.RC0==1)
PORTCbits.RC1 = 1;
else if (PORTCbits.RC0==0)
PORTCbits.RC1 = 0;
 
Port RC1 is at 0V (Pin 15)
Port RC0 is at VDD when i want to turn it on (Pin 16)
 
VDD measured is at 5.03V ( Potentoimeter voltage divider)
VSS Measured is 0V (GND from Supply)
 
when i disconnect the ground,  pins 11-20 except the pin 16 ( becasue VDD is connected to it) go to 3V.
 
can i get hints to help me solve the problem?
#1

1 Reply Related Threads

    katela
    Super Member
    • Total Posts : 1330
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: LED Switch Gone Bad (PIC16F687) 2019/07/08 13:40:19 (permalink)

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5