Redlion Custom Driver

MATT116

Member
Join Date
Dec 2009
Location
Dallas, TX
Posts
330
I've been tasked with controlling 5 cotek power supply's using a redlion graphite HMI. I need to be able to adjust and read the current and voltage setting of each drive.
The cotek supports RS-232 and UART.
Since crimson does not have a prebuilt driver for cotek I'll have to write my own...o_O
I'm assuming I'll need to set the RS-232 port to "Raw Serial" in crimson and use the PortPrint() and PortRead() commands?

From the cotek manual:
Use CR and LF for termination.
To Set Output Voltage Setting
Syntax: SV <value>
Parameter: value -> Voltage value for setting
To set output voltage to 11.95v the command is: SV 11.95 CR LF

Is it as simple as this in crimson?
PortPrint(1, SV MYTAG CR LF)

I've never had to write a driver before so any help is appreciated.
Thanks
 
Last edited:
Is it as simple as this in crimson?
PortPrint(1, SV MYTAG CR LF)

Simple yes but not quite that simple.

Code:
cstring myStr;
myStr := "SV" + DecToText(mytag,0,2,2,0,0) + "\r\n";
PortPrint(1, myStr);
This assumes 'mytag' is a real/float variable. If not the formatting command may need to be different. The backslash characters are needed for CR/LF--this is documented in the manual. Writing characters and strings out the serial port is quite easy; reading them back is a bit more complicated as you are at the mercy of the device on the other end.
 
Simple yes but not quite that simple.

Code:
cstring myStr;
myStr := "SV" + DecToText(mytag,0,2,2,0,0) + "\r\n";
PortPrint(1, myStr);
This assumes 'mytag' is a real/float variable. If not the formatting command may need to be different. The backslash characters are needed for CR/LF--this is documented in the manual. Writing characters and strings out the serial port is quite easy; reading them back is a bit more complicated as you are at the mercy of the device on the other end.

Exactly what I was looking for.
Yes MYTAG would be a real.

Thanks!
 
Just curious, how do you intend to communicate with five devices over RS-232? It's not a multidrop protocol and the Graphite only has two RS232 ports I think.
 
Just curious, how do you intend to communicate with five devices over RS-232? It's not a multidrop protocol and the Graphite only has two RS232 ports I think.

cotek said I could do it using their "CT" cards and assigning an address to each device (see attached image) Then use the ADDS (device addressing command)

Available Command Set
ADDS Device addressing
GLOB Global Power On/Off Control
POWER Power on/off Query
SV Voltage Setting Control
SI Current Setting Control
SV? Voltage Setting Query
SI? Current Setting Query
RV? Voltage Query
RI? Current Query
RT? Temperature Query
REMS Remote on/off Query
STUS Device Status Query
INFO Information Query
RATE? Rate V/I Query
DEVI? Device Name Query
*IDN? Identification Query

CT251.jpg
 

Similar Topics

Does anyone have any recommendations on a software to use to create custom websites for Redlion Touchscreens? Something thats pretty quick and...
Replies
4
Views
2,332
Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
3
Views
49
Hi, I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The...
Replies
3
Views
153
Hi All, Hoping to get some insight into best way to terminate shielded twisted pair + common into a RJ45 required for RedLion RS485...
Replies
3
Views
209
I have 8 of these systems all running the same code. Just this one seem to gain about 30 seconds in time everyday. So in 48hrs time will be...
Replies
3
Views
649
Back
Top Bottom