View Single Post
Old November 30th, 2017, 06:30 PM   #1
MATT116
Member
United States

MATT116 is offline
 
Join Date: Dec 2009
Location: Dallas, TX
Posts: 330
Redlion Raw Serial Port

Working on a project where I need to set the voltage, current and read the status on some power supply's.
There are 5 power supply's.
Each has a address switch (0-7).
Power supply's are connected to each other through a RS-485 port.
I will be using the RS-232 port on the redlion (G07) to talk to the 1st power supply (1st power supply has a RS-232 port and a RS-485 port).
Power supply's use UART protocol.
I have communication and can read and write parameters.
I use the "ADDS" to talk to a specific power supply (0-7)
What I don't understand is why I have to break it down into two programs?
For example on a push buttons action:
On pressed: I set the address using: PortPrint (Port, "ADDS 3" + "\R\N");
On Release: I set the voltage using: PortPrint (Port, "SV" + DecToText(PWS1.VoltageSP,0,3,2,0,0) + "\R\N");
That works and I'm able to set the voltage however if I combine both of those commands into one program and trigger it with "on tick" or "on release" of a push button it doesn't work.
I don't understand what the difference is?
O-yea this is my first time writing a driver...
Thanks
  Reply With Quote