PDA

View Full Version : i need help



illas
- 24th June 2005, 09:41
i have some problem copy a save temp data to PORTC

first:

BANKSEL RCSTA
movlw 0
movwf RCSTA

i will turn off serial port being use in PORTC.

second:

BSF STATUS,5
clrf TRISC
BCF STATUS,5
clrf PORTC
make the portc as output port.

e.g: already bit set bit0,1,2 then wanna store into a temp file register
temp inside value will be 0x7. which mean bit,0,1,2 will be in high stats

movf PORTC,W
movwf temp ; temp register

then for some reason want copy back to portc
movf temp,W
movwf PORTC

here the problem i faced, it gave me 0 value in PORTC.
Help Help Help
anyone know the problem here ? urgently

thank you

mister_e
- 24th June 2005, 16:54
Assembler //////programmers DEVIL\\\\\\\

if i read/understand correctly you read from a whole port wich is currently set as output on all pins and then, you want to send the same value to the same portc??? sounds bad to me....

i'm probably wrong on all but i try to stay as far to the assembler as i can. A brief description of what you want to do and the whole code will be appreciated on PM. i have some spare time and can try to make it work.

Since it's a PicBasic forum, i doubt that you'll find many answer from many user(exept 2-3) here. the best way i guess is to go to Microchip forum where all "assembler guru's" reside. or post a request on their tech support site... sometimes they answer fast.

here's the link
http://support.microchip.com/scripts/slxweb.dll/external?name=webticketcust

illas
- 25th June 2005, 17:06
hi steve

i was doing a project. for some reason i need to copy variable file register to the portc. but anyway i found the mistake i make. i really thank that you willing
to help me.

Dave
- 26th June 2005, 14:22
Illas, The problem is this, you are not writing any thing other than 00h to PortC after setting it to all outputs.

BSF STATUS,5
clrf TRISC <---------- sets direction register for ALL output
BCF STATUS,5
clrf PORTC <-------------- sets port latch register for 00h

movf PORTC,W <-------- copy portc to w (portc = 0oh)
movwf temp ; temp register <----- copy w to temp (w = 00h)

movf temp,W <-------- copy temp to w (temp = 00h)
movwf PORTC <-------- copy w to portc (w=00h)

Where are you setting the individual bits you are talking about?

Dave Purola,
N8NTA