Com port conversion

Hi

I am new to the arduino and i am wanting to make a protocol converter.

Basically it takes a 485 input tx and rx in port 1 reads the hex and then outputs a different hex on port 2

It is going to be used for cctv protocols

I understand i can use c++ for this,

Can this be done on the uno? Or do i need a mega?

Some of the hex will be the same format going in the first few bytes will be...then the rest will change with camera number speed etc the output will be the same but different values.

I have searched on this but cant seem to find a definitive answer. I can make an app in visual studio that can do this but i need a an all in one box
Thanks

Basically it takes a 485 input tx and rx in port 1 reads the hex and then outputs a different hex on port 2

I don't think you are using the term "port" in the same way the ATMEL uses it.

Serial ports are a different story.

Can this be done on the uno?

How many serial ports does a Uno have? How many does a Mega have?

well uno one mega four, but uno has software, wasn't sure if that is ok

I need to take rs485 in, convert the hex and output the rs485 in hex all in real time, to control PTZ commands on CCTV.

I think you need to take time to explain in more detail what you want to do. Your economy with words is not helpful.

Are you asking if you can receive data on one serial port and output an amended version of that data on a different serial port? If so, the answer is YES, as long as the amount of data can be handled by the Arduino.

And on an Uno you can use SoftwareSerial to add a second serial port - but it does not perform at high speeds like the HardwareSerial ports. There should be no trouble at 9600 baud.

If you have not yet invested in an Arduino I think it would make sense to buy a Mega and take advantage of the extra HardwareSerial ports. It also means you could connect 2 external serial devices and still communicate with the PC for debugging purposes.

...R

Robin,

Thanks for your reply, that is exactly what i want to achieve. I will invest in a mega for starters.

I see somebody has got the arduino to output the pelco protocol so i can start from there and then build on this to accept a different protocol input and then convert to pelco.

I want to then build different protocols so i can input and output different types by just uploading different sketches

If you need more help post details / examples of the different protocols you want to work with.

...R

Robin,

I intend to try and use cctv protocols of

Vcl - which i have documentation on
Pelco - which i have documentation on

These i would probably have to reverse engineer using a 485 sniffer to grab the hex on moving camera.

Molynx
Coe
Vista
Forward vision
Bbv

I have ordered all the parts and awaiting them arriving.

Incentive:
I intend to try and use cctv protocols of

Just so you know for the future, you will need to explain those protocols in detail if we are to understand the programming required. It would be best if you can provide examples of the input data and the transformed output data.

...R

Hi

ok some of the input data would be as follows.

rs485 input would be in hex the VCL protocol, three bytes

80 52 34

80 = for camera 1
52 = for right
34 = speed

first byte is camera number, second for direction, and third for speed on the VCL protocol.

this would then be converted to pelco and outputted as rs485 in hex to

FF 01 00 09 00 01 13

first bye is always the same, second byte is camera number, third byte is command = camera on, fourth byte command = focus, fifth byte is data = left/right etc, sixth byte is data = speed, seventh is checksum of byte 1 to 6.

so I would need to convert a 3 byte hex input to a 7 byte hex output.

Incentive:
so I would need to convert a 3 byte hex input to a 7 byte hex output.

That seems straightforward. If you are not able to get it to work, post your code.

I suggest you start with a very simple program that has the input hard-wired in the code and the output goes to the Serial Monitor.

...R

thanks very much for your input, hopefully the parts arrive by the weekend and I can get started on this.