LabVIEW Interface for Arduino Discussions

取消
显示结果 
搜索替代 
您的意思是: 

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

下载全部
0 项奖励
1 条消息(共 13 条)
7,209 次查看

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 项奖励
2 条消息(共 13 条)
5,048 次查看

thanks for your reply

I am sorry , I attach my files again

0 项奖励
3 条消息(共 13 条)
5,048 次查看

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 项奖励
4 条消息(共 13 条)
5,048 次查看

thanks for your reply ,

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

0 项奖励
5 条消息(共 13 条)
5,048 次查看

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).

6 条消息(共 13 条)
5,048 次查看

thanks alot

If it operate , I will tell you

0 项奖励
7 条消息(共 13 条)
5,048 次查看

There is error in code library

Capture.PNG

0 项奖励
8 条消息(共 13 条)
5,048 次查看

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 项奖励
9 条消息(共 13 条)
5,048 次查看

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 项奖励
10 条消息(共 13 条)
5,048 次查看