??? 03/24/04 01:08 Read: times |
#67326 - RE: Help with binary input Responding to: ???'s previous message |
Ok....
Lets guess that your binary lines and strobe signal are attached to Port 1 of your microcontroller as shown in the small diagram below. The diagram also shows how the strobe comes to an active high as at the time to indicate that the four binary data bits have valid data on them. ![]() You could write some code as follows to input the four bit binary code into a register in the microcontroller. INIT: MOV P1, 0FFH ;ensure port 1 is for inputting . . . . . . GET_NIBBLE: MOV B, P1 ;save initial copy of strobe bit ;...to B.4 GET_NIBB_LP: MOV A, P1 ;poll P1.4 for change from 0->1 MOV C, ACC.4 ;get C as present strobe level ANL C, /B.4 ; AND current state with not prev JC GOT_NIBBLE ; we have the nibble value MOV B, A ; save current strobe bit as new prev JMP GET_NIBB_LP ;loop till we see 0->1 edge ; GOT_NIBBLE: ANL A, #00FH ;mask the low 4 bits for out data ADD A, #'A' ;make a letter code from nibble ;i.e. input 0000B -> 'A' ; 0001B -> 'B' ; 0010B -> 'C' ; ... ; 1110B -> 'O' ; 1111B -> 'P' ; CALL LCD_OUT ;send letter code in A to LCD . . . . . . OK...there you go. You will have to work out how the LCD output works. Michael Karas |
Topic | Author | Date |
Help with binary input | 01/01/70 00:00 | |
RE: Help with binary input | 01/01/70 00:00 | |
RE: Help with binary input | 01/01/70 00:00 | |
RE: Help with binary input | 01/01/70 00:00 | |
RE: Help with binary input | 01/01/70 00:00 | |
RE: Help with binary input | 01/01/70 00:00 | |
RE: Help with binary input | 01/01/70 00:00 | |
RE: Help with binary input![]() | 01/01/70 00:00 | |
RE: Help with binary input | 01/01/70 00:00 |