INPUT Line Problem

Started by integrodev October 3, 2003
Dear PICLIST group,

I have a question. I wanted to make a program to check if the portb 7
I/O is high or low and depending on the status of it to change the
status of portb 6! I am using pic 16F877A. I put + 5V on portb 7 but
the status doesn't change. Can you help me to solve my problem? I
don't where I make the misstake

Here is the code:

DEFINE OSC 20
symbol Refa = PORTB.7
SYMBOL LED = PORTB.6

MAIN:

INPUT REFA

IF REFA = 1 THEN
HIGH LED
ELSE
LOW LED
ENDIF

GOTO MAIN
END

Thank you

Best regards,
Refik



the first thing i notice is that you haven't set port7 as input
(digital) and port6 as output (digital). i'm not familar with that
chip but the datasheet will tell you the register values that you
need to change

steven

--- In , "integrodev" <integrodev@h...> wrote:
> Dear PICLIST group,
>
> I have a question. I wanted to make a program to check if the portb
7
> I/O is high or low and depending on the status of it to change the
> status of portb 6! I am using pic 16F877A. I put + 5V on portb 7
but
> the status doesn't change. Can you help me to solve my problem? I
> don't where I make the misstake
>
> Here is the code:
>
> DEFINE OSC 20
> symbol Refa = PORTB.7
> SYMBOL LED = PORTB.6
>
> MAIN:
>
> INPUT REFA
>
> IF REFA = 1 THEN
> HIGH LED
> ELSE
> LOW LED
> ENDIF
>
> GOTO MAIN
> END
>
> Thank you
>
> Best regards,
> Refik





Thank you but didn't understand you fully, it is because I am a
beginner. Thank you Steven. I hope I can get more replies about this
problem. It will help me to solve it

Best regards,
Refik Hadzialic

--- In , "swmillar" <SWMillar@a...> wrote:
> the first thing i notice is that you haven't set port7 as input
> (digital) and port6 as output (digital). i'm not familar with that
> chip but the datasheet will tell you the register values that you
> need to change
>
> steven
>
> --- In , "integrodev" <integrodev@h...>
wrote:
> > Dear PICLIST group,
> >
> > I have a question. I wanted to make a program to check if the
portb
> 7
> > I/O is high or low and depending on the status of it to change
the
> > status of portb 6! I am using pic 16F877A. I put + 5V on portb 7
> but
> > the status doesn't change. Can you help me to solve my problem? I
> > don't where I make the misstake
> >
> > Here is the code:
> >
> > DEFINE OSC 20
> > symbol Refa = PORTB.7
> > SYMBOL LED = PORTB.6
> >
> > MAIN:
> >
> > INPUT REFA
> >
> > IF REFA = 1 THEN
> > HIGH LED
> > ELSE
> > LOW LED
> > ENDIF
> >
> > GOTO MAIN
> > END
> >
> > Thank you
> >
> > Best regards,
> > Refik





How are you checking PORT B? With the LED or a multimeter?

If with a LED then check that you have it connected the right way
round.

If you have a multimeter, then disconnect the LED and check to see if
5v appears on Bit6 when you apply 5v to bit7.

If nothing happens, you need to check the CONFIG sent by your
programmer to the PIC. You may need to disable the Watchdog timer.

This is enabled automatically and has to be switched off.

Which version of Basic are you using?

Colin
--
cdb, on 04.10.2003

I have always been a few Dendrites short of an Axon and believe me it
shows.

Light travels faster than sound. That's why some people appear bright
until they speak!



I have both but I tested it with a LED. I checked it and it was
connected correctly. When I dissable the intern pull up resistors and
disable the watchdog timer, it works but not fast. When I bring high
on portb.7 and remove it, the portb.6 is high for about 8-9 seconds
and then gets low, I tried to do this over a 10 k resistor but same
results? Can you help me Colin or anybody in the list, had anybody
else this problem? I tried it with another 16F877A but same stuff
happens. Thank you

DEFINE OSC 20
OPTION_REG.bit7 = 1

TRISB = %10000000 'svi pinovi su izlazni sem rb7
symbol ulaz = portb.7
SYMBOL led = portb.6 low led 'ugasi led

main:

if ULAZ=1 then upali
low led
goto main
end

upali:

high led
goto main

Thank you

Best regards,
Refik
--- In , cdb <cdb@b...> wrote:
> How are you checking PORT B? With the LED or a multimeter?
>
> If with a LED then check that you have it connected the right way
> round.
>
> If you have a multimeter, then disconnect the LED and check to see
if
> 5v appears on Bit6 when you apply 5v to bit7.
>
> If nothing happens, you need to check the CONFIG sent by your
> programmer to the PIC. You may need to disable the Watchdog timer.
>
> This is enabled automatically and has to be switched off.
>
> Which version of Basic are you using?
>
> Colin
> --
> cdb, bodgy1@o... on 04.10.2003
>
> I have always been a few Dendrites short of an Axon and believe me
it
> shows.
>
> Light travels faster than sound. That's why some people appear
bright
> until they speak!





Forgot to add which version I use. I am using PicBasic Pro Compiler
Ver. 2.42. Thank you

Best regards,
Refa
--- In , "integrodev" <integrodev@h...> wrote:
> I have both but I tested it with a LED. I checked it and it was
> connected correctly. When I dissable the intern pull up resistors
and
> disable the watchdog timer, it works but not fast. When I bring
high
> on portb.7 and remove it, the portb.6 is high for about 8-9 seconds
> and then gets low, I tried to do this over a 10 k resistor but same
> results? Can you help me Colin or anybody in the list, had anybody
> else this problem? I tried it with another 16F877A but same stuff
> happens. Thank you
>
> DEFINE OSC 20
> OPTION_REG.bit7 = 1
>
> TRISB = %10000000 'svi pinovi su izlazni sem rb7
> symbol ulaz = portb.7
> SYMBOL led = portb.6 > low led 'ugasi led
>
> main:
>
> if ULAZ=1 then upali
> low led
> goto main
> end
>
> upali:
>
> high led
> goto main
>
> Thank you
>
> Best regards,
> Refik
> --- In , cdb <cdb@b...> wrote:
> > How are you checking PORT B? With the LED or a multimeter?
> >
> > If with a LED then check that you have it connected the right way
> > round.
> >
> > If you have a multimeter, then disconnect the LED and check to
see
> if
> > 5v appears on Bit6 when you apply 5v to bit7.
> >
> > If nothing happens, you need to check the CONFIG sent by your
> > programmer to the PIC. You may need to disable the Watchdog timer.
> >
> > This is enabled automatically and has to be switched off.
> >
> > Which version of Basic are you using?
> >
> > Colin
> > --
> > cdb, bodgy1@o... on 04.10.2003
> >
> > I have always been a few Dendrites short of an Axon and believe
me
> it
> > shows.
> >
> > Light travels faster than sound. That's why some people appear
> bright
> > until they speak!




Sorry, I have not been following your problem, and I don't know what
program you are using, but in my world, 'ulaz' does not equal 'ULAZ'.
And you ended the program before the last 2 lines.

Chad

--- integrodev <> wrote:
> I have both but I tested it with a LED. I checked it and it was
> connected correctly. When I dissable the intern pull up resistors and
>
> disable the watchdog timer, it works but not fast. When I bring high
> on portb.7 and remove it, the portb.6 is high for about 8-9 seconds
> and then gets low, I tried to do this over a 10 k resistor but same
> results? Can you help me Colin or anybody in the list, had anybody
> else this problem? I tried it with another 16F877A but same stuff
> happens. Thank you
>
> DEFINE OSC 20
> OPTION_REG.bit7 = 1
>
> TRISB = %10000000 'svi pinovi su izlazni sem rb7
> symbol ulaz = portb.7
> SYMBOL led = portb.6 > low led 'ugasi led
>
> main:
>
> if ULAZ=1 then upali
> low led
> goto main
> end
>
> upali:
>
> high led
> goto main
>
> Thank you
>
> Best regards,
> Refik
> --- In , cdb <cdb@b...> wrote:
> > How are you checking PORT B? With the LED or a multimeter?
> >
> > If with a LED then check that you have it connected the right way
> > round.
> >
> > If you have a multimeter, then disconnect the LED and check to see
> if
> > 5v appears on Bit6 when you apply 5v to bit7.
> >
> > If nothing happens, you need to check the CONFIG sent by your
> > programmer to the PIC. You may need to disable the Watchdog timer.
> >
> > This is enabled automatically and has to be switched off.
> >
> > Which version of Basic are you using?
> >
> > Colin
> > --
> > cdb, bodgy1@o... on 04.10.2003
> >
> > I have always been a few Dendrites short of an Axon and believe me
> it
> > shows.
> >
> > Light travels faster than sound. That's why some people appear
> bright
> > until they speak!
__________________________________




Hmm I solved the problem. Thank you pal for the help but it wasn't
the problem I didn't put a 10 K resistor, oh my bad, me=stupid.

Thank you all, and you Colin esspecialy :)

Best regards,
Refa

--- In , Chad Russel <chadrussel@y...> wrote:
> Sorry, I have not been following your problem, and I don't know what
> program you are using, but in my world, 'ulaz' does not
equal 'ULAZ'.
> And you ended the program before the last 2 lines.
>
> Chad
>
> --- integrodev <integrodev@h...> wrote:
> > I have both but I tested it with a LED. I checked it and it was
> > connected correctly. When I dissable the intern pull up resistors
and
> >
> > disable the watchdog timer, it works but not fast. When I bring
high
> > on portb.7 and remove it, the portb.6 is high for about 8-9
seconds
> > and then gets low, I tried to do this over a 10 k resistor but
same
> > results? Can you help me Colin or anybody in the list, had
anybody
> > else this problem? I tried it with another 16F877A but same stuff
> > happens. Thank you
> >
> > DEFINE OSC 20
> > OPTION_REG.bit7 = 1
> >
> > TRISB = %10000000 'svi pinovi su izlazni sem rb7
> > symbol ulaz = portb.7
> > SYMBOL led = portb.6
> >
> >
> > low led 'ugasi led
> >
> > main:
> >
> > if ULAZ=1 then upali
> > low led
> > goto main
> > end
> >
> > upali:
> >
> > high led
> > goto main
> >
> > Thank you
> >
> > Best regards,
> > Refik
> > --- In , cdb <cdb@b...> wrote:
> > > How are you checking PORT B? With the LED or a multimeter?
> > >
> > > If with a LED then check that you have it connected the right
way
> > > round.
> > >
> > > If you have a multimeter, then disconnect the LED and check to
see
> > if
> > > 5v appears on Bit6 when you apply 5v to bit7.
> > >
> > > If nothing happens, you need to check the CONFIG sent by your
> > > programmer to the PIC. You may need to disable the Watchdog
timer.
> > >
> > > This is enabled automatically and has to be switched off.
> > >
> > > Which version of Basic are you using?
> > >
> > > Colin
> > > --
> > > cdb, bodgy1@o... on 04.10.2003
> > >
> > > I have always been a few Dendrites short of an Axon and believe
me
> > it
> > > shows.
> > >
> > > Light travels faster than sound. That's why some people appear
> > bright
> > > until they speak!
> >
> >
> __________________________________
>




"I have not failed. I've just found 10,000 ways that won't work." --
Thomas Edison

--- integrodev <> wrote:
> Hmm I solved the problem. Thank you pal for the help but it wasn't
> the problem I didn't put a 10 K resistor, oh my bad, me=stupid.
>
> Thank you all, and you Colin esspecialy :)
>
> Best regards,
> Refa
>
> --- In , Chad Russel <chadrussel@y...> wrote:
> > Sorry, I have not been following your problem, and I don't know
> what
> > program you are using, but in my world, 'ulaz' does not
> equal 'ULAZ'.
> > And you ended the program before the last 2 lines.
> >
> > Chad
> >
> > --- integrodev <integrodev@h...> wrote:
> > > I have both but I tested it with a LED. I checked it and it was
> > > connected correctly. When I dissable the intern pull up resistors
>
> and
> > >
> > > disable the watchdog timer, it works but not fast. When I bring
> high
> > > on portb.7 and remove it, the portb.6 is high for about 8-9
> seconds
> > > and then gets low, I tried to do this over a 10 k resistor but
> same
> > > results? Can you help me Colin or anybody in the list, had
> anybody
> > > else this problem? I tried it with another 16F877A but same stuff
>
> > > happens. Thank you
> > >
> > > DEFINE OSC 20
> > > OPTION_REG.bit7 = 1
> > >
> > > TRISB = %10000000 'svi pinovi su izlazni sem rb7
> > > symbol ulaz = portb.7
> > > SYMBOL led = portb.6
> > >
> > >
> > > low led 'ugasi led
> > >
> > > main:
> > >
> > > if ULAZ=1 then upali
> > > low led
> > > goto main
> > > end
> > >
> > > upali:
> > >
> > > high led
> > > goto main
> > >
> > > Thank you
> > >
> > > Best regards,
> > > Refik
> > > --- In , cdb <cdb@b...> wrote:
> > > > How are you checking PORT B? With the LED or a multimeter?
> > > >
> > > > If with a LED then check that you have it connected the right
> way
> > > > round.
> > > >
> > > > If you have a multimeter, then disconnect the LED and check to
> see
> > > if
> > > > 5v appears on Bit6 when you apply 5v to bit7.
> > > >
> > > > If nothing happens, you need to check the CONFIG sent by your
> > > > programmer to the PIC. You may need to disable the Watchdog
> timer.
> > > >
> > > > This is enabled automatically and has to be switched off.
> > > >
> > > > Which version of Basic are you using?
> > > >
> > > > Colin
> > > > --
> > > > cdb, bodgy1@o... on 04.10.2003
> > > >
> > > > I have always been a few Dendrites short of an Axon and believe
>
> me
> > > it
> > > > shows.
> > > >
> > > > Light travels faster than sound. That's why some people appear
> > > bright
> > > > until they speak!
> > >
> > >
> >
> >
> >
> > __________________________________
> >
>


__________________________________




Hahaha true, very true :)

Nice proverb, thank you

Best regards,
Refa

--- In , Chad Russel <chadrussel@y...> wrote:
> "I have not failed. I've just found 10,000 ways that won't work." -
-
> Thomas Edison
>
> --- integrodev <integrodev@h...> wrote:
> > Hmm I solved the problem. Thank you pal for the help but it
wasn't
> > the problem I didn't put a 10 K resistor, oh my bad, me=stupid.
> >
> > Thank you all, and you Colin esspecialy :)
> >
> > Best regards,
> > Refa
> >
> > --- In , Chad Russel <chadrussel@y...>
wrote:
> > > Sorry, I have not been following your problem, and I don't know
> > what
> > > program you are using, but in my world, 'ulaz' does not
> > equal 'ULAZ'.
> > > And you ended the program before the last 2 lines.
> > >
> > > Chad
> > >
> > > --- integrodev <integrodev@h...> wrote:
> > > > I have both but I tested it with a LED. I checked it and it
was
> > > > connected correctly. When I dissable the intern pull up
resistors
> >
> > and
> > > >
> > > > disable the watchdog timer, it works but not fast. When I
bring
> > high
> > > > on portb.7 and remove it, the portb.6 is high for about 8-9
> > seconds
> > > > and then gets low, I tried to do this over a 10 k resistor
but
> > same
> > > > results? Can you help me Colin or anybody in the list, had
> > anybody
> > > > else this problem? I tried it with another 16F877A but same
stuff
> >
> > > > happens. Thank you
> > > >
> > > > DEFINE OSC 20
> > > > OPTION_REG.bit7 = 1
> > > >
> > > > TRISB = %10000000 'svi pinovi su izlazni sem rb7
> > > > symbol ulaz = portb.7
> > > > SYMBOL led = portb.6
> > > >
> > > >
> > > > low led 'ugasi led
> > > >
> > > > main:
> > > >
> > > > if ULAZ=1 then upali
> > > > low led
> > > > goto main
> > > > end
> > > >
> > > > upali:
> > > >
> > > > high led
> > > > goto main
> > > >
> > > > Thank you
> > > >
> > > > Best regards,
> > > > Refik
> > > > --- In , cdb <cdb@b...> wrote:
> > > > > How are you checking PORT B? With the LED or a multimeter?
> > > > >
> > > > > If with a LED then check that you have it connected the
right
> > way
> > > > > round.
> > > > >
> > > > > If you have a multimeter, then disconnect the LED and check
to
> > see
> > > > if
> > > > > 5v appears on Bit6 when you apply 5v to bit7.
> > > > >
> > > > > If nothing happens, you need to check the CONFIG sent by
your
> > > > > programmer to the PIC. You may need to disable the Watchdog
> > timer.
> > > > >
> > > > > This is enabled automatically and has to be switched off.
> > > > >
> > > > > Which version of Basic are you using?
> > > > >
> > > > > Colin
> > > > > --
> > > > > cdb, bodgy1@o... on 04.10.2003
> > > > >
> > > > > I have always been a few Dendrites short of an Axon and
believe
> >
> > me
> > > > it
> > > > > shows.
> > > > >
> > > > > Light travels faster than sound. That's why some people
appear
> > > > bright
> > > > > until they speak!
> > > >
> > > >
> > >
> > >
> > >
> > > __________________________________
> > >
> > __________________________________
>