dira question
Lucky
Posts: 98
When you code "dira[noparse][[/noparse]pin]~", the pin is at high impedance(input). Now when its NOT'ed (!dira[noparse][[/noparse]pin), which sets it to an output, does the prop automatically have the pin connected to ground, or do you also have to write outa[noparse][[/noparse]pin]~ to pull the pin low. The reason I'm asking is because the ps/2 protocol has both the data and clock lines pulled up to·+5V. So when I want to transmit something to the keyboard, such as the states of the Caplock,NumLock, and ScrLock LEDS, I have the Data·line (connected to P19) go Dira[noparse][[/noparse]DatPin]~ to transmit a 1 and·dira[noparse][[/noparse]DatPin]~~ to transmit a 0. Is this okay or not? I'm not seeing any of the three LEDS flash and nothing is happening on the data line·when I monitor it on a oscilloscope.
······································································································································································· -Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"You do not really understand something unless you can explain it to your grandmother."
-Lucky[size=-1][/size]
······································································································································································· -Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"You do not really understand something unless you can explain it to your grandmother."
-Lucky[size=-1][/size]
Comments
outa[noparse][[/noparse]pin]~~ ' sets to high but pin is not output yet
dira[noparse][[/noparse]pin]~~ ' the high is now transmitted
dira[noparse][[/noparse]pin]~ ' the pin is now low and an input
You can also do it in one line like
dira[noparse][[/noparse]pin] := outa[noparse][[/noparse]pin] := 1 'sets pin output and a high
PS - Granny ( and others ) may not understand your explanation no matter how well you know your stuff or how clear and concise your explanation.
Post Edited (kwinn) : 4/3/2010 1:20:29 PM GMT
-Phil
@PhiPi: Thanks for clearing up that part of the question.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"You do not really understand something unless you can explain it to your grandmother."
-Lucky[size=-1][/size]
To emulate OPEN Colector output.
1.Have first Pin as INPUT
2.OUT pin=0
3.DIR pin=1 - Required time to have that pin as 0-GND
4.DIR pin=0 - Reset Dir to INPUT (Open Colector simulation) - External resistor drives that pin now HIGH-1
NEXT PULSE -
Points 4-3 agin
Regards
Christoffer J
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer.
Don't guess - ask instead.
If you don't ask you won't know.
If your gonna construct something, make it·as simple as·possible yet as versatile as posible.
Sapieha
To simulate an open-drain output, you've got exactly the right idea. You don't need to touch outa at all; just modulate dira. The caveat, of course, is that the bit polarity is reversed, as compared with modulating outa.
-Phil