Searching \ for '[PIC]: BCF or MOVLW on TRISx' 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/ubicom/devices.htm?key=sx
Search entire site for: 'BCF or MOVLW on TRISx'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: BCF or MOVLW on TRISx'
2003\03\13@052342 by =?iso-8859-1?q?Tom?=

flavicon
face
Hi,

  I have PORTD pull high.
  Initialization: MOVLW  00H
                  MOVWF  PORTD
                  MOVLW  FFH
                  MOVWF  TRISD ;set all input

  I'm wondering if a single pin of portD can be
toggle input or output by using BCF,
  e.g
      BCF  TRISD,7 ; to set bit 7 of portD as output

The above don't seem to work.

However, if i use:
      MOVLW 7FH
      MOVWF TRISD

I measure and confirmed that pin 7 of portD goes low.

Is it that BCF cannot be used?


__________________________________________________
Do You Yahoo!?
Promote your business from just $5 a month!
http://sg.biztools.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\03\13@054025 by Thomas C. Sefranek

face picon face
{Quote hidden}

Specify WHICH processor.
The TRIS register is mapped in some of the older precessors.
I do this trick on the 18C452s with no problems.
I use the direction of the port pins as a tristate.

 *
 |  __O    Thomas C. Sefranek   WA1RHPspamKILLspamARRL.NET
 |_-\<,_   Amateur Radio Operator: WA1RHP
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

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

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

2003\03\13@054232 by Nigel Orr

flavicon
face
pic microcontroller discussion list <> wrote on Thursday, March 13, 2003
10:22 AM:

>    I'm wondering if a single pin of portD can be
> toggle input or output by using BCF,
>    e.g
>        BCF  TRISD,7 ; to set bit 7 of portD as output
>
>  The above don't seem to work.
>
>  However, if i use:
>        MOVLW 7FH
>        MOVWF TRISD
>
>  I measure and confirmed that pin 7 of portD goes low.
>

Check your bank bits, if necessary for your processor.  If it's not an 18F,
you will need something like

>    Initialization: MOVLW  00H
>                    MOVWF  PORTD
                               bsf STATUS,RP0  ; bank 1 for TRISx registers
>                    MOVLW  FFH
>                    MOVWF  80H^TRISD ;set all input
                               bcf STATUS,RP0  ; bank 0 for normal operation

However, the real problem is probably that when you change the port to an
output, it's initial value will be what it's just read on its input.  Try
adding clrf PORTD after you have change the tristate, to clear any output
pins.

Apart from that, I can't think why there might be a difference between your
bcf and movlw approaches, if those are the only changes to the code.

Nigel

--
Nigel Orr, Design Engineer                 .....nigelKILLspamspam.....axoninstruments.co.uk
Axon Instruments Ltd., Wardes Road,Inverurie,Aberdeenshire,UK,AB51 3TT
              Tel:+44 1467 622332 Fax:+44 1467 625235
                  http://www.axoninstruments.co.uk

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

2003\03\13@055736 by Jason Dini

flavicon
face
I had a similar problem. I'm sure it must be dependent on what pic you're
using.

Jason

-----Original Message-----
From: Tom [EraseMEtom12sgspam_OUTspamTakeThisOuTYAHOO.COM.SG]
Sent: Thursday, March 13, 2003 12:22
To: PICLISTspamspam_OUTMITVMA.MIT.EDU
Subject: [PIC]: BCF or MOVLW on TRISx


Hi,

  I have PORTD pull high.
  Initialization: MOVLW  00H
                  MOVWF  PORTD
                  MOVLW  FFH
                  MOVWF  TRISD ;set all input

  I'm wondering if a single pin of portD can be
toggle input or output by using BCF,
  e.g
      BCF  TRISD,7 ; to set bit 7 of portD as output

The above don't seem to work.

However, if i use:
      MOVLW 7FH
      MOVWF TRISD

I measure and confirmed that pin 7 of portD goes low.

Is it that BCF cannot be used?


__________________________________________________
Do You Yahoo!?
Promote your business from just $5 a month!
http://sg.biztools.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

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

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