03-05-2007 02:08 PM
03-05-2007 05:44 PM
03-06-2007 10:48 AM - edited 03-06-2007 10:48 AM
Message Edited by Jakeus on 03-06-2007 11:09 AM
03-06-2007 01:30 PM
03-06-2007 03:01 PM
03-08-2007 03:00 PM
Alright, I've been messing around with getting the program to work properly, and I've hit a brick wall. This is my code thus far to test what I'm wanting. You can safely assume a main and all the variables are declared properly. My wiring is also pretty simple. I connected the physical channels 0 and 8. What I'm trying to do is send data on channel 0 and on channel 8 verify that it was sent. I had figured I could just write the data(0,1,Z) to channel 0, and the expected data (H,L,X) to channel 8, but I can't seem to get it working. If I attempt to write any data that is not a 0,1 or Z, I get an error because it is a generate session. However, I tried using an acquisition session in conjunction with it, but I had no way of writing the values I'm trying to compare to the acquision session. What key concept am I missing here?
Code:
ViConstString script =
"script myScript "
" repeat forever "
" generate myWfm " //script to generate the same pattern over and over
" end repeat "
"end script";
for (i = 0; i < WAVEFORM_SIZE; i++)
{
if(i%2==0)
{
waveformDataU8[i]=1; //if the counter is even, output a logic 1
}
if(i%2!=0)
{
waveformDataU8[i]=0; //if the counter is odd, output a logic 0
}
}
checkErr(niHSDIO_InitGenerationSession(deviceID, VI_FALSE, VI_FALSE, VI_NULL, &vi)); //init the session
checkErr(niHSDIO_AssignDynamicChannels (vi, channelList)); //assign channels
checkErr(niHSDIO_ConfigureSampleClock(vi, NIHSDIO_VAL_ON_BOARD_CLOCK_STR, sampleClockRate)); //configure clock rate
checkErr(niHSDIO_ConfigureGenerationMode(vi, NIHSDIO_VAL_SCRIPTED)); //set for scripted mode
checkErr(niHSDIO_WriteNamedWaveformWDT (vi, waveformName, WAVEFORM_SIZE, NIHSDIO_VAL_GROUP_BY_SAMPLE, waveformDataU8)); //write the waveform to the 6552's memory
checkErr(niHSDIO_WriteScript(vi, script)); //write the script to the 6552
checkErr(niHSDIO_Initiate(vi)); //start the process
printf("Generation initiated.\n");
printf("Hit <Enter> to abort generation.\n");
getchar(); //repeat the script until the user presses enter
/* Abort generation */
checkErr(niHSDIO_Abort(vi)); //abort the generation sequence
03-08-2007 03:18 PM
03-09-2007 10:22 AM
03-12-2007 01:19 PM
Oh thats a perfect example! That is basically what I'm trying to accomplish in a nutshell. It works great, except for one part. So I made some minor changes to it, and got some unexpected results.
Changes:
1. Changed the acquision session to run off the internal clock
2. Change the acquision session start trigger to PFI1, the same trigger as the data active event on the generation session.
The program works fine when I try running it values less than 27 MHz. When I try to go above 27MHz, the program cannot correctly determine where the errors are. Is this due to the changes I made or something elsewhere?