|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
Just to check and see if i'm thinking straightforward here...
our team started to work with a few serial commands on MPLAB used to communicate with the camera. As an example, we wrote the following code for the SL (sleep) command: void Sleep_Mode(unsigned char active) { Write_Camera_Serial_Port('S'); Write_Camera_Serial_Port('L'); Write_Camera_Serial_Port(1); Write_Camera_Serial_Port(active); Write_Camera_Serial_Port('\r'); } First off, one point we were discussing was related as to whether the "Write_Camera_Serial_Port('\r');" was necessary or not. Secondly, should the function return any values whatsoever?... Any help at all would be greatly appreciated, as we're still a bit unsure as to how these serial commands work properly...so here's just a callout to all of you programmers out there who are less "confused"... Thanks ... Last edited by tribotec_ca88 : 24-01-2006 at 14:08. |
|
#2
|
|||||
|
|||||
|
Re: Serial Commands on MPLAB
Kevin's code puts the camera in "raw" mode, which does not want the '\r' after the parameters. The first byte after the command (here it's a 1) says how many more bytes will follow. I'm pretty sure an extraneous return at that point will have a real chance of waking the camera up immediately after you tell it to sleep.
I don't have a camera handy to test whether or not an ACK comes back after a sleep command, but it's easy for you to connect the camera serial port directly to a terminal and try it for yourself. |
|
#3
|
|||||
|
|||||
|
Quote:
... Quote:
Quick thought...on commands such as GS (Get servo) where you get a return value (in this case, the last position sent to a specific servo), where exactly should these values show up ? (on MPLAB, because on Hyperterminal i believe they show up after the ACK message, if i'm not mistaken...) Would they appear right on the Terminal window on IFI Loader??? Or would I have to set some sort of variable ready to receive the command's return value? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CMUcam2 Serial Port Diagnostics | Kevin Watson | Programming | 13 | 18-02-2006 15:05 |
| Scripting Setup and the Camera + Serial Port Drivers | CJO | Programming | 22 | 11-01-2006 17:42 |
| Updated: Serial Port Driver Code | Kevin Watson | Programming | 4 | 05-02-2005 18:39 |
| New Serial Port Driver | Kevin Watson | Programming | 16 | 09-01-2005 01:56 |
| using the MPLAB IDE MPLAB SIM simulator | WizardOfAz | Programming | 1 | 03-11-2003 01:24 |