| ??? 03/07/07 15:26 Read: times |
#134495 - this will (almost) work if you only have one data Responding to: ???'s previous message |
SERIAL:
;;;;;;; push the registers used
JNB RB8,GET_DATA ;Jump if RB8=0 means data
;;;;;;; use a instead of b, then you can do a cjne
MOV B,SBUF ;Move the copy to Accumulator
CJNE B,#001H,GO_ON ;Compare the Address if its equal to 001H then
CLR SM2 ;Clear the SM2 to get the data
;;;;;;;; move GO_ON to the last reti, it is advisable to have only one exit point
GO_ON: RETI ;Return back from ISR
GET_DATA: MOV A,SBUF ;Get the copy to Accumulator
;;;;;;;; move a to a variable for main to see
;;;;;;;; here you need setb, NOT clr
CLR SM2 ;Clear the SM2 for agian for the Address
;;;;;;;; pop the registers used
RETI ;Returnthis will (almost) work if you only have one data byte.
Erik |



