Oct 17, 2007 #1 H Help Advanced Member level 2 Joined Feb 15, 2005 Messages 617 Helped 7 Reputation 14 Reaction score 3 Trophy points 1,298 Activity points 7,065 Hi, I'm using uC controlling the multiplexer. P1^0...P1^2 is control addressing multiplexer and the P1^7 is get the result from multiplexer. Is it possible to do that? How am i to write the code? Please advice. Thank You.
Hi, I'm using uC controlling the multiplexer. P1^0...P1^2 is control addressing multiplexer and the P1^7 is get the result from multiplexer. Is it possible to do that? How am i to write the code? Please advice. Thank You.
Oct 17, 2007 #2 A amraldo Advanced Member level 4 Joined Aug 29, 2004 Messages 1,183 Helped 145 Reputation 290 Reaction score 37 Trophy points 1,328 Location Egypt Activity points 5,880 AA, Yes you can do this. here are the codes the code ; making P1.0 ... P1.2 work as an input SETB P1.0; SETB P1.1; SETB P1.2; ;Writing to these bits: MOV A, #value MOV P1, A ;Reading from P1.7 MOV C, P1.7 BR, Amr Ali.
AA, Yes you can do this. here are the codes the code ; making P1.0 ... P1.2 work as an input SETB P1.0; SETB P1.1; SETB P1.2; ;Writing to these bits: MOV A, #value MOV P1, A ;Reading from P1.7 MOV C, P1.7 BR, Amr Ali.
Oct 18, 2007 #3 H Help Advanced Member level 2 Joined Feb 15, 2005 Messages 617 Helped 7 Reputation 14 Reaction score 3 Trophy points 1,298 Activity points 7,065 Hi, I'm not so familiar with assembly language. :| I had slightly your an assemble to C. Code: sbit PB0 = P1^0; sbit PB1 = P1^1; sbit PB2 = P1^2; sbit PB7 = P1^7; void main() { bit rst; while(1) { PB0 = 1; PB1 = 0; PB2 = 1; rst = PB7; } } Do you mean that? Actually i wish to structure the port IO. ex. P1^0...P1^3 is output and P1^4...P1^7 is input. Perhap using Bit Field mothed. Code: struct IO{ unsigned char OLSB:4; // P1^0...P1^3 unsigned char IMSB:4; // P1^4...P1^7 } My idea is like this. Once i assign the OLSB=3; the output port for P1^0...P1^3 result will be 1100. So for the IMSB is ready to read the data from the port. Code: OLSB=3; // control output bit rst = IMSB; // receive result from the port. Is it possible to do that? Thank You.
Hi, I'm not so familiar with assembly language. :| I had slightly your an assemble to C. Code: sbit PB0 = P1^0; sbit PB1 = P1^1; sbit PB2 = P1^2; sbit PB7 = P1^7; void main() { bit rst; while(1) { PB0 = 1; PB1 = 0; PB2 = 1; rst = PB7; } } Do you mean that? Actually i wish to structure the port IO. ex. P1^0...P1^3 is output and P1^4...P1^7 is input. Perhap using Bit Field mothed. Code: struct IO{ unsigned char OLSB:4; // P1^0...P1^3 unsigned char IMSB:4; // P1^4...P1^7 } My idea is like this. Once i assign the OLSB=3; the output port for P1^0...P1^3 result will be 1100. So for the IMSB is ready to read the data from the port. Code: OLSB=3; // control output bit rst = IMSB; // receive result from the port. Is it possible to do that? Thank You.
Oct 18, 2007 #4 A ashad Full Member level 6 Joined Mar 28, 2006 Messages 393 Helped 40 Reputation 80 Reaction score 28 Trophy points 1,308 Location Trento, Italy Activity points 3,296 in 8051 u can take input and output from any pin Remember for Inputs u have set those pins
Oct 18, 2007 #5 H Help Advanced Member level 2 Joined Feb 15, 2005 Messages 617 Helped 7 Reputation 14 Reaction score 3 Trophy points 1,298 Activity points 7,065 ashad said: in 8051 u can take input and output from any pin Remember for Inputs u have set those pins Click to expand... Thank for your remind. I understand about it. How am i to do that? Please advice. Thank You.
ashad said: in 8051 u can take input and output from any pin Remember for Inputs u have set those pins Click to expand... Thank for your remind. I understand about it. How am i to do that? Please advice. Thank You.