Ugh, and I spent all this time manually locating through locate_OS and only then printing. I should have checked display_syscalls.h before :-/
hmm? How do I use it?
flyingfisch wrote:
Man, we need a tutorial for that! Anyway, I'll go and try to fix my code...

EDIT: I cant find TEXT_COLOR_ anywhere.... :-\


I'm almost positive it's in display_syscalls.h; if not, try looking at color.h (if you have it).
It was color.h Wink


OK, here is my code:


Code:

#include <display_syscalls.h>
#include <keyboard_syscalls.h>
#include <color.h>
 
void main(void) {
   int key;
   int color = TEXT_COLOR_BLACK
   PrintXY(1,1,"  Hey, World, Howd'ya do?", 1, color);
    //printf("test")
   while (1) {
        Bdisp_AllClr_VRAM();
        GetKey(&key);
      switch (key) {
      }
   }
 
   return;
}


And... My error message Razz


Code:

flyingfisch@flyingfisch-Office-Computer:~/prizmsdk/projects/project$ make
/usr/local/cross/bin/sh3eb-elf-gcc -MMD -MP -MF /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/build/example.d -Os -Wall -mb -m4a-nofpu -mhitachi -nostdlib   -I/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/build -I/home/flyingfisch/Desktop/PrizmSDK-0.3/include -c /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c -o example.o
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c:5:6: warning: return type of 'main' is not 'int' [-Wmain]
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c: In function 'main':
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c:8:2: error: expected ',' or ';' before 'PrintXY'
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c:7:6: warning: unused variable 'color' [-Wunused-variable]
make[1]: *** [example.o] Error 1
make: *** [build] Error 2
Now, two things; all lines except control statements in C end with semicolons; the line above the PrintXY is the culprit. Secondly, to get rid of that annoying warning, change "void main(void)" to "int main(void)".
well, now it runs but doesnt display text... Why?


Code:

#include <display_syscalls.h>
#include <keyboard_syscalls.h>
#include <color.h>
 
int main(void) {
   int key;
   int color = TEXT_COLOR_BLACK;
   PrintXY(1,1,"  Hey, World, Howd'ya do?", 1, color);
    //printf("test")
   while (1) {
        Bdisp_AllClr_VRAM();
        GetKey(&key);
      switch (key) {
      }
   }
 
   return;
}
because in your loop, you are calling Bdisp_AllClr_VRAM(). You're also not updating the display (copying vram to the display) within your loop. I think PrintXY writes to VRAM, so you should do that.
Try removing the Bdisp_AllClr_VRAM(). Also, you should be using TEXT_MODE_NORMAL in PrintXY instead of a magic number.
graphmastur wrote:
because in your loop, you are calling Bdisp_AllClr_VRAM(). You're also not updating the display (copying vram to the display) within your loop. I think PrintXY writes to VRAM, so you should do that.

Ah, ok


Quote:

...
Also, you should be using TEXT_MODE_NORMAL in PrintXY instead of a magic number.


magic number ???
souvik1997 wrote:
Try removing the Bdisp_AllClr_VRAM(). Also, you should be using TEXT_MODE_NORMAL in PrintXY instead of a magic number.


Well, he is using the proper version of it, but he's just storing it in a variable first.

That being said, PrintXY does indeed update the prizm's LCD for you; to do it manually, Bdisp_PutDisp_DD().
flyingfisch wrote:

Quote:

...
Also, you should be using TEXT_MODE_NORMAL in PrintXY instead of a magic number.


magic number ???

A "magic number" is defined as a number which is not accurately defined. In your code, he's referring to how you have a "1" as an argument right before "color" in the PrintXY function. There is a named constant for that, so that when you look at your code later, or when anyone else looks at your code, you'll know what on earth you were doing with it, and what it means.

In other words, he wants you to use the constant "TEXT_MODE_NORMAL" instead of 1.
ahh, thanks graphmastur Smile

EDIT: Yay! It worked! But no text wrap...

EDIT2:

In an attempt to fix my code, i broke it Razz

Code:

#include <display_syscalls.h>
#include <keyboard_syscalls.h>
#include <color.h>
 
int main(void) {
   int key;
   int color = TEXT_COLOR_BLACK;
   PrintXY(1,1,"  Hey, World,", TEXT_COLOR_NORMAL, color);
   PrintXY(1,2,"  howd'ya do?", TEXT_COLOR_NORMAL, color);
   
    //printf("test")
   while (1) {
        GetKey(&key);
      switch (key) {
      }
   }
 
   return;
}




Code:

flyingfisch@flyingfisch-Office-Computer:~/prizmsdk/projects/project$ make
/usr/local/cross/bin/sh3eb-elf-gcc -MMD -MP -MF /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/build/example.d -Os -Wall -mb -m4a-nofpu -mhitachi -nostdlib   -I/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/build -I/home/flyingfisch/Desktop/PrizmSDK-0.3/include -c /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c -o example.o
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c: In function 'main':
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c:8:31: error: 'TEXT_COLOR_NORMAL' undeclared (first use in this function)
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c:8:31: note: each undeclared identifier is reported only once for each function it appears in
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/project/src/example.c:18:2: warning: 'return' with no value, in function returning non-void [-Wreturn-type]
make[1]: *** [example.o] Error 1
make: *** [build] Error 2
There is no text wrap in any of the Print functions AFAIK. You'll have to implement it yourself, or study each text manually so it doesn't go off the screen.
gbl08ma wrote:
There is no text wrap in any of the Print functions AFAIK. You'll have to implement it yourself, or study each text manually so it doesn't go off the screen.


I actually think the PrintMB family of syscalls will do some wrapping things for you, though I'm not knowledgeable of exactly how to use them (at least, I forgot); perhaps Merth or AHelper could fill you in on them.

Edit: the reason it's not building is because the define is used as "TEXT_COLOR_NORMAL"; the actual define is "TEXT_MODE_NORMAL".
I accidentally ninja'd gbl08ma, would someone please read the last edit of my last post please? Smile

And thanks so much for helping me out Smile
It says TEXT_COLOR_NORMAL is not defined, if you were to read the log messages. I would go back and look at my post. I didn't say TEXT_COLOR_NORMAL, I said something else. Or, you can look up what the constant is in the color.h file in the includes folder for the SDK.

On a side note, 1 is invert, and 0 is normal for this. Is this correct? I can't test it atm.
this code works:


Code:

#include <display_syscalls.h>
#include <keyboard_syscalls.h>
#include <color.h>
 
int main(void) {
   int key;
   int color = TEXT_COLOR_BLACK;
   PrintXY(1,1,"  Hey, World,", TEXT_MODE_NORMAL, color);
   PrintXY(1,2,"  howd'ya do?", TEXT_MODE_NORMAL, color);
   
    //printf("test")
   while (1) {
        GetKey(&key);
      switch (key) {
      }
   }
 
   return;
}


EDIT:

What does PrintXY2 do, and what is its syntax?
hrrm, i'm a bit confused. when i make the example program in the example folder, everything runs perfectly, but if i copy everything to a different folder, rename the source, and modify the name.
MKG3AFLAGS := -n basic:<<here:example>> -i uns:../unselected.bmp -i sel:../selected.bmp

i get
/usr/local/cross/lib/gcc/sh3eb-elf/4.6.2/../../../../sh3eb-elf/bin/ld: cannot find -lfxcg
It can't find libfxcg.a, implying you moved the project somewhere outside the usual locations, making GCC look somewhere else for the file (and being unable to find it). Where did you put it, relative to the SDK package?

It appears that if you add a definition to the makefile to point LIBFXCG_LIB at the right directory, you can work around the problem and just tell GCC where to look. Something like
Code:
LIBFXCG_LIB := /path/to/sdk/lib



Jonimus: line 96 of the Makefile appears to use LIBFXCG_LIB, which is not defined anywhere else. Is there a reason for that?

Code:
export LIBPATHS   :=   $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
                       -L$(LIBFXCG_LIB)
OK, I have this code:


Code:

#include <display_syscalls.h>
#include <keyboard_syscalls.h>
#include <display_syscalls.h>
#include <display.h>
#include <keyboard.hpp>
#include <color.h>
#include <RTC_syscalls.h>

int main(void) {
   int key;
   int hour, minute, second, ms;
   
   
   
   while (1) {
      RTC_GetTime(&hour, &minute, &second, &ms);
      PrintXY(1, 1, second, 0, COLOR_BLACK);
      GetKey(&key);
   }
 
   return;
}


It compiles fine, no errors, but when I try to run it on my calculator, it forces a reboot. Why?
  
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
» Goto page Previous  1, 2, 3, 4, 5, 6  Next
» View previous topic :: View next topic  
Page 3 of 6
» 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