PDA

View Full Version : RS485 for PTZ camera



kenny_m
- 8th November 2013, 20:45
My PTZ camera controller has died and I'm trying to design and build one myself. It uses a Pelco D protocol (2400 baud, 1 start, 8 data, no parity, and 1 stop) with RS485. Pelco D requires 7 bytes to be sent. The camera does not respond back so the transmission is Simplex. This is the first time I ever tried to use serial communication with a microcontroller, so I have no clue what I'm doing. There's only 20 PTZ commands that I'll be using. Each of which has 7 bytes of data. I'm using a MAX1487 with either a PIC16F84 or 16F627 because I have them in my parts cabinet.

My questions are first, can I use either of these PICs for this application? And second, can this be done without using any serial ports on the Microcontroller? Since I'm only using two port pins on the PIC, I can control the transmission manually without using any UARTs. I know this will lead to timing issues which I can resolve with some trial and error.

HenrikOlsson
- 9th November 2013, 06:48
Hello,
The SEROUT2 command is a bitbanged routine for async communications. It allows you to use "any" pin on the PIC as your "serial port" but it has the disadvantage of "blocking" the processor while it's doing its thing - which doesn't seem to present a problem in your case - and it allows you to set the number of databits, ie 7 in this case.

Given the two PICs you have, definitley go for the 627.

/Henrik.

kenny_m
- 9th November 2013, 15:29
Thanks henricolsson. Now I know I can use the parts I have. All I need to do now is write code for the PIC16F627 using the SEROUT2 command and sellect any pin as my output. You've just simplified my project. Thank you again.