Carsonz wrote: ↑Thu Jan 25, 2018 6:16 am
I am currently working on a project to control which channel a KVM selects based off what signal it recives. The KVM is able to recive RS-232 signals through it's options port, which uses a standard 8p8c connector. The KVM has serial port channel selection codes that are a certain hex. I currently have a raspberry pi model b set up to send the required signals to the KVM, however I don't know how to write a script that sends these certain hexes to the KVM. Im currently testing this and only need it to send these signals to switch what channel it is using. Im mostly new to scripting but i've worked briefly with python on the raspberry pi before. Any help would be appreciated
At the hardware level you just send data in (usually) 7 or 8 bit blocks (surrounded by start and stop bits and possible parity bits - that's what the 8N1 notation indicates).
From your code you can create the data to send the relevant bit string from your language of choice, the likes of Python, Ruby, C, Perl (as a beginner I'd suggest choosing a language in that order - you probably want to stay away from C or perl). So the question is really how to create a character with a certain bit string in your chosen language that you can then send to the serial port.
Hex is a simple way of writing down bit strings, for example the following bit pattern
0100 0001
translates into a hex number of
41 (often written as 0x41)
and is decimal 65 (which in ASCII is displayed as an
A)
so sending an
A over the serial port would be seen as Hex
41 or binary
0100 0001