PDA

View Full Version : BCD problem



Tobias
- 14th September 2008, 04:53
I am using a 16F876A. I am using a Grayhill BCD on the PortB.0-3 ports. I followed the example awesome Melanie gave in http://www.picbasic.co.uk/forum/archive/index.php/t-66.html

Here is my problem, when I ICD I don't get the values expected. I check the each ports state and they are correct except for PortB.3, its high at 1.5 v and all others are 5v when high. Yet in the ICD I don't get the right number most of the time. Here is what I get

BCD ICD
0 8
1 9
2 10
3 11
4 12
5 13
6 14
7 15
8 8
9 9

Here is my code

myvar var word

define OSC 20

loop:
TRISB=$FF
OPTION_REG.7=0
Myvar=PORTB
Myvar=Myvar & $0F
pause 10
Myvar=Myvar ^ $0F


goto loop

Any help? This is driving me nuts. I am sure its simple yet I have been staring at this damn thing for hours.

Pic2008
- 14th September 2008, 14:04
You need to disable LVP.

Tobias
- 14th September 2008, 16:36
Thank you, that did it.