FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Way to use NI FieldPOint PG-522 module

Hi everybody!

I'm using for few days fieldpoint family. My needs are concerning analog inputs and pulse generation for PWM module.

For the analog inputs, everything's OK, the sample provided with CD is complete, but I have some difficulties to use PG-522 module.

My needs are to control a PWM module. Unfortunatelly, the PWM module for FieldPoint is not fast enought (I need a 2kHz signal, and FP-PWM-520 module allows only a maximum of 500Hz). That's why I decide to use Pulse Generator module with resolution of 100µs (it is constant) and I select On Time from 0 to 5, Off Time from 5 to 0, to get a real 2kHz signal.

It seems to be OK, but since I decide to use 2 channels on the module, I don't really understand how to do...

For the moment, here is the source code (LabWindows/CVI) I use to build a small dll to make it easy to control.

Here is the function I use to send OnTime and OffTime values:
int __declspec(dllexport) FP_PG_SetTime(int PG_Channel_Number, int OnTime, int OffTime)
{
    IAStatus status = IA_SUCCESS;
    SYSTEMTIME timestamp;
    int i;
    int temp;  

    if(OnTime<0 || OnTime>5)
        temp = 5;
    else
        temp = OnTime;
    
    // Copy value to send with calculation of channel to control
   
memcpy (PG_value + (PG_Channel_Number*4), &temp, 4);
   
    // Control Channel #0
    if(
PG_Channel_Number == 0)
    {
        // FP_handle, PG_value are static var, PG_On_Time_0 is the handle created with
FP_CreateTagIOPoint function on the item under MAX
        if(status = FP_Write (FP_handle, PG_OnTime_0_handle, PG_value, BUFFER_SIZE))
        {
            // Don't report errors because open current loop occurs when nothing is connected.
            if (status == 0x8181)
                Error(status);
        }
    }

    // Same thing for OffTime
    return 0;
}



Ok, now, some questions...

I don't understand why I need to open handle for each item (OnTime_0, OffTime_0,....) Because I send a value array, it should be possible to select the channel only with the memcpy operation, isn't it? If yes, how to send both OnTime and OffTime value???

The best would be to get a full sample project, but I didn't find anything on the net. Is there somebody that worked with this hardware able to explain to me how to use them as simple as possible?

Thanks a lot, and sorry for mistakes, I'm french!


0 Kudos
Message 1 of 3
(3,606 Views)
Hi,
 
Here is a link that may help you:
 
 
ClémentG
0 Kudos
Message 2 of 3
(3,578 Views)
Thank you Clément for your answer, but I already read this documentation (it is provided with the module) and I didn't find solution to my issue.

I was hoping someone used the PG-522 module and were able to give me a sample or something like that. Unfortunately, I use this device in a foregin country, so I cannot do any test in my office, I must find real solution without any doubt.
0 Kudos
Message 3 of 3
(3,570 Views)