| ??? 02/20/10 13:02 Modified: 02/20/10 13:51 Read: times |
#173345 - Question on asm code |
GETCMD:
MOV A,#0
ACALL CHAR_IN ;WAIT FOR PC TO SENT A CHARACTER
;NOW PROCESS
CJNE A,#'1',NOT1 ;IF ITS NOT 1 THEN CHECK NEXT POSSIBILITY
ACALL SUB1 ;ELSE ITS 1
NOT1: CJNE A,#'2',NOT2 ;IF ITS NOT 2 THEN CHECK NEXT POSSIBILITY
ACALL SUB2 ;ELSE ITS 2
NOT2: CJNE A,#'3',NOT3 ;IF ITS NOT 3 THEN CHECK NEXT POSSIBILITY
ACALL SUB3 ;ELSE ITS 3
NOT3: CJNE A,#'4',NOT4 ;IF ITS NOT 4 THEN CHECK NEXT POSSIBILITY
ACALL SUB4 ;ELSE ITS 4
NOT4:
ENDCHK:
RET
SUB1: MOV A, #01h
MOV P2, A ;TURN ON PORT2 PIN 0
ACALL DELAY
MOV P2, #00h
RET
SUB2: MOV A, #02h
MOV P2, A ;TURN ON PORT2 PIN 1
ACALL DELAY
MOV P2, #00h
RET
SUB3: MOV A, #04h
MOV P2, A ;TURN ON PORT2 PIN 2
ACALL DELAY
MOV P2, #00h
RET
SUB4: MOV A, #08h
MOV P2, A ;TURN ON PORT2 PIN 3
ACALL DELAY
MOV P2, #00h
RET
i using a 8051 base chip my program will receive serial data, then check for the four possibility to on the specify pin on port 2 the GETCMD code is take from the guide of Jon Ledbetter the SUB1-SUB4 is wrote by me if i receive the correct data on serial port, then i will turn on the port 2 pin so it can give 5v output at the pin the port2 pin0-pin3 will connected to a npn transistor's base separately i need to short the wire at collector of transistor to the wire at emitter when the base turn on can i do so with my code? any suggestion are welcome Mathew |
| Topic | Author | Date |
| Question on asm code | 01/01/70 00:00 | |
| 2 things | 01/01/70 00:00 | |
| some change | 01/01/70 00:00 | |
| even simpler | 01/01/70 00:00 | |
| thanks for the simplified | 01/01/70 00:00 | |
| yes, and even simpler | 01/01/70 00:00 | |
| code and comments | 01/01/70 00:00 | |
| ;; ?? | 01/01/70 00:00 | |
| thanks for the explanation | 01/01/70 00:00 | |
| Short? | 01/01/70 00:00 | |
| need some helps | 01/01/70 00:00 | |
| Your circuit should work | 01/01/70 00:00 | |
| Getting Rid Of Power On Relay Energize | 01/01/70 00:00 | |
Thank You All | 01/01/70 00:00 | |
| document what happens to ACC. | 01/01/70 00:00 | |
| noticed and questions | 01/01/70 00:00 |



