View previous topic :: View next topic |
Author |
Message |
kalman Guest
|
Need help to understand this... |
Posted: Sat Jan 09, 2010 10:35 pm |
|
|
Code: |
void init_Gyro1DKalman(struct Gyro1DKalman *filterdata, float Q_angle, float Q_gyro, float R_angle)
{
filterdata->Q_angle = Q_angle;
filterdata->Q_gyro = Q_gyro;
filterdata->R_angle = R_angle;
}
|
Hye I got this code from blog, its for kalman filter, it were much longer but I cut it.
My question is what is the function of:
Quote: | struct Gyro1DKalman *filterdata |
and
Quote: | filterdata->Q_angle = Q_angle; |
the ....->.... have any meaning? |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
kalman Guest
|
|
Posted: Sun Jan 10, 2010 3:17 am |
|
|
sorry, thanks.... |
|
|
kalman Guest
|
|
Posted: Sun Jan 10, 2010 3:26 am |
|
|
Guys, is there any other tutorial page?
A complete tutorial on c...
One more thing, when I compile a code consist of math.h file the compiler give error:
cannot change device type this far into the code
and it open the pic.h file. I need to do inverse sine of some math equation. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Sun Jan 10, 2010 9:44 am |
|
|
That error actually is particular to the CCS compiler.
The #include line with your PIC .h file MUST be the first one in the code.
Code: | #include <18F458.H>
#fuses XT, NOPROTECT, NOBROWNOUT, NOWDT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, errors)
|
If you include a custom .h file the #include line for the PIC must be the first
line of that file.
Here are examples of the two formats:
http://www.ccsinfo.com/forum/viewtopic.php?t=21575
http://www.ccsinfo.com/forum/viewtopic.php?t=26835
If you can't figure it out, post the first 20 or so lines of your code (be sure
to use the CODE button) so we can see what you have. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 10, 2010 3:25 pm |
|
|
Quote: | Guys, is there any other tutorial page?
A complete tutorial on c... |
Here is a tutorial for CCS. It's not perfect. His sample programs are
a little too short. He leaves off the #fuses statement. He doesn't put a
while(1); statement at the end of main(), to prevent the PIC from going
to sleep if the program falls off the end of main(). But it's mostly OK.
http://www.swarthmore.edu/NatSci/echeeve1/Ref/C%20for%20PIC/C_Intro.html
This tutorial is for the Hi-Tech compiler. CCS uses different default
sizes for the datatypes than Hi-Tech does, so it's not completely
applicable. But it's still OK. (In the CCS PCB, PCM, and PCH compilers,
an 'int' is an unsigned 8-bit integer).
http://phy.ntnu.edu.tw/~cchen/ctutor.pdf
You can find more tutorials. Google for: CCS compiler tutorial |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Sun Jan 10, 2010 10:49 pm |
|
|
And then there is always The C Programming Language, by Kernighan & Ritchie. A little dry perhaps, and not really a tutorial. Still, as a reference it's invaluable. I did most of my C learning from it. |
|
|
kalman Guest
|
|
Posted: Tue Jan 12, 2010 4:41 am |
|
|
Can I pass input value from adc to struct?
To store the value and then call it back.
Anywhere I can learn this? |
|
|
|