Machsupport Forum

Third party software and hardware support forums. => Modbus => Topic started by: Astroguy on June 11, 2011, 10:37:58 AM

Title: Remote USB display with Modbus
Post by: Astroguy on June 11, 2011, 10:37:58 AM
Hi All, I am having a hard time getting a handle on getting the DRO info to my LCD.
I know nothing about VB so I used one from another thread. The USB board I am using is
A Gravitech SLCD-3-Kit seen here http://www.gravitech.us/sechlcddrbok1.html (http://www.gravitech.us/sechlcddrbok1.html)
I am including the settings I am using and a vidieo of what the LCD is showing.
It is close but not right and keeps scrolling.http://www.youtube.com/watch?v=0z4vCZEsZa4
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 11, 2011, 12:13:32 PM
I might be wrong BUT I don't think you can do Modbus over USB. IF you had the NONUSB verison it should work fine as it uses RS232 which MACH can talk to through SendSerial or serial modbus.

IF you need LCD support it can be done through a MODIO unit from Peter Homann. OR from a POKEYS.

Just a thought. (;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 12, 2011, 09:06:32 AM
Thanks for the reply but it is possible, there are several pentants sold that are USB that have LCD read outs. If you saw the video I am close it is sending the DRO info just not the right format.
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 12, 2011, 01:57:49 PM
You may want to try sending it ALL as a string instead of individual updates.

The USB pendants are normaly run with a PLUGIN.

Just a thought, (;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 12, 2011, 02:38:33 PM
OOPS the sendstring is a modio control you are using sendserial.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 12, 2011, 03:28:56 PM
OK normaly when you write to an LCD you write to a position on a matrix such as row0 column 1

For a 4x20 display you would have rows 0-3 (4) and columns 0-19 (20).

What you are doing is sending charector straight in and it just wraps the data around and around (linewrapping).

Look at the manual for the format for writing to the LCD display.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 12, 2011, 04:18:39 PM
OK normaly when you write to an LCD you write to a position on a matrix such as row0 column 1

For a 4x20 display you would have rows 0-3 (4) and columns 0-19 (20).

What you are doing is sending charector straight in and it just wraps the data around and around (linewrapping).

Look at the manual for the format for writing to the LCD display.

(;-) TP

Thanks for the help, I have the manual it is down loadable from http://www.gravitech.us/sechlcddrbok1.html
But it is all Greek to me I have never tried to program anything before, it is going to take  someone smarter than me to
figure it out.

Title: Re: Remote USB display with Modbus
Post by: BR549 on June 12, 2011, 05:48:11 PM
I'll Have to dig out some old info when we did it long ago for hand pendants.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 12, 2011, 07:42:15 PM
OK I have no idea if this will work but give it a try. WHat we are doing is sending 1 long string of everything. Everything is spaced out so when it line wrappes ALL the stuff lines up on each line(hopefully)  If you need to adjust it do it in the " " at the each of each line the spaces are empty holder places ADD or subbtract a space to adjust. Basically each line is 16 charectors lone then it wrapps the line.

The "?Y0,?X0" SHould be the starting point of the Matrix, Row 1 column one

We may need to send a blank page each time but try it first.

XV = "X: " & Format (Getdro(0) , "+000.0000;-000.0000") & "    "
YV = "Y: " & Format (Getdro(1) , "+000.0000;-000.0000") & "    "
ZV = "Z: " & Format (Getdro(2) , "+000.0000;-000.0000") & "    "
AV = "A: " & Format (Getdro(3) , "+000.0000;-000.0000") & "    "
MS = "?Y0,?X0"
SendSerial "" &MS &XV &YV &ZV &AV

Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 13, 2011, 05:52:05 PM
Well I tried the VB above and it still does the same thing. Is there something in the ModBus status and controll settings I need to set up?
Thank you so much for taking the time to help me.



OK I have no idea if this will work but give it a try. WHat we are doing is sending 1 long string of everything. Everything is spaced out so when it line wrappes ALL the stuff lines up on each line(hopefully)  If you need to adjust it do it in the " " at the each of each line the spaces are empty holder places ADD or subbtract a space to adjust. Basically each line is 16 charectors lone then it wrapps the line.

The "?Y0,?X0" SHould be the starting point of the Matrix, Row 1 column one

We may need to send a blank page each time but try it first.

XV = "X: " & Format (Getdro(0) , "+000.0000;-000.0000") & "    "
YV = "Y: " & Format (Getdro(1) , "+000.0000;-000.0000") & "    "
ZV = "Z: " & Format (Getdro(2) , "+000.0000;-000.0000") & "    "
AV = "A: " & Format (Getdro(3) , "+000.0000;-000.0000") & "    "
MS = "?Y0,?X0"
SendSerial "" &MS &XV &YV &ZV &AV


Title: Re: Remote USB display with Modbus
Post by: BR549 on June 13, 2011, 07:02:13 PM
There is probably a setting for the LCD that needs to be set to stabilize the screen. I'll take a look

You are not really using ModBUS the SendSerial VB command is a seperate thing it sends data straight to the serial port. AND it is not really RS232 protocal.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 13, 2011, 07:10:36 PM
Are you using the USB driver for the card ? Have you tried the software for the card to make messages to SEE if it is actually working correctly?

Maybe set up hyperterm and send it some data??


(;-)TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 13, 2011, 07:11:28 PM
There is probably a setting for the LCD that needs to be set to stabilize the screen. I'll take a look

You are not really using ModBUS the SendSerial VB command is a seperate thing it sends data straight to the serial port. AND it is not really RS232 protocal.

(;-) TP

So all I really need to do in the setup is Com port and protocall settings, 8,none,1 on com5.
Thank you soooo much!!!
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 13, 2011, 07:19:06 PM
I did not have to instll a driver, when I plug it in it creates a virtual com port, If i use hyper terminal I can address it directly.
The manual has a list of comands but I am not sure what they all mean.



Are you using the USB driver for the card ? Have you tried the software for the card to make messages to SEE if it is actually working correctly?

Maybe set up hyperterm and send it some data??


(;-)TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 13, 2011, 07:25:58 PM
OK I think I see the problem. Go an turn OFF all the modbus stuff you turned on.

Then load the driver and look to see what port# it is using.

Then go to GenConfig page look in the lower LH corner and set the COM port to the one you are using. Check 8 bit.

That will set up mach to use the com port .

Then retry your code to see what happens.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 14, 2011, 09:03:43 AM
Thanks, I will try that when I get home tonight and let you know how I make out.



OK I think I see the problem. Go an turn OFF all the modbus stuff you turned on.

Then load the driver and look to see what port# it is using.

Then go to GenConfig page look in the lower LH corner and set the COM port to the one you are using. Check 8 bit.

That will set up mach to use the com port .

Then retry your code to see what happens.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 14, 2011, 06:47:06 PM
OK I got a chance to try it and it did not work at all, I got nothing on the LCD.
It seems it does not see it unless modbus is turned on?
I can not believe all the time you spent to help me but I am feeling bad about the time you wasted I really thought it would be easy maybe I should give up until I learn more about it.

Thank you so much for your time on this    :)

Fred


OK I think I see the problem. Go an turn OFF all the modbus stuff you turned on.

Then load the driver and look to see what port# it is using.

Then go to GenConfig page look in the lower LH corner and set the COM port to the one you are using. Check 8 bit.

That will set up mach to use the com port .

Then retry your code to see what happens.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 14, 2011, 07:33:18 PM
Fed it is not a waste and I have the time to burn IF it will help you get it working.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 14, 2011, 08:13:09 PM
Thank you, if you don`t mind I will not turn down the help. I will try anything.

Fred


Fed it is not a waste and I have the time to burn IF it will help you get it working.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 15, 2011, 09:40:33 AM
OK if you can write to it with Hyperterm them all we should have to do is find out the Comport settings that HT used.

Then try setting up the MCAH port the same.   Then we can start with something simple like

SendSerial "Hello" and see what happens.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 15, 2011, 06:29:48 PM
That worked it said Hello on the LCD!!!!

Fred
OK if you can write to it with Hyperterm them all we should have to do is find out the Comport settings that HT used.

Then try setting up the MCAH port the same.   Then we can start with something simple like

SendSerial "Hello" and see what happens.

(;-) TP
OK if you can write to it with Hyperterm them all we should have to do is find out the Comport settings that HT used.

Then try setting up the MCAH port the same.   Then we can start with something simple like

SendSerial "Hello" and see what happens.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 15, 2011, 07:24:56 PM
OK see I told ya just ONE small itsiy tiny step away. Now we need to figure out the matrix

Try sendserial "abcdefghijklmnop"      that would be 16 charectors or 1 full line.

(;-)TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 15, 2011, 07:44:53 PM
OK, that worked as well but I found out it only worked when I run the VB script manually in the editor. If I save it as macropump.m1s and start Mach it does not show up. Ans yes I do have run macro pump checked in Comfig. Is there something in ports and pins that I missed?

Fred




OK see I told ya just ONE small itsiy tiny step away. Now we need to figure out the matrix

Try sendserial "abcdefghijklmnop"      that would be 16 charectors or 1 full line.

(;-)TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 15, 2011, 08:12:01 PM
HUM, no if it runs in vb script it should run as a macropump. The macropump is just a vb script ran 10 times per second all the time.

OK try this  sendserial" ?x0,?y1" & "hello"                it should put hello on the second line down from the top

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 15, 2011, 10:05:13 PM
It worked manually OK it put it second line down one space over from the left.

Fred


HUM, no if it runs in vb script it should run as a macropump. The macropump is just a vb script ran 10 times per second all the time.

OK try this  sendserial" ?x0,?y1" & "hello"                it should put hello on the second line down from the top

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 15, 2011, 10:58:36 PM
OK one last thing for today,  

Sendserial " abcdefghijklmnopqrstuvwxyz"  Lets see if it will line wrap.  IF it does OK then send the original SCript that had the single string to it from the editor. If that works let me know.

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 16, 2011, 10:41:45 AM
OK one last thing for today, 

Sendserial " abcdefghijklmnopqrstuvwxyz"  Lets see if it will line wrap.  IF it does OK then send the original SCript that had the single string to it from the editor. If that works let me know.

(;-) TP

Sorry I did not get this untill this morning, when I get home tonight I will try it. Also is this the other one you wanted me to try?

XV = "X: " & Format (Getdro(0) , "+000.0000;-000.0000") & "    "
YV = "Y: " & Format (Getdro(1) , "+000.0000;-000.0000") & "    "
ZV = "Z: " & Format (Getdro(2) , "+000.0000;-000.0000") & "    "
AV = "A: " & Format (Getdro(3) , "+000.0000;-000.0000") & "    "
MS = "?Y0,?X0"
SendSerial "" &MS &XV &YV &ZV &AV

Title: Re: Remote USB display with Modbus
Post by: BR549 on June 16, 2011, 02:06:35 PM
HIYA FRED,   YEP that is the one BUT less make a slight mod and send this. I removed the comma between the ?x and ?y

XV = "X: " & Format (Getdro(0) , "+000.0000;-000.0000") & "    "
YV = "Y: " & Format (Getdro(1) , "+000.0000;-000.0000") & "    "
ZV = "Z: " & Format (Getdro(2) , "+000.0000;-000.0000") & "    "
AV = "A: " & Format (Getdro(3) , "+000.0000;-000.0000") & "    "
MS = "?Y0?X0"
SendSerial "" &MS &XV &YV &ZV &AV
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 16, 2011, 07:16:39 PM
OK, we do have line wrap. I tried the scrip and it is close here is what we have now.
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 16, 2011, 08:47:59 PM
I also figured out why the macro was not running, it was in the wrong folder. It now runs when I start Mach but everything scrolls across the LCD?
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 16, 2011, 09:20:15 PM
I was able to get it to stop scrolling by adding this to this line.
MS = "?Y0?X0?a?G420"
This is what I have now and the curser stays where you see it and blinks.
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 16, 2011, 09:24:14 PM
Great all you have to do now is adjust the spaces at the end of each line to make it wrap to the proper starting spot.  ADD more spcaes between the "     " you do it with the space bar.  Iwas thinking you had a 4x16 dispaly it is 4x20 so add 4 spaces to each "     "

(;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 17, 2011, 07:24:01 AM
That did it!!!!! You are the man I can`t thank you enugh for all your help this is so great.  :o
 ;D ;D ;D ;D ;D ;D
Title: Re: Remote USB display with Modbus
Post by: BR549 on June 17, 2011, 10:39:13 AM
Fred it was not just me YOU are the MAN. (;-) You ORIGINATED teh idea and kept at it until you worked it out. I just bumped you back on track a couple of times.

NOW could you write a little summary of what ALL you did to make it all work THEN post it HERE so if people do a search they can find the info

Great JOb, (;-) TP
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 18, 2011, 12:57:49 PM
Fred it was not just me YOU are the MAN. (;-) You ORIGINATED teh idea and kept at it until you worked it out. I just bumped you back on track a couple of times.

NOW could you write a little summary of what ALL you did to make it all work THEN post it HERE so if people do a search they can find the info

Great JOb, (;-) TP

Yes I will.
Title: Re: Remote USB display with Modbus
Post by: Astroguy on June 18, 2011, 02:49:08 PM
For a complete how to go to thread

 http://www.machsupport.com/forum/index.php/topic,18759.0.html