HELP!!!!!!!!!!18FL452

Started by shaunundergrad September 27, 2003
hi guys,
how do i use the lsb nibble of a port address? i.e., i have 4
switches on porta lsb nibble and 4 switches on portc lsb nibble,
iwant to mirror the switch positions to portd, but i'm using the
other nibbles on both ports (can't change as pcb)so i can't use
swapf and iorf.....any ideas????

best regards

shaun



--- In , "shaunundergrad" <collier@s...>
wrote:
> hi guys,
> how do i use the lsb nibble of a port address? i.e., i have 4
> switches on porta lsb nibble and 4 switches on portc lsb nibble,
> iwant to mirror the switch positions to portd, but i'm using the
> other nibbles on both ports (can't change as pcb)so i can't use
> swapf and iorf.....any ideas????
>
> best regards
>
> shaun
HI GUYS,
I MANAGED TO DO IT BY CAPTURING PORTS INTO A SPARE REGISTER, THEN
ROTATING LEFT 4 TIMES EACH PORT THEN ORING, THEN SWAPPING NIBBLES,
THEN PUTTING ON PORTD. SEEMS LONG WINDED ANYBODY GOT QUICKER
WAY???....PORTD STOPPED WORKING FOR SOME REASON...HMMMM
REGARDS

SHAUN


hello shaun
 
;capture the lsb nibble of portc
movf     PORTC,W
andlw   B'00001111'
movwf   Temp
 
;swap lsb nibble with msb nibble
swapf   Temp,F
 
;capture the lsb nibble of porta
movf     PORTA,W
andlw   B'00001111'
 
;joint the two nibbles
iorwf    Temp,F
 
;save lsb nibble of porta in lsb nibble of portd and
;save lsb nibble of portc in msb nibble of portd
movf     Temp,W
movwf   PORTD
 
I hope to help you.
 
Ntor A. Marchesini
ChajarEntre Rios-Argentina
ICQ # 50983752 nick colo
n...@xinet.com.ar
http://www.deselectronica.com.ar
----- Original Message -----
From: shaunundergrad
To: p...@yahoogroups.com
Sent: Saturday, September 27, 2003 6:22 PM
Subject: [piclist] Re: HELP!!!!!!!!!!18FL452

--- In p...@yahoogroups.com, "shaunundergrad" <collier@s...>
wrote:
> hi guys,
> how do i use the lsb nibble of a port address? i.e., i have 4
> switches on porta lsb nibble and 4 switches on portc lsb nibble,
> iwant to mirror the switch positions to portd, but i'm using the
> other nibbles on both ports (can't change as pcb)so i can't use
> swapf and iorf.....any ideas????
>
> best regards
>
> shaun