Subject:
|
Re: tweaking around dlcd_show( )
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Mon, 27 Aug 2001 01:56:06 GMT
|
Viewed:
|
1709 times
|
| |
| |
In lugnet.robotics.rcx.legos, Martin Scragg writes:
> 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.
Nope - bit_set(0xef46,0x4) will work, but not dlcd_show(0xef46,0x4), as it
needs only 1 parameter.
> > 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.
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 the compiler didn't
like it. Then I tried everything else, and nothing worked. When I get a chance
I'll try & find a h8 guru & see if we can work it out. It may be the assembler
directives (after the ":") but I don't know enough about those.
> > 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.
With something like this, I'd even get rid of the return value.
ROSCO
|
|
Message has 1 Reply: | | Re: tweaking around dlcd_show( )
|
| (...) Since writing this, I have set up a LegOs build environment, so had a play with it. It doesn't seem very useful the way it is written. See my bit about it below. (...) I had a bit of a go doing this as well, and since I didn't know what the (...) (23 years ago, 27-Aug-01, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
| | Re: tweaking around dlcd_show( )
|
| (...) 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 (...) (23 years ago, 26-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
|
|
|
|