i have a problem in program PIC16F628A. The output result getting a strange result.
Below is my source code:
#include <16F628A.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
void main()
{
set_tris_b(0x0F); //RB7-4 is output, RB3-0 is input port
while (true)
{
if( input(PIN_b0) ) //if input pin RB0 is high
output_high (pin_b6); //Only output pin RB6 is high
else
output_high (pin_b7); //output pin RB6 is low
}
}
From what i understanding,
when RB0 is low, RB7 is high and if RB0 is high, RB6 is high also. Which mean if RB0 is shifting from low to high, both RB6 and RB7 should be high right?
but the actual result is, if i shift RB0 to low, RB7 high and RB6 low. if i shift RB0 to high, RB6 high and RB7 low. Since i didn't set RB6 and RB7 to low, how come RB6 and RB7 wil goes low??
Please give any suggestion. Thanks for your help
Below is my source code:
#include <16F628A.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
void main()
{
set_tris_b(0x0F); //RB7-4 is output, RB3-0 is input port
while (true)
{
if( input(PIN_b0) ) //if input pin RB0 is high
output_high (pin_b6); //Only output pin RB6 is high
else
output_high (pin_b7); //output pin RB6 is low
}
}
From what i understanding,
when RB0 is low, RB7 is high and if RB0 is high, RB6 is high also. Which mean if RB0 is shifting from low to high, both RB6 and RB7 should be high right?
but the actual result is, if i shift RB0 to low, RB7 high and RB6 low. if i shift RB0 to high, RB6 high and RB7 low. Since i didn't set RB6 and RB7 to low, how come RB6 and RB7 wil goes low??
Please give any suggestion. Thanks for your help