Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Incorrect high value for PIC16F84

Status
Not open for further replies.

alexeygu

New Member
I am using a PIC16F84A and just starting out. I had it output a high (1), and expected to receive 5V, however I only received 0.5V. When I tell it to output low (0), I receive 0.2-0.3V. Any ideas why this is happening?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Make sure you are setting the pin as an output, also use a pin on PortB, not PortA - PortA has one pin which is opencollector (so can't go high).

Failing that, post your code here.
 

alexeygu

New Member
I didn't have anything hooked up to MCLR. I hooked it up with a 6.8k resistor and now the high is 5V and the low is 4.5V. Below is my code from SourceBoost that sets port B to low.

Code:
#include <system.h>

const char led[6] = { 1, 2, 4, 8, 16, 32 };

void delay( void )
{
    char i = 0, j;
    while( i++ < 5 )
    {
        j = 0;
        while( j++ < 2 )
        {
            nop();
        }
    }
}

main()
{
    disable_interrupt( GIE );
    trisb = 0;

    set_tris_b(0x00);

    char i = 0;
    while( 1 )
    {
		output_port_b( 0x00 );
		portb = 0x00;    
    }
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Top