![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| Experienced Member | Code: org 000h
goto main
org 200h
main
nop
banksel trisb
movlw h'ff'
movwf trisb
banksel portb
clrf portb
goto $
end I checked and double checked with the code and couldn't find anything I might have missed, but no matter what, I couldn't find out why the portb register is not setting all of its bits. I checked the data sheet to see if in case port b has any special requirements or something. Couldn't find anything there. Am I wrong somewhere? Thank you
__________________ A scientist trys to see the world the way it is An enginneer trys to see a world that has never been |
| | |
| | (permalink) |
| Experienced Member | hi, Whats the PIC type.? How have you checked the PORTB port pins to know they are not cleared.?
__________________ Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
| | |
| | (permalink) |
| Experienced Member | You configured all pins of PORTB as inputs. The value of each bit of the PORTB register depends on the external voltage you apply to each pin. Clearing the PORTB register does not affect the state of the output pins. |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Im using a PIC16f877a controller. Im using the simulator available in MP-LAB. And when I step through the code, the port b register never seems to clear. Atleast that is what the simulator shows.
__________________ A scientist trys to see the world the way it is An enginneer trys to see a world that has never been | |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Im not trying to effect any change on the portb output pins. I just want to clear the portb "latch register", so i can prepare it for receiving input. Thank you
__________________ A scientist trys to see the world the way it is An enginneer trys to see a world that has never been | |
| | |
| | (permalink) | |
| Experienced Member | Quote:
It clears OK in my OSoft sim, I'll try it later in MPLAB.
__________________ Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ | |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Mike. | |
| | |
| | (permalink) |
| Experienced Member | Also the ports are not fully implemented in the simulator and hence you will not see change on the port. There is some method of designing a stimulus file but I never cared for it. Sure someone else can assist with this.
__________________ I can still log in! Delete my account and all my post now. |
| | |
| | (permalink) |
| Experienced Member | To simulate inputs in MPLAB Sim, you need to use the Stimulus Controller. You assign actions to the pins you want and click the "fire" button when you want the action to occur. I find the toggle option to be the most useful:
__________________ --- The days of the digital watch are numbered. --- |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Wouldn't that be considered an input signal to the controller even though the signal did not originate externally? I hope that was clear Thank you
__________________ A scientist trys to see the world the way it is An enginneer trys to see a world that has never been | |
| | |
| | (permalink) | |
| Experienced Member | Quote:
what do you mean ports are not fully implemented in the simulator, may i ask? Do you mean the simulator does not simulate the controller accurately and that MPLAB is an incomplete program?
__________________ A scientist trys to see the world the way it is An enginneer trys to see a world that has never been | |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Mike. | |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Am I right mike? Thank you
__________________ A scientist trys to see the world the way it is An enginneer trys to see a world that has never been | |
| | |
| | (permalink) |
| Experienced Member | You are correct. But remember, if your port is configured as output it will still read the pins. A highly loaded output pin with it's latch bit set can still read back zero. Mike. |
| | |
| | (permalink) | |
| Experienced Member | Quote:
__________________ A scientist trys to see the world the way it is An enginneer trys to see a world that has never been | |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Latest |
| weird reading on the multimeter. | maor | General Electronics Chat | 3 | 14th July 2007 10:16 PM |
| weird pic code problem | Fletcher | Micro Controllers | 9 | 13th October 2004 02:39 PM |
| Infrared receiver acting weird | Lac | General Electronics Chat | 16 | 10th August 2004 02:36 PM |
| weird transformer | smack_whore | General Electronics Chat | 0 | 1st April 2004 11:48 AM |
| Weird 12F629 GPIO setting? | eirikr | Micro Controllers | 3 | 14th March 2004 04:08 AM |