tags:

views:

51

answers:

1

I'm studying in high school, and we have an electronics project.

We have an output from our computer which is 4 bit, output address is 37Ah and my teacher did this:

outportb(0x37A,0x80);

so what will appear in the output? 0h or 8h?

+1  A: 

You need to explain your problem a little better. What microprocesser do you use etc. Is it a 4-port output you have?

But 0x80 is equal to: 0b1000000 and if you use the lower 4 bits: 0b1000xxxx, then they will be zero (not turned on). This will happen if 0x37A is 8bit.

Otherwise, explain your problem better :)

Can't you try and see what happens? or is it only theoretical until now?

EDIT:

I see it is a printer port. Check http://www.tinet.cat/~sag/gifs/ParallelPort.gif if you use port 2,3,4,5 then the upper 4 bits really doesn't matter :) as said in my comment.

lasseespeholt
Ok hmm, It's for an electronics project.Our computers at school run pentium 4 or 3 I think,they're kinda old.But we have an output which is only 4bits from the computer, and we connect it to our electronics project.but here the teachers sends a 8bit data to a 4bit output,so I don't understand what happens - only the 4 lower bits are going out or all of them( cut the number to 2 4bit numbers)?
Tal
The 'Y' in 0xY0 will properly be discarded because you only need the lower 4 bits. But again, it depends on several things. It could also use the upper 4 bits. But the lower 4 bits is what I would bet on ;)
lasseespeholt
It's not directly related to computers you are using. What you seem to be doing is called bit-banging. You are using standard hardware to create special output. The point is how software processes your output.
AndrejaKo
Ok got it, thank you :)!
Tal