home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 September
/
pcwk_09_96.iso
/
demo
/
wgelectr
/
pk51demo
/
files.2
/
EXAMPLES
/
MEASURE
/
DSCOPE.INI
next >
Wrap
Text File
|
1995-09-27
|
2KB
|
75 lines
load 80517.dll
load measure
PA main
PA timer0
PA clear_records
PA measure_display
PA save_current_measurements
PA read_index
PA set_time
PA set_interval
WS current,10
RESET PA /* Initialize Performance analyzer */
/*--------------------------------------------*/
/* 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-Bank: %d\n", (psw & 0x18) >> 3);
printf (" Program Counter: %06lXH\n", $);
printf ("=============================\n");
}
/*-------------------------------------------*/
/* Function MyRegs() shows Registers R0...R7 */
/*-------------------------------------------*/
FUNC void MyRegs (void) {
printf ("-------- MyRegs() --------\n");
printf (" R0 R1 R2 R3 R4 R5 R6 R7\n");
printf (" %02X %02X %02X %02X %02X %02X %02X %02X\n",
R0, R1, R2, R3, R4, R5, R6, R7);
printf ("--------------------------\n");
}
/*-----------------------------------------------*/
/* Analog0() simulates analog input values given */
/* to channel-0 (AIN0) of the 80C517 */
/*-----------------------------------------------*/
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 (30000); /* 30000 Cycles Time-Break */
volts += 0.5; /* increase voltage */
}
volts = limit - 0.5;
while (volts >= 0.5) {
ain0 = volts;
twatch (30000); /* 30000 Cycles Time-Break */
volts -= 0.5; /* decrease voltage */
}
}
}
define button "Go til main", "g, main"
define button "Analog0..5Volts", "analog0 (5.0)"
define button "Kill Analog0", "signal kill analog0"
define button "My Registers", "MyRegs ()"