Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 2nd December 2005, 06:31 AM   (permalink)
Default Very strange problem with portb in 16F628

Hi,
I get a very strange problem... using 16F628
I'm using RB0 and RB1 for serial ps/2 interfacing (clk and data lines).
It works great but when the program reaches some place RB0 and RB1 refuse to go low. I mean, if I clear its bit in portb register, the line never goes low again... This, of course, makes the whole circuit stop working.

After hours, I found that this begins to happend after executing this instruction:

bcf portb, 2h

I really don't undertand. If I erase this instruction, it works again...
portb is set all outputs except RB0 and RB1 which are toggle from input to output to get 5V from pull up resistor or ground.
I set comparator off, writting 0x7 to CMCON..

Any advice?? I really don't understand!
Thank you!
patroclus is offline  
Old 2nd December 2005, 09:09 AM   (permalink)
Default Read modify write

Are you aware of the "read-modify.write" behaviour?

It's the way ports in PICs work. Go to the manual. It is explained there.
__________________
Agustín Tomás
In theory, there is no difference between theory and practice. In practice, however, there is.
atferrari is offline  
Old 2nd December 2005, 09:35 AM   (permalink)
Default

If you read the other thread that you started you will see that I explained that this would happen and why.

Mike.
Pommie is online now  
Old 2nd December 2005, 02:20 PM   (permalink)
Default

Sorry!! I forgot, you're right. Thank you!
patroclus is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 05:32 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker