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 / 41
40  |  42
Subject: 
A few notes...
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sun, 28 Feb 1999 22:36:24 GMT
Viewed: 
1361 times
  
Ha! Just completed my first LegOS program - and it only took a month!
(off and on :) )

I'm going to note some things which stalled me, in the hope that they
won't stall anyone else..

(1) I was trying to count how long the sensor was being pressed down.
The example below is not a good way to do it as it becomes an infinite
loop! I'm not sure why - I'm guessing it locks out the task-management
which would update the SENSOR_1 variable.

while(SENSOR_1 < 0x2000);

The next example is how I got it to work:
while(SENSOR_1 < 0x2000)
msleep(10);

I didn't experiment lowering the msleep value, I guess that it would
probably work with '1'.


(2) Converting a 16-bit number to two 8-bit values:

*(mem + cnt++) = (in.time >> 8) & 0xFF;
*(mem + cnt++) = in.time & 0xFF;

Does not work the next one does though:

*(mem + cnt++) = in.delay / 256;
*(mem + cnt++) = in.delay - (in.delay / 256);

I'm not sure if this is because gcc or the H8 is handling bit-shifts
squiffily, or whether I am.. but it's something to be wary of!

Cheers,
Richard

--
Remove everything in-between and including the '_'s to reply!



1 Message in This Thread:

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

Custom Search

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