EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / I’m using MPLAB IDE v8.88 and

I’m using MPLAB IDE v8.88 and

|

Microcontroller › PIC › Novice at Microcontrollers › I’m using MPLAB IDE v8.88 and

November 21, 2012 at 2:23 pm #8775
Ren
Participant

I’m using MPLAB IDE v8.88 and c18 compilier and I got an LED to light reading input by using a sample program on this site but, I have a major problem, before I can even sent 5V on portb to send it high, the LED on porte lights, matter of fact any wire, slight touch on any of the portb input pins causes it the LED on pote to light or stay on for a while, worst case it just comes on and stays on. The next problem is that, the porte output is about 2.5V max. From the looks of things I’m in deep trouble, here is the code.

 

//config.
#include <p18F4550.h>
#pragma config FOSC = INTOSC_EC
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config MCLRE = ON
#pragma config PBADEN = OFF
#pragma config ICPRT = OFF
#pragma config LVP = OFF
#pragma config WDT = OFF,DEBUG=OFF

void main()
{
    ADCON1=0x0F;            // Set all pins as digital I/O
    CMCON=0x07;             // Set all comparators as digital I/O
    TRISEbits.RE0=0;            // Configure pin RE0 as output
    TRISBbits.RB0=1;            // Configure pin RB0 as input
    while(1)
    {
        if(PORTBbits.RB0=1)         // If input is high
            LATEbits.LATE0=1;   // Turn the LED On
        else
            LATEbits.LATE0=0;   // Turn the LED Off
    }
}

RSS Recent Posts

  • Panasonic RQ-A170 Walkman recorder November 7, 2025
  • strange laptop problem November 7, 2025
  • WTB: "The Theory Of Servicing AM, FM, And FM Receivers" by Clarence R. Green and Robert M. Bourque November 7, 2025
  • Converting 1vac to 24vac November 7, 2025
  • AC Input Relay Device Required November 7, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise