To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.pbforthOpen lugnet.robotics.rcx.pbforth in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / pbFORTH / 595
594  |  596
Subject: 
IR problems
Newsgroups: 
lugnet.robotics.rcx.pbforth
Date: 
Fri, 9 Jan 2004 03:37:04 GMT
Viewed: 
2896 times
  
Hi,

I was having some problems in a program I'm writing in PbForth and it seems that
it could be related to the way I communicate thru IR. I use the Lego remote
control.

I joined the following code to demonstrate. I use the word 'getHeader' from
Ralph Hempel, which I call repeatedly. I added a few words so the program would
beep and display '0' before the word EKEY and display 999 right after the word
EKEY. Now, it seems that once in a while, the program gets stuck on the word
EKEY until a new character is received. In other words, the display shows 0
instead of 999, until I hit a key again.

I test the program by typing 10 t then I use the remote to send a signal to the
RCX. Most of the time it beeps and displays 999 but sometimes it displays 0
only.

Am I missing something here? Any ideas?

Thanks

Mario

Here's the test program

MARKER test

: SP! ( --- ) BEGIN DEPTH WHILE DROP REPEAT ;

: blip 0 16387 SOUND_PLAY ;
HEX
0 VALUE headerState
: getHeader ( -- f )
  EKEY?                                       \ Check for IR character
  IF
    LCD_CLEAR LCD_REFRESH   blip  \ Clears display and beeps
    3002 0 3001 LCD_NUMBER LCD_REFRESH \ Displays 0 before EKEY
    EKEY                                   \ If there is one, get it
    3002 3E7 3001 LCD_NUMBER LCD_REFRESH \ Displays 999 after EKEY
    headerState 0 =
    IF   55 = IF   1 TO headerState
              ELSE 0 TO headerState
              THEN
    ELSE

    headerState 1 =
    IF   FF = IF   2 TO headerState
              ELSE 0 TO headerState
              THEN
    ELSE

    headerState 2 =
    IF    0 = IF   3 TO headerState
              ELSE 0 TO headerState
              THEN

    THEN THEN THEN

  THEN

  3 headerState = ;
DECIMAL
: t1 0 DO getHeader DROP LOOP ;
: t 0 DO 30000 t1 LOOP SP! ;

10 t



Message has 1 Reply:
  Re: IR problems
 
(...) snip snip (...) ===...=== Ralph, any idea on this? Thanks (20 years ago, 23-Jan-04, to lugnet.robotics.rcx.pbforth)

7 Messages 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