LOAD MEASURE.DMO PE_SWD = 0 /* Disable Watchdog with pin PE_SWD */ reset /* perform CPU reset: uses value at PE_SWD */ G,MAIN /*--------------------------------------------*/ /* MyStatus shows analog and other values ... */ /*--------------------------------------------*/ FUNC void MyStatus (void) { printf ("=============================\n"); printf (" Analog-Input-0: %f\n", ain0); printf (" Analog-Input-1: %f\n", ain1); printf (" Analog-Input-2: %f\n", ain2); printf (" Analog-Input-3: %f\n", ain3); printf (" Register (DPTR): %04X\n", DPTR); printf (" Program Counter: %06lXH\n", $); printf ("=============================\n"); } /*-------------------------------------------*/ /* Function MyRegs() shows Registers R0...R3 */ /*-------------------------------------------*/ FUNC void MyRegs (void) { printf ("---------- MyRegs() ----------\n"); printf (" R0 R1 R2 R3\n"); printf (" %02X %02X %02X %02X\n"); printf ("------------------------------\n"); } /*-----------------------------------------------*/ /* Analog0() simulates analog input values given */ /* to channel-0 (AIN0) of the C515 derivative */ /*-----------------------------------------------*/ Signal void analog0 (float limit) { float volts; printf ("Analog0 (%f) entered.\n", limit); while (1) { /* forever */ volts = 0; while (volts <= limit) { ain0 = volts; /* analog input-0 */ twatch (200000); /* 200000 Cycles Time-Break */ volts += 0.1; /* increase voltage */ } volts = limit; while (volts >= 0.0) { ain0 = volts; twatch (200000); /* 200000 Cycles Time-Break */ volts -= 0.1; /* decrease voltage */ } } }