To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2006
2005  |  2007
Subject: 
Re: tweaking around dlcd_show( )
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sun, 26 Aug 2001 01:26:32 GMT
Viewed: 
4047 times
  
In lugnet.robotics.rcx.legos, Alexandre Bec writes:
> Thanks Martin,
> I tried this too but it doesn't work :
> 
> progress.c:27: macro `dlcd_show' used with too many (2) args
> progress.c:27: macro `BIT_OF' used with just one arg
> progress.c:27: macro `BYTE_OF' used with just one arg
> 
> The hint seems to fit two arguments in one. But I don't know how to format
> these in order for them to be accepted by dlcd_show AND by the two macros

Ooops!  I obviously wasn't looking at it properly last night (only browsing
through the zip file).  As 'dlcd_show' is defined as a macro that takes one
parameter, but uses it twice to each of BIT_OF and BYTE_OF, which in turn
both take 2 parameters, which is what the define for the segments do, so you
can't use it the way you are trying.  Does any of that make sense?

> I tried to use the "real" value  0xef46,0x4 instead of the define  LCD_4_BOTL
> dlcd_show(0xef46,0x4); and I got obviously the same error.

This should work, unless the preprocesor has done something funny to it, or
is expected to do something funny to it.

> When trying at least to use directly the bit_set function with
> bit_set (0xef46,0x4); it works,
> but if I put these items in an array and invoking bit_set with
> bit_set(progressPattern[ i ][0], progressPattern[ i ][1] );
> I obtain a
> "inconsistent operand constraints in an `asm'  " because my array certainly
> does not contain the right type of data  for such a low-level operation. (how
> can we fit a single bit in an array ?)
You would need to define the elements as a structure, and then have an array
of that structure.

> I'll probably use an other approach, based on arrays of pointers on simple
> functions like :
> int progress1{
>   dlcd_show(LCD_4_BOTL);
>   return 0;
> }
Be careful, once you go down the dark side... oh sorry wrong advice :-)  Be
careful with arrays of function pointers, they are fine for small
applications like this, but I have worked on a project that used hundreds of
them, and it was almost impossible to figure out what was going on at some
points.

> Any help will be welcome
I would probably lean towards an array of structures, and then use bit_set
directly.

Like I said before I don't have a LegOs environment, so I can't test any of
this.  It would be interesting to see what the preprocessor is doing to the
macros.  I will have to build a LegOs environment one of these days.

Martin



Message has 1 Reply:
  Re: tweaking around dlcd_show( )
 
(...) Nope - bit_set(0xef46,0x4) will work, but not dlcd_show(0xef46,0x4), as it needs only 1 parameter. (...) Choosing the types of the struct elements is the problem - these are passed to the h8's bset instruction. First, I tried void* & char, but (...) (25 years ago, 27-Aug-01, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: tweaking around dlcd_show( )
 
Thanks Martin, I tried this too but it doesn't work : progress.c:27: macro `dlcd_show' used with too many (2) args progress.c:27: macro `BIT_OF' used with just one arg progress.c:27: macro `BYTE_OF' used with just one arg The hint seems to fit two (...) (25 years ago, 25-Aug-01, to lugnet.robotics.rcx.legos)

10 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR