ledRunningLight 1, 5, color_green, 200 ! Delete possibly existing old log f = "LOG.TXT" if fsFileExists(0,f) fsRemove 0, f endif ! Check voltage, e.g. only range from ! 3.0 V and 5.0 V is permissible v = getTargetVoltage() if (v < 3000) or (v > 5000) print "voltage [mV]: ", v, "\r\n" throw userException + 1 endif ! Set programming mode programTarget ! Check signature, e.g. ATmega32 if getSignature() <> sig_atmega32 print "wrong controller", "\r\n" throw userException + 2 endif ! Start quarz crystal, then restart target writeBits fuses_low, $fd writeBits fuses_high, $d9 restartTarget ! Set programming speed, then erase, flash, ! and start target setProgrammingSpeed 125 eraseFlash writeVerifyFileToFlash 0, "DEMO.HEX" runTarget ! Check for exception and write to log catch exception if exception <> 0 print "exception: ", exception else print "successfully flashed" ledOn 5, color_green endif ! After the exception has been caught using catch, ! set it anew. With this, the number of the exception ! gets displayed by using an LED blink code. throw exception