Author Topic: Unusual bit setting  (Read 1930 times)

0 Members and 1 Guest are viewing this topic.

Offline resnaTopic starter

  • Beginner
  • *
  • Posts: 1
  • Helpful? 0
Unusual bit setting
« on: April 18, 2008, 02:44:15 AM »
Hello everyone,

Im using a pic16f877a microcontroller.

Is there any chance, the minutest, littlest of chance that the pins RC7 and RC6 would be set logical high for the following code

Code: [Select]

                    ORG        000H
                    GOTO     MAIN

                    ORG        200H
MAIN
                    NOP

                    GOTO      $

                    END

I know this is completely out of the ordinary. But I just want to know if something like what I mentioned is even remotely possible because for the above program my RC7 and RC6 pins are high.

If something like that is not possible then it must be some electrical problem in my development board.

Thank you
« Last Edit: April 18, 2008, 02:45:16 AM by resna »

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Unusual bit setting
« Reply #1 on: April 18, 2008, 04:46:14 AM »
Yes there is a chance. You should never assume that registers and ports are set up like you think on reset. You must always configure them yourself.

Try changing your code to configure the ports. Here  -
Code: [Select]
                    ORG        000H
                    GOTO     MAIN

                    ORG        200H
MAIN
                    BANKSEL    TRISC
                    MOVLW     0x00
                    MOVWF     TRISC ;Set them all to output

                    BANKSEL    PORTC
                    MOVLW     0x00
                    MOVWF     PORTC ;Set them all to logical low

LOOP            NOP

                    GOTO      LOOP

                    END
« Last Edit: April 18, 2008, 04:47:21 AM by hazzer123 »
Imperial College Robotics Society
www.icrobotics.co.uk

 


Get Your Ad Here