Exp-A/D12
72
s
Software Reference
5. Power up the controller and bring up Dynamic C on a PC. Consult the
controllers users manual if there are any problems re-establishing
communications between the PC and the controller.
6. Open and run the sample program
ADSAMPL1.C
.
7. Dynamic C will begin displaying voltage output from the TEMP pin.
8. Place a finger on the U1 chip (LT1019) case. The voltage and
temperature readings should increase after a few seconds; the readings
will decrease when the finger is removed.
Check the board jumpers, PLCBus connections, and the PC/
controller communications if an error message appears.
See the
Dynamic C Technical Reference
manual for more
detailed instructions.
ADSAMPL1.C
#define AN0 0
// global(!) signal table - one entry
#define TEMP 0
struct signal_rec adtab[1];
main(){
int i, board;
int mode = 10;
// A/D mode 10 (gain=2, unipolar)
int comp = 1;
// use EEPROM compensation
float avg, tempC, sum;
Reset_PBus();
// Always do this!
Reset_PBus_Wait();
board = plcad_addr(3);
// PAL 0, J1 unjumpered
// Make entry in signal table
add_sig_table( TEMP, board, AN0, mode, comp );
// Set mux for this signal, allow MUX to settle
set_mux(TEMP); mxdel18();
while( 1 ){
// loop forever
// Read signal 1000 times, take average
sum=0.0;
for( i=0; i<1000; i++ ){
sum += ad_conv( TEMP, plad_rd12(adch(TEMP)) );
}
avg = sum / 1000;
// convert to temperature, display on screen
tempC = (avg / 0.0021) - 273;
printf(“%f Volts %5.2f Degrees\n”,avg,tempC );
}
}
!
$
Summary of Contents for Exp-A/D12
Page 6: ...vi s Contents XP8500 and Exp A D12 Blank...
Page 10: ...XP8500 and Exp A D12 x s About This Manual Blank...
Page 11: ...XP8500...
Page 12: ...Blank...
Page 49: ...EXP A D12...
Page 50: ...Blank...
Page 58: ...Exp A D12 58 s Getting Started Blank...
Page 64: ...Exp A D12 64 s I O Configurations Blank...
Page 73: ...APPENDICES...
Page 74: ...Blank...
Page 86: ...XP8500 and Exp A D12 86 s PLCBus Blank...
Page 87: ...XP8500 and Exp A D12 Specifications s 87 APPENDIX B SPECIFICATIONS...
Page 92: ...XP8500 and Exp A D12 92 s Specifications Blank...
Page 97: ...XP8500 and Exp A D12 Simulated PLCBus Connection s 97 APPENDIX D SIMULATED PLCBUS CONNECTION...
Page 99: ...XP8500 and Exp A D12 Technical Circuit Details s 99 APPENDIX E TECHNICAL CIRCUIT DETAILS...
Page 104: ...XP8500 and Exp A D12 104 s Technical Circuit Details Blank...