Go to Post "We put the eek in Geek" - Wayne Doenges [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-01-2007, 00:57
Turdmoe Turdmoe is offline
Registered User
no team
 
Join Date: Jan 2007
Location: 1 AU from Sol
Posts: 3
Turdmoe is an unknown quantity at this point
DDT code for PC controlled robot

Hi everyone, I am trying to build a robot using the current vex microcontroller completely controlled through the serial port.
fxgovers over on the official Vex Forum helped me realize the vex default DDT code's potential.
I need to control my robot through the serial port which will be connected to a PC running a Visual Basic program. I have the motors figured out... you just set the PWM values 0-7 to whatever you want the motors at using the command byte 021 in dec. (15 in hex.)
to modify PWM 0 : AA 55 00 00 7F 15
the first and second bytes are always AA and 55 and don't really mean anything I guess... Is this right?
the third byte 00 in this case is the PWM you are writing to (command byte 15) or reading from (command byte 01)
the fourth byte means nothing as well and remains 00 right?
the fifth byte is the value that the PWM is set to
the sixth byte is the command byte
the command bytes I found in the DDT code in one of the header files:

#define READ_CMD 0 // Dynamic Debug commands
#define READ_PWMs 1 // Reads PWM data
#define READ_rxSPI 2 // Used for reading rxdata
#define READ_txSPI 3 // Used for reading txdata
#define UPDATE_PWM_MASK 7 // Used for updating the PWM Mask
#define READ_EE_DATA 8 // Used for reading EE data

#define WRITE_CMD 20
#define WRITE_PWMs 21 // Updates PWM data
#define WRITE_rxSPI 22 // Used for updating rxdata
#define WRITE_txSPI 23 // Used for updating txdata
#define WRITE_EE_DATA 25 // Used for writing EE data

However, now I need to be able to read ultrasonic sensor information. To do this I need to be able to set a digital out on the microcontroller to "on" and have the microcontroller send a packet over the serial port when the corresponding interrupt circuit is broken.
My plans for this were to send a packet from the computer that turns on a digital out and runs a loop statement like this:

while interrupt = 1:
request interrupt port status from microcontroller
timer = timer + 1

My first question is can a PWM value be used for digital I/O ports or is it restricted to analog?
If that is how the microcontroller sets the I/O 's and Interrupts then how are they ordered, are they listed in numerical order anywhere within the DDT code?
If that is not how to set and read data from digital I/O and interrupts then how can I?
Sorry, I am pretty sure I sound like an idiot but I am very new to this stuff.

Last edited by Turdmoe : 07-01-2007 at 01:00.
  #2   Spotlight this post!  
Unread 07-01-2007, 13:33
Turdmoe Turdmoe is offline
Registered User
no team
 
Join Date: Jan 2007
Location: 1 AU from Sol
Posts: 3
Turdmoe is an unknown quantity at this point
Re: DDT code for PC controlled robot

I found this segment of code in the Serial Driver of the microcontroller code
void Handle_Debug_Input(unsigned char data)
{
switch (debugIntState)
{
case 0: // 1st 0xAA
if (data == 0xAA) debugIntState = 1;
break;
case 1 : // 2nd 0x55
debugIntState = 0;
if (data == 0x55) debugIntState = 2;
break;
case 2 : //get idx
dataIn.RX_INDEX = data;
debugIntState = 3;
break;
case 3 : //get dataH
dataIn.RX_DATAH = data;
debugIntState = 4;
break;
case 4 : //get dataL
dataIn.RX_DATAL = data;
debugIntState = 5;
break;
case 5 : //get cmd
dataIn.RX_CMD = data;
debugIntState = 6;
break;
case 6 : //get FSRH
dataIn.RX_FSRH = data;
debugIntState = 7;
break;
case 7 : //get FSRL
dataIn.RX_FSRL = data;
debugIntState = 8;
break;
case 8 : //still processing
break;
default:
debugIntState= 0;
break;
}
}
I guess my question really is:
what are each of these for:
idx
dataH
dataL
cmd
FSRH
FSRL
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PC Controlled Robot EHaskins Programming 6 05-11-2006 06:45
Hex code loader for the robot! paulcd2000 Programming 4 22-10-2006 01:58
Camera Controlled Robot douglass1371 Programming 1 19-02-2006 19:22
Please Help... Code for 2004 robot Padfoot Black Programming 2 18-02-2004 17:07
WRRF Code wrapper for Innovation FIRST Code FotoPlasma Programming 0 02-02-2004 19:28


All times are GMT -5. The time now is 20:46.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi