LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading SPI of MAX31855

Solved!
Go to solution

Yes, the vi with the display would be nice.

I have to go through your last postings accurately and try it myself as soon as I get back to work - after some hours of sleep.

I'll poste here when I have own results.

Thank you LexLuther for your vis!

0 Kudos
Message 31 of 130
(5,452 Views)
0 Kudos
Message 32 of 130
(5,452 Views)

I must be doing something stupidly wrong; when I upload the "LVIFA base2" to the Arduino, I get the following errors:

In file included from LVIFA_Base.cpp:157:

LabVIEWInterface.h:34: error: redefinition of 'unsigned char currentCommand [15]'

LabVIEWInterface.h:34: error: 'unsigned char currentCommand [15]' previously declared here

LabVIEWInterface.h:36: error: redefinition of 'unsigned char acqMode'

LabVIEWInterface.h:36: error: 'unsigned char acqMode' previously declared here

LabVIEWInterface.h:37: error: redefinition of 'unsigned char contAcqPin'

LabVIEWInterface.h:37: error: 'unsigned char contAcqPin' previously declared here

LabVIEWInterface.h:38: error: redefinition of 'float contAcqSpeed'

LabVIEWInterface.h:38: error: 'float contAcqSpeed' previously declared here

LabVIEWInterface.h:39: error: redefinition of 'float acquisitionPeriod'

LabVIEWInterface.h:39: error: 'float acquisitionPeriod' previously declared here

LabVIEWInterface.h:40: error: redefinition of 'float iterationsFlt'

LabVIEWInterface.h:40: error: 'float iterationsFlt' previously declared here

LabVIEWInterface.h:41: error: redefinition of 'int iterations'

LabVIEWInterface.h:41: error: 'int iterations' previously declared here

LabVIEWInterface.h:42: error: redefinition of 'float delayTime'

LabVIEWInterface.h:42: error: 'float delayTime' previously declared here

LVIFA_Base.cpp: In function 'void setup()':

LVIFA_Base:35: error: redefinition of 'void setup()'

LVIFA_Base.pde:-1: error: 'void setup()' previously defined here

LVIFA_Base.cpp: In function 'void loop()':

LVIFA_Base:54: error: redefinition of 'void loop()'

LVIFA_Base.pde:-1: error: 'void loop()' previously defined here

LVIFA_Base.cpp: At global scope:

LabVIEWInterface:943: error: redefinition of 'AF_Stepper motor1'

LabVIEWInterface:28: error: 'AF_Stepper motor1' previously declared here

LabVIEWInterface:944: error: redefinition of 'AF_Stepper motor2'

LabVIEWInterface:29: error: 'AF_Stepper motor2' previously declared here

LVIFA_Base.cpp: In function 'void forwardstep1()':

LabVIEWInterface:948: error: redefinition of 'void forwardstep1()'

LabVIEWInterface:33: error: 'void forwardstep1()' previously defined here

LVIFA_Base.cpp: In function 'void backwardstep1()':

LabVIEWInterface:951: error: redefinition of 'void backwardstep1()'

LabVIEWInterface:36: error: 'void backwardstep1()' previously defined here

LVIFA_Base.cpp: In function 'void forwardstep2()':

LabVIEWInterface:955: error: redefinition of 'void forwardstep2()'

LabVIEWInterface:40: error: 'void forwardstep2()' previously defined here

LVIFA_Base.cpp: In function 'void backwardstep2()':

LabVIEWInterface:958: error: redefinition of 'void backwardstep2()'

LabVIEWInterface:43: error: 'void backwardstep2()' previously defined here

LVIFA_Base.cpp: At global scope:

LabVIEWInterface:962: error: redefinition of 'AccelStepper steppers [8]'

LabVIEWInterface:47: error: 'AccelStepper steppers [8]' previously declared here

LabVIEWInterface:968: error: redefinition of 'unsigned int retVal'

LabVIEWInterface:53: error: 'unsigned int retVal' previously declared here

LabVIEWInterface:969: error: redefinition of 'int sevenSegmentPins [8]'

LabVIEWInterface:54: error: 'int sevenSegmentPins [8]' previously declared here

LabVIEWInterface:970: error: redefinition of 'int currentMode'

LabVIEWInterface:55: error: 'int currentMode' previously declared here

LabVIEWInterface:971: error: redefinition of 'unsigned int freq'

LabVIEWInterface:56: error: 'unsigned int freq' previously declared here

LabVIEWInterface:972: error: redefinition of 'long unsigned int duration'

LabVIEWInterface:57: error: 'long unsigned int duration' previously declared here

LabVIEWInterface:973: error: redefinition of 'int i2cReadTimeouts'

LabVIEWInterface:58: error: 'int i2cReadTimeouts' previously defined here

LabVIEWInterface:974: error: redefinition of 'char spiBytesToSend'

LabVIEWInterface:59: error: 'char spiBytesToSend' previously defined here

LabVIEWInterface:975: error: redefinition of 'char spiBytesSent'

LabVIEWInterface:60: error: 'char spiBytesSent' previously defined here

LabVIEWInterface:976: error: redefinition of 'char spiCSPin'

LabVIEWInterface:61: error: 'char spiCSPin' previously defined here

LabVIEWInterface:977: error: redefinition of 'char spiWordSize'

LabVIEWInterface:62: error: 'char spiWordSize' previously defined here

LabVIEWInterface:978: error: redefinition of 'Servo* servos'

LabVIEWInterface:63: error: 'Servo* servos' previously declared here

LabVIEWInterface:979: error: redefinition of 'byte customChar [8]'

LabVIEWInterface:64: error: 'byte customChar [8]' previously declared here

LabVIEWInterface:980: error: redefinition of 'LiquidCrystal lcd'

LabVIEWInterface:65: error: 'LiquidCrystal lcd' previously declared here

LabVIEWInterface:983: error: redefinition of 'unsigned char max_so'

LabVIEWInterface:68: error: 'unsigned char max_so' previously declared here

LabVIEWInterface:984: error: redefinition of 'unsigned char max_cs'

LabVIEWInterface:69: error: 'unsigned char max_cs' previously declared here

LabVIEWInterface:985: error: redefinition of 'unsigned char max_sck'

LabVIEWInterface:70: error: 'unsigned char max_sck' previously declared here

LabVIEWInterface:986: error: redefinition of 'long unsigned int max_retVal'

LabVIEWInterface:71: error: 'long unsigned int max_retVal' previously declared here

LVIFA_Base.cpp: In function 'void setMode(int)':

LabVIEWInterface:989: error: redefinition of 'void setMode(int)'

LabVIEWInterface:74: error: 'void setMode(int)' previously defined here

LVIFA_Base.cpp: In function 'int checkForCommand()':

LabVIEWInterface:995: error: redefinition of 'int checkForCommand()'

LabVIEWInterface:80: error: 'int checkForCommand()' previously defined here

LVIFA_Base.cpp: In function 'void processCommand(unsigned char*)':

LabVIEWInterface:1024: error: redefinition of 'void processCommand(unsigned char*)'

LabVIEWInterface:109: error: 'void processCommand(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void writeDigitalPort(unsigned char*)':

LabVIEWInterface:1477: error: redefinition of 'void writeDigitalPort(unsigned char*)'

LabVIEWInterface:562: error: 'void writeDigitalPort(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void analogReadPort()':

LabVIEWInterface:1496: error: redefinition of 'void analogReadPort()'

LabVIEWInterface:581: error: 'void analogReadPort()' previously defined here

LVIFA_Base.cpp: In function 'void sevenSegment_Config(unsigned char*)':

LabVIEWInterface:1528: error: redefinition of 'void sevenSegment_Config(unsigned char*)'

LabVIEWInterface:613: error: 'void sevenSegment_Config(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void sevenSegment_Write(unsigned char*)':

LabVIEWInterface:1539: error: redefinition of 'void sevenSegment_Write(unsigned char*)'

LabVIEWInterface:624: error: 'void sevenSegment_Write(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void spi_setClockDivider(unsigned char)':

LabVIEWInterface:1548: error: redefinition of 'void spi_setClockDivider(unsigned char)'

LabVIEWInterface:633: error: 'void spi_setClockDivider(unsigned char)' previously defined here

LVIFA_Base.cpp: In function 'void spi_sendReceive(unsigned char*)':

LabVIEWInterface:1579: error: redefinition of 'void spi_sendReceive(unsigned char*)'

LabVIEWInterface:664: error: 'void spi_sendReceive(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void syncLV()':

LabVIEWInterface:1630: error: redefinition of 'void syncLV()'

LabVIEWInterface:715: error: 'void syncLV()' previously defined here

LVIFA_Base.cpp: In function 'unsigned char checksum_Compute(unsigned char*)':

LabVIEWInterface:1640: error: redefinition of 'unsigned char checksum_Compute(unsigned char*)'

LabVIEWInterface:725: error: 'unsigned char checksum_Compute(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'int checksum_Test(unsigned char*)':

LabVIEWInterface:1651: error: redefinition of 'int checksum_Test(unsigned char*)'

LabVIEWInterface:736: error: 'int checksum_Test(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void AccelStepper_Write(unsigned char*)':

LabVIEWInterface:1666: error: redefinition of 'void AccelStepper_Write(unsigned char*)'

LabVIEWInterface:751: error: 'void AccelStepper_Write(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void sampleContinously()':

LabVIEWInterface:1692: error: redefinition of 'void sampleContinously()'

LabVIEWInterface:777: error: 'void sampleContinously()' previously defined here

LVIFA_Base.cpp: In function 'void finiteAcquisition(int, float, int)':

LabVIEWInterface:1711: error: redefinition of 'void finiteAcquisition(int, float, int)'

LabVIEWInterface:796: error: 'void finiteAcquisition(int, float, int)' previously defined here

LVIFA_Base.cpp: In function 'void lcd_print(unsigned char*)':

LabVIEWInterface:1734: error: redefinition of 'void lcd_print(unsigned char*)'

LabVIEWInterface:819: error: 'void lcd_print(unsigned char*)' previously defined here

LVIFA_Base.cpp: In function 'void MAX31855_Init(unsigned char, unsigned char, unsigned char)':

LabVIEWInterface:1775: error: redefinition of 'void MAX31855_Init(unsigned char, unsigned char, unsigned char)'

LabVIEWInterface:860: error: 'void MAX31855_Init(unsigned char, unsigned char, unsigned char)' previously defined here

LVIFA_Base.cpp: In function 'long unsigned int MAX31855_readData()':

LabVIEWInterface:1793: error: redefinition of 'long unsigned int MAX31855_readData()'

LabVIEWInterface:878: error: 'long unsigned int MAX31855_readData()' previously defined here

0 Kudos
Message 33 of 130
(5,452 Views)

The only thing I "changed" is that on compiling I got the warning that your vis are associated with a library, but not found in there; so I disassociated the vis from the library. But I have to admit that I don't really know what this is trying to tell me...

0 Kudos
Message 34 of 130
(5,452 Views)

this is what my arduino programmer looks like. 3 tabs on the top

lab9.JPG

0 Kudos
Message 35 of 130
(5,452 Views)

Ok, that was my fault; I thought I have to replace 3 of the old files in the LVIFA with your 3 new ones but leave the others in there too...

Unfortunately, when I load just your three files, and try to upload, I still get error messages. But fewer, at least. 🙂

Could the problem be that I use Arduino IDE 1.0.1? The programmer now looks identical to yours.

That's what he says now:

LVIFA_Base.cpp.o: In function `__static_initialization_and_destruction_0':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:136: undefined reference to `AF_Stepper::AF_Stepper(unsigned int, unsigned char)'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:137: undefined reference to `AF_Stepper::AF_Stepper(unsigned int, unsigned char)'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:155: undefined reference to `AccelStepper::AccelStepper(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char)'

LVIFA_Base.cpp.o: In function `AccelStepper_Write(unsigned char*)':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:869: undefined reference to `AccelStepper::setMaxSpeed(float)'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:874: undefined reference to `AccelStepper::setSpeed(float)'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:878: undefined reference to `AccelStepper::setAcceleration(float)'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:879: undefined reference to `AccelStepper::move(long)'

LVIFA_Base.cpp.o: In function `processCommand(unsigned char*)':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:600: undefined reference to `AccelStepper::AccelStepper(void (*)(), void (*)())'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:603: undefined reference to `AccelStepper::AccelStepper(void (*)(), void (*)())'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:613: undefined reference to `AccelStepper::AccelStepper(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char)'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:622: undefined reference to `AccelStepper::disableOutputs()'

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:628: undefined reference to `AccelStepper::distanceToGo()'

LVIFA_Base.cpp.o: In function `checkForCommand()':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:193: undefined reference to `AccelStepper::run()'

LVIFA_Base.cpp.o: In function `backwardstep2()':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:152: undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'

LVIFA_Base.cpp.o: In function `forwardstep2()':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:149: undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'

LVIFA_Base.cpp.o: In function `backwardstep1()':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:145: undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'

LVIFA_Base.cpp.o: In function `forwardstep1()':

C:\Users\tgriess\AppData\Local\Temp\build1776982394860246599.tmp/LVIFA_Base.cpp:142: undefined reference to `AF_Stepper::onestep(unsigned char, unsigned char)'

0 Kudos
Message 36 of 130
(5,452 Views)

In the LVIFA base folder, if I delete the two .pde-files (LVIFA_base.pde, LabVIEWInterface.pde) but leave the other library-files (.h) in it, the programmer compiles without any errors, but then it still reads in just zeros from the MAX...

I'm using the files from your LVIFA_Base2 folder; am I correct doing so?

Edit: I guess it was quite stupid to leave the .pde-files in there in the first place...

0 Kudos
Message 37 of 130
(5,452 Views)

Here is my full version.  I've implemented the fixes noted above and it is much cleaner and more modular code.  Let me know if it works Theophrastus.

LeXLuther422, You use the same conversion for both temperatures which is not correct because one is 14-bit and the other is only 12.  You can see my library to see how I've modified the 14-bit code for the 12-bit information.

0 Kudos
Message 38 of 130
(5,452 Views)

you still need to fix Read Raw Data.vi I took a picture of the changes I had to make to make it work and added notes to it.

lab10.JPG

0 Kudos
Message 39 of 130
(5,452 Views)

Oops, I thought I had that 4 in there.

Regarding the combining of the bytes, I don't understand why you would need to make such a change.  According to the datasheet (and both libraries that I've based this on), the MSB is sent first and teh LSB is sent last.  This is also the way I send it via serial (as bytes), identical to that of the analog read function of LIFA.

If you still believe that your way is correct, can you show me where you got that? Was it purely from trial and error?

P.S.  Thanks for helping me out!

0 Kudos
Message 40 of 130
(5,452 Views)