PDA

View Full Version : overwrite porta



mischl
- 2nd May 2005, 21:09
hello

in a little subroutine i have an effect which i can't unterstand.
set first one bit from a.0 to a.3 to high (part1 in code) and the manipulate only a.5 (part2). but the instruction to set a.5 high, clears the active output from porta set in part1. but both should be set after that...
thanks for a support

gabel var porta.5

init: clear
TRISA = %00000000
TRISB = %00000000
TRISC = %01110000
PORTA = 0
PORTB = 0
PORTC = 0
low gabel

main:
...

GOTO main

lamp:
' ----- part 1 -----
PORTA = 0
PORTB = 0
porta.0[taster-8] = 1 ' between a.0 und a.3

' ----- part 2 -----
high gabel ' a.5
pause 500
low gabel

GOTO main

BobK
- 3rd May 2005, 03:11
Hi Mischl,

I'll save the more experienced people the reply.

1. What MCU are you using?
2. Does it have an analog port?
3. Did you disable the analog port and make it digital?
4. Did you disable the comparators if they're on your MCU?
5. Did you read the MCU data sheet?

There are enough posts on this forum to answer your questions and also give you the answers to the above.

Excuse me if this sounds like a smart ass but usually anything out of the ordinary happening with port A can be blamed on not changing the port to digital and disabling the analog feature and the comparators.

BobK.

mischl
- 3rd May 2005, 10:42
ok, thanks.
it is ever the same : first i don't find anything and think this must be a new problem (because trisa=0 makes all i need)! and then when i know there is a mistake at me, i find the informations very quick... ;-)

adcon1 = 7 ' switch from analog to digital

nice description :
http://www.picbasic.co.uk/forum/showthread.php?t=561

mister_e
- 3rd May 2005, 15:57
depending of your PIC dude! wich one you play with!!



3. Did you disable the analog port and make it digital?
4. Did you disable the comparators if they're on your MCU?
5. Did you read the MCU data sheet?