uses crt, commdrv; const base = $300; var retString, ch : String; procedure ErrorCheck(CheckString:string); begin if CheckString = '??ERROR!' then begin WriteLn ('Sorry, there has been a pod communication error!'); halt; end; end; begin ClrScr; {H} WriteLn('Press a key to say hello to pod...'); ch := readkey; initcommcard(base, 9600); writepod(base, 'H'); readpod(base, retString); WriteLn(retstring); if retstring = '??ERROR!' then begin WriteLn ('Sorry there has been a pod communication error!'); WriteLn ('Your pod must be set to baud 9600.'); halt; end; {M} WriteLn('Press a key configure all the bits as inputs...'); ch := readkey; {bits 0-7 input} writepod(base, 'ML00'); readpod(base, retString); ErrorCheck(retstring); delay(50); {bits 8-F input} writepod(base, 'MM00'); readpod(base, retString); ErrorCheck(retstring); delay(50); {bits 10-17 input} writepod(base, 'MH00'); readpod(base, retString); ErrorCheck(retstring); {I} WriteLn('Press a key to read all the bits...'); ch := readkey; {read all bits} writepod(base, 'I'); readpod(base, retString); ErrorCheck(retstring); WriteLn('The twenty-four bits are ',retString); WriteLn('Press a key to read bit 0F...'); ch := readkey; {read bit 15} writepod(base, 'I0F'); readpod(base, retString); ErrorCheck(retstring); WriteLn('Bit 0F is ',retString); WriteLn('Press a key to read bits 0-7...'); ch := readkey; {read bits 0-7} writepod(base, 'IL'); readpod(base, retString); ErrorCheck(retstring); WriteLn('Bits 0-7 are ',retString); {M} WriteLn('Press a key to configure all the bits as outputs... '); ch := readkey; {bits 0-7 output} writepod(base, 'MLFF'); readpod(base, retString); ErrorCheck(retstring); {bits 0-7 output} writepod(base, 'MLFF'); readpod(base, retString); ErrorCheck(retstring); {bits 0-7 output} writepod(base, 'MLFF'); readpod(base, retString); ErrorCheck(retstring); {F} WriteLn('Press a key to create a Free-Running square wave (bit 0F period 10)...'); ch := readkey; {Free-Running square wave on bit 0F with period 10} writepod(base, 'f0F,10'); readpod(base, retString); ErrorCheck(retstring); {C} WriteLn('Press a key to read digital input counter 0F...'); ch := readkey; {read digital input counter 0F} writepod(base, 'c0F'); readpod(base, retString); ErrorCheck(retstring); WriteLn('The value of the digital input counter is ',retString); {R} WriteLn('Press a key to end free run...'); ch := readkey; {turn off free run} writepod(base, 'r0F'); readpod(base, retString); ErrorCheck(retstring); {S} WriteLn('Press a key to set time base to 1 KHz...'); ch := readkey; {set time base} writepod(base, 'S039A'); readpod(base, retString); ErrorCheck(retstring); delay(100); {O} WriteLn('Press a key to write a 0 to bit 2...'); ch := readkey; {write a zero to bit 2} writepod(base, 'O2-'); ErrorCheck(retstring); readpod(base, retString); WriteLn('Press a key to write a 1 to bit 3...,'); ch := readkey; {write a one to bit 3} writepod(base, 'O3+'); ErrorCheck(retstring); readpod(base, retString); WriteLn; WriteLn; WriteLn('You have completed the RDG-24 Sample 1 program.'); end.