Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Data Transfer using CAN (Controller Area Network)

by Sathish (Initiate)
on Nov 19, 2010 at 12:34 UTC ( #872478=perlquestion: print w/ replies, xml ) Need Help??
Sathish has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

Can you please share a simple perl script to send and receive data using the CAN???

My requirement is to send a CAN message when I press a button and need to analyse the response of CAN message

Thanks, Sathish

Comment on Data Transfer using CAN (Controller Area Network)
Re: Data Transfer using CAN (Controller Area Network)
by Anonymous Monk on Nov 19, 2010 at 12:55 UTC
    CAN is a bus, you need specific hardware/drivers to talk CAN.

      ya I am know. Like we are sending an data through serial port. I would like to send an data through CAN using perl script.

        ya I am know. Like we are sending an data through serial port.

        This is called a critical detail Try Device::SerialPort

        ... as said before from somebody: you need special hardware to do so. Usually a CAN controller and a CAN trasceiver (to do the bit stuffing and message acknowleding). Which CAN hardware do you use?

Re: Data Transfer using CAN (Controller Area Network)
by ww (Bishop) on Nov 19, 2010 at 14:01 UTC
    You need two CANs, a long, taut string, and a partner at the other end to receive and send data.
      silicon ok?

        I think we need to take a long, stout stick to any engineer marketing-drone who henceforth labels anything as a “blah-blah area network.”

Re: Data Transfer using CAN (Controller Area Network)
by BrimBorium (Friar) on Nov 20, 2010 at 23:44 UTC

    I did not find any perl module some time ago when I looked for ... It will also depend on the CAN hardware you want to use. Usually you get some drivers and C libraries with the hardware which you can use to build your own module. I would suggest to do the event handling in C and just some send and receive function in perl, using XS. To publish this on CPAN would be a good answer to your question :o)

      Am having both the CAN controller and CAN tranceiver. Now I am sending the data using the IG block in the CANoe. Instead of that I would like to send an data only if a button is pressed. I can make a button using a Tk. To interface the button action to send an data to the another node I need your help. All the CAN communication is already there. For testing purpose we are sending an data through IG block. I am trying to change that part by a button.

        Am having both the CAN controller and CAN tranceiver. Now I am sending the data using the IG block in the CANoe. Instead of that I would like to send an data only if a button is pressed. I can make a button using a Tk. To interface the button action to send an data to the another node I need your help. All the CAN communication is already there. For testing purpose we are sending an data through IG block. I am trying to change that part by a button.

        This makes no sense at all. If you can make a button, and you can make it do something, and you can send the data using the IG block in the CANoe, whatever that is, why can't you send the data on button press?

        Ok, so you do not necessarily want to access your CAN device directly. Accessing CANoe would be sufficient for you. If you would have told that in your question earlier you could avoid a lot of confusion.

        Accessing CANoe works via Win32::OLE, read the documentation of CANoe COM server and check the VB exampe to access environment variables.

        I would create a CAPL node wich communicates with your perl script via CANoe environment variables. So if you click the button you would set an environment vaiable wich triggers the CAPL node to send a CAN message. That way you can even get data from CAN back to perl. It just depends on you interface design.

        Show your solution and I'll comment it.

Re: Data Transfer using CAN (Controller Area Network)
by BrimBorium (Friar) on Nov 10, 2011 at 20:54 UTC

    just for completeness ... there was an open source CAN tool published which can be accessed via COM interface and supports several hardware interfaces. see http://rbei-etas.github.com/busmaster/

    do what you love, love what you do

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://872478]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-09-17 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (54 votes), past polls