Problem displaying RIC graphics (using NXC)

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
jpetersohn
Posts: 3
Joined: 16 Dec 2010, 13:07

Problem displaying RIC graphics (using NXC)

Post by jpetersohn »

Hi everyone,

I am trying to display large digits on the display of the NXT brick using NXC. For this I downloaded the BIGdigits sample from:

http://ric.dreier-privat.de/Examples/Fo ... digits.zip

I also installed (using NXT-G on the Mac) the enhanced firmware downloaded from here:

http://bricxcc.sourceforge.net/lms_arm_nbcnxc.zip

The firmware screen on the NXT says 1.28, as before, with the original firmware. Is there some way of identifying the enhanced firmware from the version information on the NXT?

I compiled the sample NXC file using the -EF flag and downloaded the resulting rxe to the brick. The program appears to run (no crash), but I do not see any output on the screen.
I added a couple of additional statements (such as CircleOut(), etc.) to the code, this graphic output appears on the screen. I also tried the 10x10_001 font sample from the same site as above, but I also do not get any output.
All other standard NXT calls (OnFwd() ...) seem to work correctly.
I should mention that I am using a Mac with NXTBrowser to download the files. I downloaded the RIC files in the ZIP packages that I received from the web sites, they seem to show up correctly on the brick (the size is correct and they appear under the "graphics" tab of the NXTBrowser).

I would greatly appreciate any tips that someone may have to why this isn't working. Having the large output would be very helpful for the project that I am working on.

Thanks in advance,

Jens Petersohn
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Problem displaying RIC graphics (using NXC)

Post by mattallen37 »

I have no idea about getting the ric file(s) and all to work. If a 7-segment type font is okay, I would suggest using NXC code to "draw" the digits, not a ric. Here is the code I made for myself (based somewhat on Morton's program).

Code: Select all

/*
    aaa
   e   b
   e   b
   e   b
    ggg       the segments of a 7-segment display
   f   c
   f   c
   f   c
    ddd
*/
#define DRAW_OPT_FILL_SHAPE_CLEAR 36

byte thick;

void LargeColinOut(byte x, byte y, byte size, bool black)
{
  byte ColinThick=(size/4);
  if (black){
    RectOut(x, y+(size/2), ColinThick, ColinThick, DRAW_OPT_FILL_SHAPE);
    RectOut(x, y+(size*3/2), ColinThick, ColinThick, DRAW_OPT_FILL_SHAPE);
  }
  else{
    RectOut(x, y+(size/2), ColinThick, ColinThick, DRAW_OPT_FILL_SHAPE_CLEAR);
    RectOut(x, y+(size*3/2), ColinThick, ColinThick, DRAW_OPT_FILL_SHAPE_CLEAR);
  }
}

void Out_a(byte x, byte y, byte size, bool black)
{
  if (black){RectOut(x+thick, y+(size*2)+(thick*2), size, thick, DRAW_OPT_FILL_SHAPE);}
  else{RectOut(x+thick, y+(size*2)+(thick*2), size, thick, DRAW_OPT_FILL_SHAPE_CLEAR);}
}

void Out_b(byte x, byte y, byte size, bool black)
{
  if (black){RectOut(x+size+thick, y+size+(thick*2), thick, size, DRAW_OPT_FILL_SHAPE);}
  else{RectOut(x+size+thick, y+size+(thick*2), thick, size, DRAW_OPT_FILL_SHAPE_CLEAR);}
}

void Out_c(byte x, byte y, byte size, bool black)
{
  if (black){RectOut(x+size+thick, y+thick, thick, size, DRAW_OPT_FILL_SHAPE);}
  else{RectOut(x+size+thick, y+thick, thick, size, DRAW_OPT_FILL_SHAPE_CLEAR);}
}

void Out_d(byte x, byte y, byte size, bool black)
{
  if (black){RectOut(x+thick, y, size, thick, DRAW_OPT_FILL_SHAPE);}
  else{RectOut(x+thick, y, size, thick, DRAW_OPT_FILL_SHAPE_CLEAR);}
}

void Out_e(byte x, byte y, byte size, bool black)
{
  if (black){RectOut(x, y+size+(thick*2), thick, size, DRAW_OPT_FILL_SHAPE);}
  else{RectOut(x, y+size+(thick*2), thick, size, DRAW_OPT_FILL_SHAPE_CLEAR);}
}

void Out_f(byte x, byte y, byte size, bool black)
{
  if (black){RectOut(x, y+thick, thick, size, DRAW_OPT_FILL_SHAPE);}
  else{RectOut(x, y+thick, thick, size, DRAW_OPT_FILL_SHAPE_CLEAR);}
}

void Out_g(byte x, byte y, byte size, bool black)
{
  if (black){RectOut(x+thick, y+size+thick, size, thick, DRAW_OPT_FILL_SHAPE);}
  else{RectOut(x+thick, y+size+thick, size, thick, DRAW_OPT_FILL_SHAPE_CLEAR);}
}

void Out_Null(byte x, byte y, byte size)
{
  Out_a(x, y, size, false);
  Out_b(x, y, size, false);
  Out_c(x, y, size, false);
  Out_d(x, y, size, false);
  Out_e(x, y, size, false);
  Out_f(x, y, size, false);
  Out_g(x, y, size, false);
}

void Out_0(byte x, byte y, byte size)
{
  Out_g(x, y, size, false);

  Out_a(x, y, size, true);
  Out_b(x, y, size, true);
  Out_c(x, y, size, true);
  Out_d(x, y, size, true);
  Out_e(x, y, size, true);
  Out_f(x, y, size, true);
}

void Out_1(byte x, byte y, byte size)
{
  Out_a(x, y, size, false);
  Out_d(x, y, size, false);
  Out_e(x, y, size, false);
  Out_f(x, y, size, false);
  Out_g(x, y, size, false);

  Out_b(x, y, size, true);
  Out_c(x, y, size, true);
}

void Out_2(byte x, byte y, byte size)
{
  Out_c(x, y, size, false);
  Out_e(x, y, size, false);

  Out_a(x, y, size, true);
  Out_b(x, y, size, true);
  Out_d(x, y, size, true);
  Out_f(x, y, size, true);
  Out_g(x, y, size, true);
  

}

void Out_3(byte x, byte y, byte size)
{
  Out_e(x, y, size, false);
  Out_f(x, y, size, false);

  Out_a(x, y, size, true);
  Out_b(x, y, size, true);
  Out_c(x, y, size, true);
  Out_d(x, y, size, true);
  Out_g(x, y, size, true);
}

void Out_4(byte x, byte y, byte size)
{
  Out_a(x, y, size, false);
  Out_d(x, y, size, false);
  Out_f(x, y, size, false);

  Out_b(x, y, size, true);
  Out_c(x, y, size, true);
  Out_e(x, y, size, true);
  Out_g(x, y, size, true);
}

void Out_5(byte x, byte y, byte size)
{
  Out_b(x, y, size, false);
  Out_f(x, y, size, false);

  Out_a(x, y, size, true);
  Out_c(x, y, size, true);
  Out_d(x, y, size, true);
  Out_e(x, y, size, true);
  Out_g(x, y, size, true);
}

void Out_6(byte x, byte y, byte size)
{
  Out_b(x, y, size, false);

  Out_a(x, y, size, true);
  Out_c(x, y, size, true);
  Out_d(x, y, size, true);
  Out_e(x, y, size, true);
  Out_f(x, y, size, true);
  Out_g(x, y, size, true);
}

void Out_7(byte x, byte y, byte size)
{
  Out_d(x, y, size, false);
  Out_e(x, y, size, false);
  Out_f(x, y, size, false);
  Out_g(x, y, size, false);

  Out_a(x, y, size, true);
  Out_b(x, y, size, true);
  Out_c(x, y, size, true);
}

void Out_8(byte x, byte y, byte size)
{
  Out_a(x, y, size, true);
  Out_b(x, y, size, true);
  Out_c(x, y, size, true);
  Out_d(x, y, size, true);
  Out_e(x, y, size, true);
  Out_f(x, y, size, true);
  Out_g(x, y, size, true);
}

void Out_9(byte x, byte y, byte size)
{
  Out_f(x, y, size, false);

  Out_a(x, y, size, true);
  Out_b(x, y, size, true);
  Out_c(x, y, size, true);
  Out_d(x, y, size, true);
  Out_e(x, y, size, true);
  Out_g(x, y, size, true);
}

void LargeNumOut(byte x, byte y, byte size, byte Num, bool clear)
{
  if (clear){
    if (size < 2)size=2; //size no smaller than 2
    thick=(size/4);
    if (size>=4){
      thick-=1;
    }
    switch(Num)
    {
      case 0:{Out_0(x, y, size);}break;
      case 1:{Out_1(x, y, size);}break;
      case 2:{Out_2(x, y, size);}break;
      case 3:{Out_3(x, y, size);}break;
      case 4:{Out_4(x, y, size);}break;
      case 5:{Out_5(x, y, size);}break;
      case 6:{Out_6(x, y, size);}break;
      case 7:{Out_7(x, y, size);}break;
      case 8:{Out_8(x, y, size);}break;
      case 9:{Out_9(x, y, size);}break;
    }
  }
  else{
    Out_Null(x, y, size);
  }
}
It is a lib file, so just #include it into the program that you want it in. To use it, use this function.

LargeNumOut(x_position, y_position, size_of_digit, Number_to_display, Don't_clear_digit);

The X and Y are for position. The size is any number (size 0 and 1 are too small, and will automatically become size 2). Number to display, is a single digit number in the range of 0-9. Don't clear digit, is set false to make the digit disappear (draw all 7 segments white). Instead of making the argument false, you could just use the command Out_Null(x, y, size); which is the same thing.
The firmware screen on the NXT says 1.28, as before, with the original firmware. Is there some way of identifying the enhanced firmware from the version information on the NXT?
In the Setings>NXT Version>FW (top line), it should read NBC/NXC 1.28. Also note, that is not the latest version. The latest is 1.31 (I don't know how much of a difference there is though).
Last edited by mattallen37 on 16 Dec 2010, 16:10, edited 1 time in total.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
jpetersohn
Posts: 3
Joined: 16 Dec 2010, 13:07

Re: Problem displaying RIC graphics (using NXC)

Post by jpetersohn »

In the Setings>NXT Version>FW (top line), it should read NBC/NXC 1.28. Also note, that is not the latest version. The latest is 1.31 (I don't know how much of a difference there is though).
Ah, yes, it does say NBC/NXC 1.28. One just needs to learn to read... I downloaded the firmware image about 2 days ago from the link I posted above, yet it only contained V1.28.
I'll try your version of the big digits, but I am still puzzled to why the RIC graphics do not work.

Thanks for your help!

Jens Petersohn
m-goldberg
Posts: 73
Joined: 29 Sep 2010, 12:05

Re: Problem displaying RIC graphics (using NXC)

Post by m-goldberg »

Mattallen37's 7-segment display code appears to be based on code from my counter tutorial. The tutorial is available HERE. It may be of interest because it is fully commented and has additional explanatory notes, which may help with understanding how such code works.
Regards, Morton
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Problem displaying RIC graphics (using NXC)

Post by mattallen37 »

You're right, the idea was based on your program, but I didn't base any specifics on yours, just the general idea.

Edit, actually I did use your "image" at the top comments part of the program.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
jpetersohn
Posts: 3
Joined: 16 Dec 2010, 13:07

Re: Problem displaying RIC graphics (using NXC)

Post by jpetersohn »

Problem solved.

The problem was caused by the NXTBrowser program. It appears to corrupt or otherwise not handle RIC files correctly. I downloaded the RIC files using the NeXT Tools from the Bricxcc website, after that the NXC program to display the numbers using the BIGdigits font worked correctly.

Thanks to everyone who tried to help!

Jens Petersohn
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Problem displaying RIC graphics (using NXC)

Post by hassenplug »

jpetersohn wrote: The problem was caused by the NXTBrowser program. It appears to corrupt or otherwise not handle RIC files correctly. I downloaded the RIC files using the NeXT Tools from the Bricxcc website, after that the NXC program to display the numbers using the BIGdigits font worked correctly.
Over the weekend, I ran into the same problem.

I have some c# code that I wrote/copied to download a file to the NXT via bluetooth. I've used it with .rxe files, as well as .txt files. But when I use it with .ric files, the ric will not be displayed by a program in either NXT-G or NXC.

I tried downloading it with the RobotC UI (which IS able to dl files to the standard firmware), but they would still not work.

Only when I used Bricxcc to download them, did they actually work.

I'd love it if John can help us out here, and tell us what's different about .ric files, so I can add it to my c# code.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Problem displaying RIC graphics (using NXC)

Post by afanofosc »

I'm pretty sure that the only difference with .ric files vs .txt files is that they have to be created as linear files. So you would need to use OpenWriteLinear rather than OpenWrite. RIC and RXE files (and SYS and RTM) all need to be linear but .rso and other files that you might use in a program do not need to be linear.

I use the C version of the Fantom API. See line 2353 here:

http://bricxcc.svn.sourceforge.net/view ... iew=markup

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Problem displaying RIC graphics (using NXC)

Post by hassenplug »

I'll check that out. Thanks John.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests