Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
iospace
Jan 19, 2038


Ok this is weird. Apparently something went haywire because now when I point it north it still says west. The exact degree readings are coming still but what the gently caress.

Adbot
ADBOT LOVES YOU

carticket
Jun 28, 2005

white and gold.

What accuracy are you shooting for? Intracardinal is not too bad to obtain with good repeatability. Low double digits starts to need some compensation algorithms. Single digits will require active hard iron/soft iron compensations. Under 1 degree requires advanced degrees in math and algorithms.

E: ^^^^ things that aren't magnets can gently caress up the readings. Cell phones are veritable fountains of magnetic interference. A bolt in your desk under laminate can cause issues like this. It doesn't take much.

carticket fucked around with this message at 05:48 on May 16, 2018

iospace
Jan 19, 2038


Mr. Powers posted:

What accuracy are you shooting for? Intracardinal is not too bad to obtain with good repeatability. Low double digits starts to need some compensation algorithms. Single digits will require active hard iron/soft iron compensations. Under 1 degree requires advanced degrees in math and algorithms.

E: ^^^^ things that aren't magnets can gently caress up the readings. Cell phones are veritable fountains of magnetic interference. A bolt in your desk under laminate can cause issues like this. It doesn't take much.

I'm not talking a few degrees off here. I'm talking when I point it north it still says west, even if I turn it eastwards first.

carticket
Jun 28, 2005

white and gold.

No, I get that. You'd be surprised how little it takes to throw the math off a large amount. Particularly if you don't have anything in place for compensations.

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


I just found out TI has some pretty nifty ULP MCUs with decent-sized on-chip FRAM, and they are about 30% cheaper than any equivalent-sized FRAM chips I can find.

I also found out that they have yet another eclipse-based IDE. I think I have about 6 of them installed at this point, including actual non-brand eclipse. I've been using it for about 12 years now though, so I actually prefer it over just about everything else.

e: It's not like there's a whole lot of IDEs around anyway

Private Speech fucked around with this message at 19:44 on May 25, 2018

csammis
Aug 26, 2003

Mental Institution

Private Speech posted:

I just found out TI has some pretty nifty ULP MCUs with decent-sized on-chip FRAM, and they are about 30% cheaper than any equivalent-sized FRAM chips I can find.

The MSP430FRs? I've been using them and I like them.

quote:

I also found out that they have yet another eclipse-based IDE.

Personally I hate Eclipse for editing so I do my coding elsewhere and use CCS to build / debug. In fairness I really like the stack usage and memory allocation graphs, and it has a live power consumption monitor during debugging sessions which is pretty neat.

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


csammis posted:

The MSP430FRs? I've been using them and I like them.

Yeah, those. Specifically the 256KB versions; it replaces a more expensive component, is ULP so power is not a huge issue and you get a whole MCU essentially for free.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

Private Speech posted:

Yeah, those. Specifically the 256KB versions; it replaces a more expensive component, is ULP so power is not a huge issue and you get a whole MCU essentially for free.

Why would you want to add programmable parts...

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
I'm working on an Arduino thing for work and I'm trying to make use of Structs to make things a little easier. Problem is, I don't know a lot about them! I also am a little fuzzy on pointers and referencing, so as you can imagine, this is tough for me.

So, I want to be a be able to pass a struct into a function and have it modify the data in the struct, either directly or returning the info. What's the best way to do that?

I have something along these lines:

code:
struct Player
{
uint8_t Button1_Pin;
uint8_t Button2_Pin;
uint8_t State;
uint8_t Score;
}

Player Player1; 
Player Player2;

and I'm thinking of trying to do something like this:

code:
void Read_Player(struct *ThePlayer)
{
if(digitalRead(ThePlayer->Button1_Pin) == LOW)
{
ThePlayer->Score++;
State = true;
}
if(digitalRead(ThePlayer->Button2_Pin) == LOW)
{
State = false;
}

}

void loop()
{
Read_Player(&Player1);
Read_Player(&Player2);
}
Now, I'm just kind of awkwardly thinking this out right now, I haven't even tried to compile, and I don't have a controller handy on me to see if it works... am I in the right direction? I imagine I'm missing something.

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
Of course you would have to reference State and Score as members of the struct but you have the general idea right. Always pass a pointer to a struct.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
ah yeah forgot to do the membering there.

And I wouldn't have to do a return, correct? Because this manipulating the original data, rather than passing a copy.

Volguus
Mar 3, 2009

Fanged Lawn Wormy posted:

ah yeah forgot to do the membering there.

And I wouldn't have to do a return, correct? Because this manipulating the original data, rather than passing a copy.

Yes you are manipulating the original data. No need for return (you could return an error code to tell the caller if you succeeded though). If you would have your method signature like this:
code:
void Read_Player(struct Player ThePlayer) {
}
Then a copy would be made for the method and then you would need to return the modified struct (which would again mean another copy made for the return). I am not sure if return-value-optimization would kick in and optimize that away in release mode, but that's compiler dependent.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
There are a bunch of online compilers that are really good for this if you just want to test some C code quickly. Especially if you want to do some complicated pointer stuff that might corrupt real hardware in non obvious ways that are difficult to debug.

Adbot
ADBOT LOVES YOU

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


Phobeste posted:

Why would you want to add programmable parts...

The joke answer is that I get paid to write programs, not to design simple things.

The real answer is we needed an SoC of some kind anyway, and the higher-tier FRs have GPIOs aplenty.

(also TI has a dead-easy sample project for turning the MCU into an SPI-FRAM-with-altogether-too-many-pins; not that I can use it anyway because I need more complex functionality)

  • Locked thread