LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem of reading Encoder

I want to read encoder with custom firmware to using interrupt but it not operate .

my encoder code , custom firmware and my VI(labview) are attach

In custom firmware , edit in ( Case 0xFE ) and under Functions title

Is it correct????

I wish to rapidly repeat

Download All
0 Kudos
Message 1 of 13
(5,656 Views)

Could you either post a .zip file or post the files individually?  I would recommend using an Arduino library that was written for encoders and add that to the LIFA firmware, that is what I did.

0 Kudos
Message 2 of 13
(3,495 Views)

thanks for your reply

I am sorry , I attach my files again

0 Kudos
Message 3 of 13
(3,495 Views)

Regarding your code, when using LIFA, you can't just start writing things randomly to the serial port because it is not within the framework of LIFA and will mess up communication.

Like I said previously, my primary recommendation is to use an existing encoder library.  When I did this, I created each of my encoders globally (in LIFA_Base), then, when I needed the count, I could simply create a function in LIFA that retrieved and sent back the count to LabVIEW.  Doing it this way means you never need to attach the interupts manually and only need to set and read the count via LIFA.

0 Kudos
Message 4 of 13
(3,495 Views)

thanks for your reply ,

please attach encoder library and how to use it in custom firmware

0 Kudos
Message 5 of 13
(3,495 Views)

I used this encoder library.  I've attached the code that I added to the LabVIEWInterface.pde (now .ino) to make this work.  I've also posted the VIs that I wrote to complete the functionality in LabVIEW.  You may need to change some things (in firmware and LabVIEW) to get it to work in the current version of LIFA (I wrote my code for 1.3.0.26).

Message 6 of 13
(3,495 Views)

thanks alot

If it operate , I will tell you

0 Kudos
Message 7 of 13
(3,495 Views)

There is error in code library

Capture.PNG

0 Kudos
Message 8 of 13
(3,495 Views)

It looks like the library was udpated since I programmed my robot with this code.  Just try removing that line (in my code attached above, not in the library).  I can't even remember why it was needed but I'm assuming I took it off of some example (the current example does not show this line).

0 Kudos
Message 9 of 13
(3,495 Views)

This error occurs in examples of encoder library also

and I edit the code library in line


volatile IO_REG_TYPE * pin1_register;

to

volatile int IO_REG_TYPE ;*int pin1_register;

but there is another errorCapture.JPG

0 Kudos
Message 10 of 13
(3,495 Views)