Download AT89S8252 In-System Programming MCU Application Note
Transcript
Microcontroller ; The controller must be reset to exit this state. setb DTR_ ; force modem to drop the line hh: ret modem_cmd: ; Transmit command string to modem and validate the response. ; Return with carry set if modem fails to respond as expected, ; or if excessive parity errors or receive timeouts occur. ; Valid responses consist of a byte code followed by a carriage ; return. Parity errors and timeouts cause the command to be ; resent. Expected delays for command responses are absorbed ; by GET_CHAR. On entry, DPTR must point to a null-terminated ; command string. push mov b b, #MTRIES ; number of attempts call clr send_string RI ; transmit command string ; discard any waiting character call jc cjne call jc cjne get_char mm3 a, #OK, mm2 get_char mm3 a, #CR, mm2 clr jmp c mm4 ; receive result code ; jump on parity error or timeout ; loop if response is not valid ; receive carriage return ; jump on parity error or timeout ; loop if response is not valid ; valid response complete ; clear error flag ; return mm1: mm2: mm3: djnzb, mm1 setb c ; resend command ; out of retries, set error flag mm4: pop ret b send_string: ; Transmit string pointed to by DPTR. ; String may be of any length, but must be null-terminated. push push push acc dpl dph 5-95