|
Post by Rod on Apr 1, 2023 3:56:07 GMT -5
|
|
|
Post by arsk3bpp on Apr 1, 2023 14:33:51 GMT -5
Hi Rod Thanks for doing this ,I am not sure I know how to do it. I don't see the code. I was going to pose the code from the Radio Shack Manual but the copy paste function does not seem to work on LB forum pages. The heart of the meter seems to be Metex M4650. Upon opening that manual every thing looked like the Radio Shack 22-168. When I run the program nothing happens,and lof(#comport) and tx count both produce errors. Still troubled by the MScope not being able to restart. Now if copy and paste would work I would put this in the new thread. Best Regards Walt K3BPP
|
|
|
Post by Rod on Apr 1, 2023 15:18:50 GMT -5
Click on the brown coloured link in my last post. That takes you to the new thread that I started and you will find the test code there. You can use copy and paste on this forum. Keep,perseveringly, you can’t break anything.
|
|
|
Post by arsk3bpp on Apr 1, 2023 15:43:37 GMT -5
Hi Rod Did not find any code and could not gt copy and paste to work. Thanks for your help. Walt K3BPP
|
|
|
Post by Rod on Apr 2, 2023 2:10:41 GMT -5
I have started another thread, just click on the link below to go to that thread. But here is the code to try. 'Open the port briefly using an API call to determine the handle given by Windows 'We will use this handle later in Liberty, its the only way to get it. 'substitute your own port number lpFileName$ = "Com4" dwCreationDistribution = _OPEN_EXISTING hTemplateFile = _NULL calldll #kernel32, "CreateFileA", _ lpFileName$ as ptr, _ dwDesiredAccess as ulong, _ dwShareMode as ulong, _ lpSecurityAttributes as ulong, _ dwCreationDistribution as ulong, _ dwFlagsAndAttributes as ulong, _ hTemplateFile as ulong, _ hFileHandle as ulong
calldll #kernel32, "CloseHandle", _ hFileHandle as ulong, _ result as long call pause 250
'Now open the com port in Liberty and use the hFileHandle value in API calls open lpFileName$;":1200,n,7,2,ds0,cs0,rs" for random as #com call pause 250
'now set DTR high and RTS low print "setting DTR" CALLDLL #kernel32, "EscapeCommFunction", hFileHandle as ulong, _SETDTR as long,_ result as long
print "re-setting RTS" CALLDLL #kernel32, "EscapeCommFunction", hFileHandle as ulong, _CLRRTS as long,_ result as long call pause 250
#com "D"; call pause 500
response$ = input$(#com, lof(#com))
print len(response$) print response$ close #com end
sub pause ms timer ms,[done] wait
[done] timer 0 end sub
To copy the code highlight it with the mouse, then press Ctrl+c then move to where you want to paste it to, click with the mouse so you have the cursor at the point you want to insert the code and then press Ctrl+v Click here to get to the new thread.
|
|
|
Post by arsk3bpp on Apr 2, 2023 8:45:17 GMT -5
Hi Rod That program sure looks like it might work. How do I run the first part to get the window handle? Regards Walt
|
|
|
Post by Rod on Apr 2, 2023 9:11:14 GMT -5
The code will just run like any other code. Copy and paste the whole code and run it. You can use the ladybug icon to run it step by step or animated to let you see more of what happens.
Run it with your meter connected using the correct com port number and see how far it gets.
|
|
|
Post by arsk3bpp on Apr 2, 2023 10:27:15 GMT -5
Hi Rod Good news the program runs without error. I increased the pause in the program to 5000. The result is 1 and sometimes 0.
setting DTR re-setting RTS 1 ( copy paste now seems to be working, yea )
|
|
|
Post by Rod on Apr 2, 2023 12:29:01 GMT -5
Yes but sadly the program is not getting a response from the meter. It should be printing what is displayed on the meter’s screen.
There is no point in increasing the delay to 5000, five seconds, since the meter is meant to respond much more quickly.
|
|
|
Post by arsk3bpp on Apr 3, 2023 14:48:01 GMT -5
setting DTR re-setting RTS 15 |DC 06.02 V
I thought I would give it another try and low and behold it worked.This certainly is enough of an inspiration to keep going. Thanks so much Best Regards Walt K3BPP
|
|