Lil' Blackbox

Coding => v1.0 - v1.1 => Topic started by: Rx7man on April 03, 2016, 10:27:34 PM

Title: I fought the Max31856 and I WON
Post by: Rx7man on April 03, 2016, 10:27:34 PM
Well.. after about 2 days of frustration, I think I've got it licked... I'd still like to do some optimizing, but so far so good..

Read 4 thermocouples in 200 MICROseconds... Not bad I think :).. and no sample smoothing is really necessary, the Max31856 can average up to 16 samples all by itself.

As long as the different chips all use the same SPI mode, that time can only get better with optimizations, but if I have to start changing SPI modes I might run into some extra code switching between them.

I will be revisiting my stepper motor as well, don't know if I'll ever actually use it for something useful though..


Next thing to attack will be the CAN bus, I want to put all SPI devices into one library, and have them all read/write the same way, and eliminate stuff we don't use (alternate CAN modes, etc)
Title: Re: I fought the Max31856 and I WON
Post by: Rx7man on April 04, 2016, 10:56:24 PM
OK, though untested, it does compile with the addition of the CAN bus.

I modified the library to include only the barebones of what we need to work with the Holset turbo, and I added some shortcuts..

It makes working with the turbo MUCH easier, especially for someone not used to all this stuff..


A little example?


#include "MySPIdevices"

ThermoPin = 22;
CANpin = 10;

MAX31856 Thermo1(ThermoPin);
HolsetCAN Turbo(CANpin, VGTaddress); //CAN address of the turbo


setup(){
   Serial.begin(115200);
   Thermo1.begin();
   Turbo.begin();
}

loop(){
   Serial.print("Thermocouple is at (C) ");
   Serial.println(Thermo1.readThermocoupleC);

   Turbo.move(960);
   delay(1000);
}


I'm actually going to contain all the turbo so that it's all behind the scenes.. so you can get the actual position, commanded position, commanded speed, and temperature all from that library, which will clean up my main code in a big way and make it more readable (I think).. far less scrolling![/code]
Title: Re: I fought the Max31856 and I WON
Post by: 65fpvmustang on April 25, 2016, 04:38:08 PM
well if you fought the max 31856 i'm screwed. lol
Title: Re: I fought the Max31856 and I WON
Post by: Rx7man on April 25, 2016, 09:23:50 PM
why that?
Title: Re: I fought the Max31856 and I WON
Post by: 65fpvmustang on April 27, 2016, 08:20:58 AM
plan is to can bus to ms3, and me being a newbie figure this will be a challenge.
Title: Re: I fought the Max31856 and I WON
Post by: Rx7man on April 27, 2016, 09:24:25 PM
I don't know much about MS, but I'll give a hand if I CAN