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 / 1847
1846  |  1848
Subject: 
More LNP Issues
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sun, 22 Apr 2001 22:14:11 GMT
Viewed: 
1332 times
  
Thanks to Rainer for helping me with the stupid compiler bug :)

Now that the PC side of LNP is working, I'm having troubles with the RCX
side... I've modified the LNP sample provided on the WinLNP page as follows
(with the includes trimmed):

#define MY_PORT 2
#define DEST_HOST 0x2
#define DEST_PORT 0x1
#define DEST_ADDR ( DEST_HOST << 4 | DEST_PORT )

int bGotIt = 0;
char Buffer[128];
char HasData=0;
int DataLength=0;
void addressHandlerPortOne(const unsigned char* data, unsigned char length,
unsigned char src)
{
dsound_system(DSOUND_BEEP);
lcd_int(length);
HasData = 1;
memcpy(Buffer,data,length);
//bGotIt = 1;
}

int main(int argc, char **argv)
{
cputs("test ");
sleep(1);
cputs("LNP  ");
sleep(1);
cputs("wait ");

//Assign a handling function to a particular port number:
lnp_logical_range(1);
lnp_addressing_set_handler(MY_PORT, addressHandlerPortOne);

while (!bGotIt)
{
msleep(200);
cputs("");
if(HasData)
{
lcd_int(lnp_addressing_write(Buffer,DataLength,DEST_ADDR,MY_PORT));
HasData = 0;
}
}

cputs("GotIt");

return 0;
}

The defines and lnp_addressing_write call is pretty much straight from the LNP documentation. But, I am stumpped at this problem, I know the RCX is getting data, cause of the beep in the LNP handler, and I know the lnp_addressing_write is being called, since I get 0 most of the time (1 if I start hitting the button too fast on the PC side). Also, what I'm using for the PC software at the moment is the VB sample that came with WinLNP. Does anyone know where my issue is popping up at?

Thanks
Matt



Message has 1 Reply:
  WinLNP issues
 
For those who prefer the Java programming language, I've written some classes that may help with LNP. What you need is : the JDK 1.2, the Java Communication APIs (classes for Java communication through the serial port, and my classes located at : (...) (23 years ago, 23-Apr-01, to lugnet.robotics.rcx.legos)

2 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