Examples

 

In this package there are 8 little and simple programs which act as test program for the board but also as examples on how to program the NI PCI 6025 E. Look for the PCI6025E directory into examples directory, you can find my examples

 

Contents

Analog Input Examples No examples are available No examples are available
Analog Output Examples Test_DAC program Sends on DACs some values
Wave program Using DACs to generate strange wave forms
Digital lines Examples Test_DIO program Checks that first 8 digital lines provided by DAQ-STC work properly
Test_PPI program Checks that 24 digital lines provided by 82C55A work properly
Timers/Counters Examples Test_ec program Performs a gated event counting using both counters
Test_bec program Performs a buffered gated event counting using both counters
Test_mes program Performs a period and pulsewidth measurement
Test_bms program Performs continuos periods and semiperiods measurement

 

 

 

 

 

 

 

 

 

 

Analog Input Examples

 

 

I'm sorry but driver's routine for ADC isn't tested yet

I hope It will be finished for the next snapshot

Back to Top

Analog Output Examples

 

 

In this section you can find two programs which check Analog Output functions. The first is a simple program which send on DACs output registers values that you can select so with a (voltmeter) you can check the right work. The second example use two DACs to generate strange wave shapes. In this case you need an oscilloscope to check the right work.

TEST_DAC program(void)

This program simply send values to DACs. With a tester connected to DACs output (pin 20 and pin 21) it's possible to check how DACs work. Like you'll notice DACs are affected by an offset error. It's possible to calibrate DACs to eliminate this offset. I don't write code to change board's EEPROM content but with NI software this operation is possible. Otherwise you can compensate this error via software adding an offset value to your output values

TEST_DAC
This program don't need command line parameters
Command Meaning
+ (Numeric Pad) increase tension on active DAC
- (Numeric Pad) decrease tension on active DAC
v change active DAC
CTRL-X Exit from program

Watch Connections

 

 

Back to Top

WAVE program(void)

This program uses the two DACs to generate strange waveforms. On DAC1 waveform generated is like a saw tooth and on DAC2 waveform is like a triangular wave. Connect an oscilloscope to DAC0 and DAC1 pins (20 and 21) to see the waves

WAVE
This program don't need command line parameters
Command Meaning
CTRL-X Exit from program

Watch Connections

Back to Top

Digital Lines Examples

 

 

Also in this section there are two programs: one TEST_DIO to test 8 digital lines provided by DAQ-STC, the other TEST_PPI to test the 24 lines provided by OKI MSM82C55A PPI. These two examples don't need any extern tool like voltmeter or oscilloscope. Like you will see if you want you can mount a little electronic circuit with eight LEDs to see output lines work, but it isn't strictly necessary

TEST_DIO program(void)

This program configures DIO 4..7 as input and DIO 0..4 as output. The four output lines acts as a 4-bit counter and every 250ms its value is increased. Now to test digital lines you can connect the output lines with input lines and check that input and output lines have the same value

TEST_DIO
This program don't need command line parameters
Command Meaning
CTRL-C Exit from program

Watch Connections

Back to Top

TEST_PPI program(void)

This program works in the same way that the previous one. 82C55A is configured to work in mode 0 with port A and C configured as input and port B as output. Port B acts as a 8-bit counter which change its value every 250ms. to test the PPI connect first port A and port B and check that all is going right, then connect port B and port C and make the control again.

TEST_PPI
This program don't need command line parameters
Command Meaning
CTRL-C Exit from program

Watch Connections

Back to Top

Timers/Counters Examples

 

 

The last section presents the four (till now) examples about counters/timers. Only event counting and time measurement are implemented yet. Position sensing and single and train pulse generation aren't implemented. I hope the next snapshot will include them

TEST_EC program(void)

With this program you can test the gated event counting feature. It's also possible test the interrupt manager of board. Counter 0 count down using PFI 3 as input line and PFI 4 as gate line. Counter 1 counts up and using PFI 6 as input lien and PFI 5 as gate line. DIO 7 and 6 must be connected respectively with gate 0 and gate 1. An external frequency must be provided to source 0 and 1. board FOUT are enabled and programmed to provide 6250 Hz. If you want you can get source from pin 50

TEST_EC

first parameter: initial counting value for C0; second parameter: initial counting value for C1; If only one parameter is provided C1 begin count from 0. If no parameter are provided or wrong value are provided both counters begin counting from 0

Valid value: any number between 0 and 2^24 (16777216)

Command Meaning
g toggle gate 0 value enabling or disabling counter 0
h toggle gate 1 value enabling or disabling counter 1
s freezes counters value showing them to video
CTRL-X Exit from program

Watch Connections

 

 

 

 

 

Back to Top

TEST_BEC program(void)

With this program you can test the buffered event counting feature. Counter 0 count down using PFI 3 as input line and PFI 4 as gate line. Counter 1 counts up and using PFI 6 as input lien and PFI 5 as gate line. DIO 7 and 6 must be connected respectively with gate 0 and gate 1. An external frequency must be provided to source 0 and 1. Board FOUT are enabled and programmed to provide 6250 Hz. If you want you can get source from pin 50. Buffered event counting different from previous event counting when a gate event happens. In this case automatically DAQ-STC copies counter value into Hardware Save Registers and if counting is non cumulative the counter is resected.

TEST_BEC

first parameter: initial counting value for C0; second parameter: initial counting value for C1; If only one parameter is provided C1 begin count from 0. If no parameter are provided or wrong value are provided both counters begin counting from 0

Valid value: any number between 0 and 2^24 (16777216)

Command Meaning
g toggle gate 0 value
h toggle gate 1 value
s freezes counters value showing them to video
CTRL-X Exit from program

Watch Connections

 

 

 

 

 

Back to Top

TEST_MES program(void)

In this case FOUT is programmed to provide a frequency of 1MHz. Sources and gates for the counters are the same that previous program. Using 'g' and 'h' button a square waves with a period of about 2 secs. Counters must show period and pulsewidth of this square wave. So counter 0 must measure about 2 secs (2E6) and counter 1 must measure about 1 sec (1E6)

Note: this program performs a single period and pulsewidth measurement

TEST_MES

No command line parameters are needed

Command Meaning
g starts wave generation on gate 0
h starting wave generation on gate 1
s freezes counters value showing them to video
CTRL-X Exit from program

Watch Connections

 

 

Back to Top

TEST_BMS program(void)

This program measures periods and semiperiods (both high level semiperiod and low level semiperiod) of square wave present on gate counters. By pressing 'g' or 'h' a square wave with period 2 sec but duty cycle 75% is continuously generated on counters gate. Thus counters must read in the case of C0 2 secs (2E6) and in the case of C1 alternately 1,5 sec (1.5E6) and 0,5 sec (500E3)

TEST_BMS

No command line parameters are needed

Command Meaning
g starts wave generation on gate 0
h starts wave generation on gate 1
s freezes counters value showing them to video
CTRL-X Exit from program

Watch Connections

 

 

Back to Top