Searching \ for '[PIC]: making certain pins inputs and outputs on p' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=input
Search entire site for: 'making certain pins inputs and outputs on p'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: making certain pins inputs and outputs on p'
2003\02\15@212324 by Alexander Luis Perez

picon face
I want to make rb0 on my 16f84be an input for a
pushbutton and the rest of portb outputs.  so far I
have not been able to create working code.I am using
hitech's freeware compiler.

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu>

2003\02\15@213448 by Mike Singer

picon face
Alexander Luis Perez:
> I want to make rb0 on my 16f84be an input for a
> pushbutton and the rest of portb outputs.  so far I
> have not been able to create working code.I am using
> hitech's freeware compiler.

Well, and what is your question?

  Mike.

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu>

2003\02\15@230737 by Brent Brown

picon face
On 15 Feb 2003 at 18:11, Alexander Luis Perez wrote:

> I want to make rb0 on my 16f84be an input for a
> pushbutton and the rest of portb outputs.  so far I
> have not been able to create working code.I am using
> hitech's freeware compiler.

This should do it:

TRISB = 0b00000001;

But that sounds too easy. What is the next part of the problem?

--
Brent Brown, Electronic Design Solutions
16 English Street, Hamilton, New Zealand
Ph/fax: +64 7 849 0069
Mobile/txt: 025 334 069
eMail:  brent.brownspamKILLspamclear.net.nz

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu>

2003\02\16@093243 by Alexander Luis Perez

picon face
So if I wanted to makea light light up on rb1, then
how would that happen?
--- Brent Brown <EraseMEbrent.brownspam_OUTspamTakeThisOuTCLEAR.NET.NZ> wrote:
{Quote hidden}

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\02\16@113232 by Olin Lathrop

face picon face
> I want to make rb0 on my 16f84be an input for a
> pushbutton and the rest of portb outputs.  so far I
> have not been able to create working code.

Enable port B passive pullups in OPTION_REG, then connect the pusbutton
between the port B pin and ground.  The pin will read 1 normally, and 0
when the pushbutton is pushed (assuming normally open, which most of them
are).


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\02\16@122822 by Alexander Luis Perez

picon face
Thank you all for answering.  I have the answers now.
--- Olin Lathrop <KILLspamolin_piclistKILLspamspamEMBEDINC.COM> wrote:
> > I want to make rb0 on my 16f84be an input for a
> > pushbutton and the rest of portb outputs.  so far
> I
> > have not been able to create working code.
>
> Enable port B passive pullups in OPTION_REG, then
> connect the pusbutton
> between the port B pin and ground.  The pin will
> read 1 normally, and 0
> when the pushbutton is pushed (assuming normally
> open, which most of them
> are).
>
>
>
*****************************************************************
{Quote hidden}

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\02\16@151707 by Brent Brown

picon face
On 16 Feb 2003 at 6:30, Alexander Luis Perez wrote:

> So if I wanted to makea light light up on rb1, then
> how would that happen?

Well, it does depend on the hardware, but if you have an LED and
resistor connected from RB1 to +5V, and you have made RB1 an output
as already discussed, then:

RB1 = 1;                // LED off
RB1 = 0;                // LED on

You could put the LED to ground instead of +5V and invert on/off
commands, but then the LED may turn on a little but if you enable the
internal pull-ups on port B.

You can make your code easier to read by giving the LED a name and
even defining ON and OFF.

#define LED     RB1     // Front panel LED
#define ON      0
#define OFF     1

Notice there are no end of line semicolons in a #define. Then in your
program:

LED = ON;               // Turn the LED on
LED = OFF;              // Turn the LED off

--
Brent Brown, Electronic Design Solutions
16 English Street, Hamilton, New Zealand
Ph/fax: +64 7 849 0069
Mobile/txt: 025 334 069
eMail:  RemoveMEbrent.brownTakeThisOuTspamclear.net.nz

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\02\17@023815 by Mike Singer

picon face
> > I want to make rb0 on my 16f84be an input for a
> > pushbutton and the rest of portb outputs.  so far I
> > have not been able to create working code.
>
> Enable port B passive pullups in OPTION_REG, then connect
> the pushbutton between the port B pin and ground.  The pin will
> read 1 normally, and 0 when the pushbutton is pushed
> (assuming normally open, which most of them are).

  Use soldering-iron to connect wires of a pushbutton to PCB or
connector. Don't forget to plug in the iron (when cold it can't solder).

Good luck.
Mike.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\18@120114 by Rick Regan

picon face
>Well, it does depend on the hardware, but if you
>have an LED and
>resistor connected from RB1 to +5V, and you have
>made RB1 an output
>as already discussed, then:
>
>RB1 = 1;                // LED off
>RB1 = 0;                // LED on
>
>You could put the LED to ground instead of +5V and
>invert on/off
>commands, but then the LED may turn on a little but
>if you enable the
>internal pull-ups on port B.

Isn't the internal pull-up for a given PORTB pin
disabled when that pin is made an output (at least on
the 16F84/A)?


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@121342 by Olin Lathrop

face picon face
> Isn't the internal pull-up for a given PORTB pin
> disabled when that pin is made an output (at least on
> the 16F84/A)?

Yes, on all PICs where I've looked at this.  It would be pretty boneheaded
of Microchip to leave the pullup enabled while the pin is being actively
driven low.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@130355 by Rick Regan

picon face
>Yes, on all PICs where I've looked at this.  It
>would be pretty
>boneheaded
>of Microchip to leave the pullup enabled while the
>pin is being
>actively
>driven low.

So are you agreeing with me that the following
statement in the original post was incorrect?

"... but then the LED may turn on a little but (sic)
 if you enable the internal pull-ups on port B."

In other words, the LED will NOT light.



__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@133647 by Brent Brown

picon face
On 18 Feb 2003 at 9:00, Rick Regan wrote:

> >Well, it does depend on the hardware, but if you
> >have an LED and
> >resistor connected from RB1 to +5V, and you have
> >made RB1 an output
> >as already discussed, then:
> >
> >RB1 = 1;                // LED off
> >RB1 = 0;                // LED on
> >
> >You could put the LED to ground instead of +5V and
> >invert on/off
> >commands, but then the LED may turn on a little but
> >if you enable the
> >internal pull-ups on port B.
>
> Isn't the internal pull-up for a given PORTB pin
> disabled when that pin is made an output (at least on
> the 16F84/A)?
>

Yep, you're right, my mistake, don't worry about the pullups.

--
Brent Brown, Electronic Design Solutions
16 English Street, Hamilton, New Zealand
Ph/fax: +64 7 849 0069
Mobile/txt: 025 334 069
eMail:  spamBeGonebrent.brownspamBeGonespamclear.net.nz

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\18@170610 by Olin Lathrop

face picon face
> So are you agreeing with me that the following
> statement in the original post was incorrect?
>
>  "... but then the LED may turn on a little but (sic)
>   if you enable the internal pull-ups on port B."
>
> In other words, the LED will NOT light.

Right.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...