Remote Technologies RPC-320 Differential Mode, Examples u sing CON FIG AIN, Acquiring Analog Data

Page 37

ANALOG INPUT

following tables for differ ential inputs.

When channel = odd

Pol.

-

+

-

+

-

+

-

+

CH #

0

1

2

3

4

5

6

7

channel

1

 

 

3

5

 

 

7

When channel =

even

 

 

 

 

 

Pol.

+

-

+

-

+

-

+

-

CH #

0

1

2

3

4

5

6

7

channel

0

 

 

2

4

 

 

6

When range = 0, the input is ±2.5 v olts and a 1 = 0 to 5 volts.

Differential Mode

When d ifferential m ode is specified , inpu ts are actu ally pseudo-differential. What this means is that a ground reference is needed. For example, you cannot place a battery be tween ch annel 0 and 1 and get an ac curate reading. T he (-) input must be referenced to ground. An example of where pseudo-differential works is an output from a bridge network.

Apseudo-differential input subtracts the DC component from an input. T he IC maker recomm ends the (-) input remain stable within 1 count with respect to ground for best results. Connecting a 0. 1 uF capacitor from the (-) input to grou nd wor ks well.

When operating in differential mode, r elative + and - voltages must be connected to specific inputs. When inputs are reversed, a conversion returns a 0. When the relative voltage changes, perform a conversion on the alternate c hannel. CON FIG AIN is p erfor med on b oth channels.

Pairs of channels c an be differ ential while oth ers single ended. Thus, if channel 0 and 1 are differ ential inputs, channels 2-7 may be single ended.

Examples u sing CON FIG AIN

Below are sample syntaxes for CO NFIG AIN

Differential, 0 to + 5V input

CON FIG AIN 0,0, 1

CON FIG AIN 1,0, 1

SECTION 10

Per form a conver sion as nor mal:

A = AIN(0)

The difference between channel 0 and 1 is returned. When channel 1 is more positive than channel 0, the result is zero. The differenc e is read on channel 1 by performing:

A = AIN(1)

Single-ended, ±2.5V input

CONFIG AIN channel, 1 , 0

The result is 0 for -2.500V input, 2048 for 0. 000V, and 4095 for + 2.4988V.

Acquiring Analog Data

Analog data is accessed with the AIN function. The syntax is:

A = AIN(channel)

This function assigns the analog value of a channel to the variable ; A in th is case. The value retur ned is alway s in the 0 to 4095 range bec ause the converter is 12 bits.

Power up or reset default configures inputs to the 0-5V range, single ended.

To view the result of a conversion in the command mode, type:

print ain(0)

The result at channel 0 is returned. T he returned value will always be in the 0 to 4095 range. When using a channel in the ±2. 5V ra nge, the value r eturned is interpreted differently. Zero count is now -2.500V, 4095 is + 4.9988, and 2048 is 0.000V.

Use the following formulas to convert a returned number to a voltage:

0 - 5V A = . 001221 * AIN(channel)

±2.5V A = .001221 * ain( channel) - 2.5

The AIN function require s about 1.5 ms to convert the data. Additional time is needed to store the data. The example below takes 255 data samples and stores them

Page 10-2 RPC -320

Image 37
Contents Trademarks REVRevision Table of Contents External Reset Sect ION 11 Watchdog Timer DescriptionInterrupt Characteristics Sect ION 13 Multi Mode Counter DescriptionSoftware Revision History Section OverviewDescription Manual OrganizationTechnical Support Symbols and Term inologySystem layout Overview SectionIntroduction Operating PrecautionsEquipment Using a Terminal Using a PCFirst Time Operation Uploading and Downloading ProgramsEditing programs and program ming hints Troubleshooting Where to GO from HereSaving a Program Saving ProgramsEprom W3 autorun jumperPreventing Autorun AutorunningLoading a Program Changing Eprom SizeAlternate Eproms CommandsBload BsaveCOM0 Serial Port Serial PortsCOM1 Serial Port RS-422/485 Operating Information Serial Ports SectionRS-422/485 Termination network Two wire RS-485 Accessing Serial BuffersMultidrop Network Disabling CONTROL-C Accessing COM0 and COM1Serial Port PIN OUT RXD CTS Checking the battery Battery BackupRAM Memory Changing MemoryStoring Variables in RAM Reserved MemoryBlock Data Transfer Assembly Language InterfaceDigital I/O Ports Digital and Opto PortsDigital Por t J3 Digital Port P6 Digital I/O CommandsHigh Current Port L8 Optically Isolated InputHigh Current Output Interfacing Digital I/O to an opto-module rack Interfacing to switches and other devicesDigital I/ O prog ramm ing exam ple Ls e Width Modulation PWM Conne ctor pin ou t J3 Digital and Opto Ports SectionCount Config LineLine Line BDate Setting Date and TimeM E Section Writing to the Display Connecting DisplaysProgramming Example Display Types Display Connector PIN OUTProgram explanation Keypad PortKeypad Port PIN OUT J5 Analog Input Connecting Analog InputsInitialization Overvoltage conditionsExamples u sing CON FIG AIN Differential ModeAcquiring Analog Data Noise Notes Temperature MeasurementAnalog Input Section Measuring Higher Voltages Data logging on a timer tickAmplifiers Converting Analog MeasurementsMeasuring 4-20 mA current loops Calibration External Reset Watchdog TimerOptically Isolated Interrupt Interrupt CharacteristicsProgram Example Optically isolated and TTL interrup ts GND ProgrammingLoad GateCOU NT0 Further Power Reduction Power ManagementProgram Examp le Power Management SectionTechnical Information Electrical SpecificationsMemory and I/O Bank MAP Mechanical SpecificationsJumper Descriptions Bank