LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A PCAN Channel has not been initialized yet or the initialization process has failed.

Hi,

I am using a CAN bus to control signal from my PC. When i run the program it gives me an error " A PCAN Channel has not been initialized yet or the initialization process has failed ". Is there anyone who can tell me how to remove this error because i am stuck with this problem. Smiley Sad

0 Kudos
Message 1 of 6
(5,906 Views)

So you have a problem with your PCAN hardware (Non NI hardware) ?

Have you connected/plugged in your PCAN dongle ?

Is it looking for the right port?

 

 

0 Kudos
Message 2 of 6
(5,894 Views)

I am getting the same message but once I stop the VI. I am sending and receiving signals over a CAN-bus with two units (201/181 & 202/182) using my computer as the master. I have 3 while loops and one timed loop all are working in parallel. Two while loops contain the CAN Write VI, the timed loop contains the CAN Read VI and the last while loop to process the messages and write data in a file. All the loops have a local variable that is connected to a stop button. Once I press the button the VI don't completely stop and I get the message "A PCAN Channel has not been initialized yet or the initialization process has failed". It's worth mentioning that I am also using PCAN USB adapter and the PCAN package in Labview. Finally, sometimes the VI will stop normally when I press the stop button. 

 

I am also new to LabView and CAN in general, so if you have any advice on best practices when writing the code in the block diagram with PCAN package that would be helpful as well.

0 Kudos
Message 3 of 6
(5,162 Views)

Hi Adel,

 

Once I press the button the VI don't completely stop and I get the message "A PCAN Channel has not been initialized yet or the initialization process has failed".

Probably you get that error much earlier, but it is only shown once those loops stops - using the default error handling of LabVIEW.

Did you try to debug your VI? Are you sure where the error is created?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(5,157 Views)

The Error Handler is inside the timed loop, so I can see the error once it happens. I tried debugging it but using highlight execution and retain wire value to see where the problem originates but I couldn't find it.

0 Kudos
Message 5 of 6
(5,155 Views)

Import PCAN library as dll.

 

I am using the old one PCANBasic.

To Init use proper channel(probably 51hex, depends on connection order), and set proper speed according to your app. you can verify it PCANView(there is an infromation wchich channels are taken)

Read all data in while loop, till buffer zero.

 

I use this way for 5 years and works well.

Attached some cuts from my functions

 

0 Kudos
Message 6 of 6
(5,152 Views)