> 3.2.2 | Download Protocol for ASC0 / ASC1

> Figure 7: Download protocol for ASC0 / ASC1

> 3.2.2.1 | Example of Firmware Download Program for ASC0/ASC1

> This section presents an example of a firmware download utility based on the widely used programming language “C”.

> void DoUpdate (void) { BYTE bAnswer ; BYTE bRecordLen ; BYTE bRecordData[MAX_RECORD_SIZE] ; /* Send AT command */ WriteToModule ((BYTE *) "AT^SFDL\r", 8) ; /* Wait for answer */ if (!ReadResultLineFromModule ()) /* Error */ return ; /* Wait for start pattern */ do { ReadFromModule (&bAnswer, 1) ; } while (ANSWER_OK != bAnswer) ; do { /* Read record from file */ bRecordLen = MAX_RECORD_SIZE ; FileReadRecord (&bRecordLen, bRecordData) ; do { /* Send length of record */ WriteToModule (&bRecordLen, 1) ; /* Send data of record */ WriteToModule (bRecordData, bRecordLen) ; do { /* Wait for answer */ ReadFromModule (&bAnswer, 1) ; } while (ANSWER_BUSY == bAnswer) ; } while (ANSWER_RETRY == bAnswer) ; } while (ANSWER_OK == bAnswer && !FileEnd ()) ; }