SOLVED! Thanks for your help folks...
So I guess you could say I had 3 main problems:
- Couldn't operate using Sony Demo software
- Couldn't operate using RealTerm
- Couldn't properly send hex codes via Arduino software serial Serial library
Here's how I solved them:
1. (Demo software). My problem was that the Keyspan USB>RS232 adapter was on COM10, and the demo software only supported COM1-COM6. According to the manual, it's possible to re-map to another COM port, but I just installed the software on my Windows 7 laptop, and it mapped to COM1. Tested out the software... it works! It also has a nice readout that tells you what hex codes you're sending to the camera
2. (Realterm woes). I read the realTerm info (on the download page) from top to bottom, and realized I was making a couple of mistakes in setting up the ports. I wasn't using the "Change" buttons(so I thought I was making changes to the settings, but I really wasn't), and I was sending commands incorrectly. Sent the address (0x88,0x30,0x01,0xFF), IF_clear (0x88,0x01,0x00,0x01,0xFF), and zoom_tele commands(0x81, 0x01, 0x04, 0x07, 0x02, 0xFF) and the camera responded as expected! The only strange thing was that I didn't get the expected responses from the camera... but that's not important to me for this project, so I'll let it slide. Lesson learned: read the dang manual.
3. (Arduino woes) Using the Arduino Uno and software serial library, I was sending hex codes to realTerm and reading unexpected values. I replaced the Uno with a Mega 2560, used the Serial1 port to send commands to the camera, and it works! Serial0 is used for debugging. Maybe it's not the simplest solution, but it works for me. Also, you'll note that I used the serial write() command rather than print(x,HEX) where x a byte. Maybe only newbies like me make this mistake, but I had a hard time understanding which one I should use. Serial.write() definitely is the way to go.
I've copied my working HelloWorld code below, and I'll post my final code and wiring when the project is done!
Arduino Mega 2560 (IDE 1.0.3) + Sony EVI-D70 hello world code (WORKS):
/*
SUCCESSFUL:
2 BUTTONS- 1 TO ZOOM IN, AND ANOTHER TO ZOOM OUT
*/
byte address_command[4]= {0x88, 0x30, 0x01, 0xFF};
byte if_clear[5]= {0x88, 0x01, 0x00, 0x01, 0xFF};
//ZOOM BYTE ARRAYS
byte zoom_tele[6]= {0x81, 0x01, 0x04, 0x07, 0x02, 0xFF}; //Not exactly sure how this works yet
byte zoom_wide[6]= {0x81, 0x01, 0x04, 0x07, 0x03, 0xFF}; //Not exactly sure how this works yet
byte zoom_teleVar[6]= {0x81, 0x01, 0x04, 0x07, 0x25, 0xFF}; //Zoom In: 81 01 04 07 2x FF , where x is speed- 0(low)-7(hi);
byte zoom_wideVar[6]= {0x81, 0x01, 0x04, 0x07, 0x35, 0xFF}; //Zoom Out: 81 01 04 07 3x FF , where x is speed- 0(low)-7(hi);
byte zoom_stop[6]= {0x81, 0x01, 0x04, 0x07, 0x00, 0xFF}; //Stop all zooming
byte commandCancel[3]= {0x81,0x21,0xFF};
const int delayTime= 250; //Time between commands
const int button1=2; //Zoom in
const int button2=3; //Zoom out
const int ledPin = 13; // the number of the LED pin
void setup() {
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(ledPin, OUTPUT);
// initialize both serial ports:
Serial.begin(9600);
Serial1.begin(9600);
//Send Address command
for (int i=0; i<4; i++){
Serial1.write(address_command[i]);
}
//delay(delayTime);
delay(500); //delay to allow camera time for next command
//Send IF_clear command
for (int i=0; i<5; i++){
Serial1.write(if_clear[i]);
delay(100); //For USB testing-- NOT FOR ACTUAL CONTROLLER
}
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
Serial1.write(inByte);
}
//ZOOM TELE
int button1State=digitalRead(button1);
if(button1State==HIGH){
Serial.print("Button 1 high");
//digitalWrite(ledPin, HIGH);
//Cancel previous commands
//sendCommandCancel();
delay(delayTime);
//Send zoom tele command
for (int i=0; i<6; i++){
Serial1.write(zoom_teleVar[i]);
Serial.print(zoom_teleVar[i]); //for debugging
}
}
//ZOOM WIDE
int button2State=digitalRead(button2);
if(button2State==HIGH){
Serial.print("Button 2 high");
//Cancel prev commands
//sendCommandCancel();
delay(delayTime);
//digitalWrite(ledPin, HIGH);
for (int i=0; i<6; i++){
Serial1.write(zoom_wideVar[i]);
Serial.print(zoom_teleVar[i]); //for debugging
}
}
if(button2State==LOW && button1State==LOW){
for (int i=0; i<6; i++){
Serial1.write(zoom_stop[i]);
Serial.print(zoom_stop[i]); //for debugging
}
}
Serial.println();
}
void sendCommandCancel(){
for (int i=0; i<3; i++){
Serial1.write(commandCancel[i]);
}
}