Hi
Please help me with the query included in the attachment. Thank you.
Regards
PG
Please help me with the query included in the attachment. Thank you.
Regards
PG
Attachments
-
272.2 KB Views: 20
The instruction:Hi
Please help me with the query included in the attachment. Thank you.
Regards
PG
Thanks a lot, BillO.Yes, you have the right idea. You need to write 1 to any pin that you use as an input because of the way the port IO is designed on an 8051. However, any pin that has been set to logic 1 can be used as an input while it is still at logic 1.
Unless you need all pins of a port as input, you do not have to write FF to the port. As an example, you could keep the 4 MSB high and use them as inputs while using the 4 LSB as outputs. That way the data being written to the port would have a value from 0 to F then to keep the 4 MSB as input OR the data byte with 0xF0 before writing to the port.
I hope I did not confuse you, as this is an interesting and a kind of complicated component of 8051 programming.
Have to register in order to get to your questions?Could you please help me with the queries below? It would be really nice of you. I have an exam tomorrow and I need your help. Thanks.
You could find Q1 here, Q2 here, and Q2, Q3, Q4, and Q5 here. Thank you.
Hi AllenHave to register in order to get to your questions?
Allen
;-------Delay Subroutine
;period of one MC = 0.001 ms
;75(50(255x2x0.001)) = 1912.5 ms = 2 s
org 0x300
Delay:
mov R0, #75 ;1 MC
L1: mov R1, #50
L2: mov R2, #255
L3: DJNZ R2, L3 ;2 MC
DJNZ R1, L2
DJNZ R0, L1
RET ;2 MC
end
;please notice that we have ignored extra delay corresponding to some instructions in the Delay
;subroutine and this extra delay is: {50(1+2) + 75(1+2) + 2} x 0.001 = 0.377 ms = 0.000377 s
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
[8051] Edsim51 7 Segment Display Issue | Programming & Languages | 1 | ||
Edsim51 7 Segment Display Issue | Microcontrollers | 0 | ||
8051 need help with code:CCC | Microcontrollers | 6 | ||
M | alarm control 8051 assembly code help | Programming & Languages | 3 | |
C | Erasing AT89S52 error | Microcontrollers | 0 |