View previous topic :: View next topic |
Author |
Message |
2-Chri
Joined: 23 Mar 2012 Posts: 8
|
PIC16F628 Portb Pullups Enable |
Posted: Sat Apr 28, 2012 4:02 pm |
|
|
Hello,
I want to enable the internal pullups resistor but I couldn't enable the resistors. My code is below:
Code: |
#include <16F628A.h>
#include <Lcd_16x2_4bit_Operation_2.c>
#fuses HS,MCLR,PUT,NOLVP,NOWDT,NOBROWNOUT,PROTECT,CPD
#use delay(clock=20000000)
#byte PORTA = 0x05
#byte PORTB = 0x06
void main(void)
{
port_b_pullups(TRUE);
delay_ms(100);
set_tris_a(0x2F);
set_tris_b(0xC0);
while (TRUE)
{
if(input(PIN_B7) == 1)
{
output_high(OUT);
}
else
{
output_low(OUT);
}
}
}
|
|
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Sun Apr 29, 2012 12:58 pm |
|
|
How do you KNOW that pullup is not working?
The code in your post does not compile. ( I get error "Undefined identifier OUT". )
Mike |
|
|
2-Chri
Joined: 23 Mar 2012 Posts: 8
|
|
Posted: Sun Apr 29, 2012 2:41 pm |
|
|
FInally works. I disconect the pins PGC and PGC from ICD3 to PIC and works OK! Thanks! |
|
|
|