The time has come, I need to learn C. Yay, another noob MateoC can rant about! : P
I already have limited experience with Python, and quite a bit of TI-Basic so maybe things will go well. Laughing

Anyways, I thought there was a topic that showed you how to set up everything to start programming in C but I cant find it. If someone could find it before I do that'd be greatly appreciated.

I already have QT creator installed and I'm working on installing the tool chain.
Ok! Welcome to the World Of C.

What do you want to learn first?



Also, good luck. Though it's not that complicated.
um, C?

***ThelastMillennial dies of embarrassment

Could you elaborate please? I'm not sure I understand. Though I'd like to learn the basics first of course.
I learned how to set up a program by looking at other program source scattered around the forums. after that it's just a matter of learning syntax and getting a feel for the language.

if you look over on my Boxman C thread you'll find this image:

which gives a basic idea about the setup. (you'll notice a missing semicolon on line 12 which is why I posted that image Razz)

if you've ever programmed an arduino that is very similar to this and in fact where I still pull most of my knowledge for calculators (maybe that's why I have so many questions...)

Hope this helps!
If ya wanna program for the CE, get the tool chain set up, and look at examples and use the documentstion, that is so key. And when it doesn't work or it isn't documented well enough, bug Mateo. Razz
OK it's been a while. I've been focusing on learning ICE but since ICE doesn't support GetLCDBrightness() (yet) Mateo convinced me to do it in C. Problem is, the closest language to C I know is C#. Enough excuses, here's what I've got.

Code:
// Program Name: GETLCD
// Author(s): TLM
// Description: Gets brightness level and stores it into Ans

// I didn't know which ones I needed, so I included all of them.
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/* Keep these headers */
#include <tice.h>

/* Standard headers - it's recommended to leave them included */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <fileioc.h>
/* Other available headers */
// including stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h

/* Available libraries */
// including lib/ce/graphc.h, lib/ce/fileioc.h, and lib/ce/keypadc.h
// Sample: #include <lib/ce/graphc.h>

/* Put your function prototypes here */

/* Put all your globals here. */

/* Put all your code here */

void main(void) {
   uint8_t  i,level;

   /* Store the current brightness level into level*/
   
   level = lcd_BacklightLevel;
   
   // Stores the level into Ans
   ti_SetVar(TI_REAL_TYPE, ti_Ans, level);
}

/* Other functions */

The compiler errors and says

Code:
C CE SDK Version 7.3
Looking for changes...
Z:\opt\csdk\5245BCB2\src\getlcd.c
Z:\OPT\CSDK\5245BCB2\SRC\GETLCD.C (39,38) : ERROR (171) Argument type is not compatible with formal parameter
/include/.makefile:256: recipe for target 'obj/GETLCD.obj' failed

I'm pretty sure that means ti_SetVar( requires 'level' to be a real_t (since that's what the examples have it as) rather than a uint8_t. Unfotunately I have no idea how to type cast this and even with the help of _iPheonix_ and Michael2_3B we couldn't understand it enough to proceed any farther.

So my question is: How do I get the brightness level stored into Ans?
Use os_Int24ToReal():


Code:
#include <tice.h>
#include <fileioc.h>

void main(void) {
    real_t level = os_Int24ToReal(lcd_BacklightLevel);
    ti_SetVar(TI_REAL_TYPE, ti_Ans, &level);
}
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement