![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| 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! | |
| |
| | (permalink) |
| 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. | |
| |
| | (permalink) |
| If you read the other thread that you started you will see that I explained that this would happen and why. Mike. | |
| |
| | (permalink) |
| Sorry!! I forgot, you're right. Thank you! | |
| |