??? 05/12/04 16:32 Read: times |
#70254 - Few Questions about the working of code Responding to: ???'s previous message |
Sir,
Following are few questions that i like to ask in order to understand the working or links in your code so that i understand this instead of copy pasting. can you please just write comments in front of your code lines so that i can understand the working. The program for two bits will be like; ; consider that we are processing bit P2.0 SCAN_LOOP: MOV R7,#00 ; Bit register NEXT_BIT: CALL PROCESS_BIT ;1st bit 0 is checked as R7 has 0 INC R7 CJNE R7,#1,NEXT_BIT ;considering only p2.0 to p2.1 PROCESS_BIT: MOV DPTR,#BITS_LOOKUP MOV A,R7 ; Now A has value of R7 which at this stage is 0 ADD A,R7 ;R7 is added and A has 00000000 Now what is happening here i have no idea, can you please explain why these steps are taken; ADD A,DPL MOV DPL,A JNC PROCESS_BIT_0 ; why specially this step. INC DPH And please explain what is happening under the labels of, PROCESS_BIT_0: PROCESS_BIT_1: PROCESS_BIT_R PROCESS_BIT_L PROCESS_BIT_H: Now in the following i don;t understand how two type of data representing High and Low state will go to P1. if Bit 0: at start no data go to P1 if the bit HIGH as soon as it gets Low:- 00000001B data should go to P1 and after that as soon as 5 second reached or bit show high :- 00000000B goes to P1. it may be happening in the following but i did not get it how it is happening? ; structure for process bit 0: BIT0_DESCRIPTOR: DB 00000001b DB BIT0_TIMER DB 0xA0,0xB0,0xC0 ; structure for process bit 1: BIT1_DESCRIPTOR: DB 00000010b DB BIT1_TIMER DB 0xA1,0xB1,0xC1 BITS_LOOKUP: DW BIT0_DESCRIPTOR DW BIT1_DESCRIPTOR |