View unanswered posts | View active topics It is currently Mon Mar 18, 2019 9:32 am

Reply to topic  [ 2 posts ] 
Bluetooth SendMessageWithParm 
Author Message

Joined: Thu Mar 28, 2013 12:25 pm
Posts: 1
Post Bluetooth SendMessageWithParm

I am using Robot C 2.03 to program a Lego NXT. I am using the function SendMessageWithParm to send information via BT and I was wondering if there is a potential problem if I send a message with the value 65535.

The function documentation indicates that the 16-bit words should be in between -32767 and 32767. However 65535 is also a 16-bit word. When I try it it seems to work but I would like to know if there are potential issues with doing this.


Thu Mar 28, 2013 12:33 pm

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 207
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Post Re: Bluetooth SendMessageWithParm
65535 will wrap around to -1, I believe. However, if the receiving robot knows beforehand that the incoming number will be positive, it can rewrite this information in a long variable. I f you need more help, you should probably post the code for both master and slave.

You are right when you say 65535 is a 16-bw, but it is a 16-b unsigned word. ROBOTC only calculates in signed values. 16-b signed words have the range of -32768 to 32767.

I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot

Fri Mar 29, 2013 5:10 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.