Thanks to both of you,
The Tips & Tricks documentation is cool :-)
I'll have a try with tis stuff.
Thanks to both of you,
The Tips & Tricks documentation is cool :-)
I'll have a try with tis stuff.
Roger
Well,
After a few hours trying to get a positiv result, I just got nothing working.
I would like to read two buttons connected to one pin.
The states are "0" and "1". The third "Z" state is not relevant to me here.
To make sure I have an intermediate level, I use a 2 resistor divider like described in the first post.
Currently, I can't get clear "0" or "1" states.
Any idea?
I use PORTB.5 of my PIC16F88 for buttons because it is a TTL input only.Code:OSCCON = %01100000 '4MHz OPTION_REG = %10000000 'D I S A B L E PORTB's Pull-Ups for buttons ANSEL = %00000000 'Disable Analogue Inputs TRISB = %00010000 'Inputs/Outputs PORTB = %00000000 'Drive all ports low MAIN: IF PORTB.5 = 0 THEN PORTB.0 = 1 IF PORTB.5 = 1 THEN PORTB.1 = 1 PAUSE 1000 PORTB.0 = 0 PORTB.0 = 0 Goto MAIN end
Roger
you have PORTB.4 set as input, not PORTB.5Code:TRISB = %00010000 'Inputs/Outputs
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Thanks Paul,
It was again far to obvious to me (the tree in the forest story...).
I'll try again tomorrow and let you know.
Thanks a lot.
Roger
Well,
I've still got one led always ON.
In my understanding, I should get a state where no Led is ON.
Is this correct?
Roger
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1504&stc=1&d=117511986 5">
I'm not sure about the ANSEL register. Shall I stay DIGITAL or ANALOG?
I tried both but I get always the same result.
I found this in the data-sheet; it's about the TTL levels.<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1505&stc=1&d=117512006 5">
As far as I can understand, the LOW level will be between Vss and 0,15V and the HIGH level between 2V and Vdd.
Is this correct?
Roger
Bookmarks