I am using a PCAN-USB adapter (channel version 3.8.2.10146) with PCANBasic.dll (version from 2012.01.20) under Python 2.6 on a Windows 7 machine.
When following the procedure given in the PCAN-Basic documentation about the parameter PCAN_LISTEN_ONLY, I manage to set its value to PCAN_PARAMETER_ON.
However, a following CAN_Send command still sends a message (cf. code snippet).
I check the message queue with PCAN-View (version 3.1.5.200) which is started after the channel has already been initialized.
Probably, I am getting the term LISTEN_ONLY mode wrong.
My intention is to force a channel to listen only.
Regards,
Andreas
Code: Select all
a = PCANBasic.PCANBasic()
msg = PCANBasic.TPCANMsg()
msg.MSGTYPE = PCANBasic.PCAN_MESSAGE_EXTENDED
chA = PCANBasic.PCAN_USBBUS1
baudrate = PCANBasic.PCAN_BAUD_500K
# pre-initialization for LISTEN_ONLY mode
a.SetValue(chA, PCANBasic.PCAN_LISTEN_ONLY, PCANBasic.PCAN_PARAMETER_ON)
result = a.Initialize(chA, baudrate, hardwaretype, PCANBasic.c_uint(0), PCANBasic.c_ushort(0)) # init channel
# check if chA is in LISTEN_ONLY mode
print 'LISTEN_ONLY-Modus: %d' % (a.GetValue(chA, PCANBasic.PCAN_LISTEN_ONLY)[1])
msg.ID = 15
msg.LEN = 2
msg.DATA[0], msg.DATA[1] = 1,5
a.Write(chA, msg)