![]() |
Serial Commands on MPLAB
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 ... |
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. |
Re: Serial Commands on MPLAB
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? |
| All times are GMT -5. The time now is 12:56. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi