bborissov,
Thanks for your reply. I have a form setup do you can select the comm port, braud rate, etc.. I had a text box that you could type in the string and replaced that and hardcoded the string in the code. I have tried chr(5) and it failed. I have also tried 0x05 and the return string was 0x05. I have used Hypertermail to test and by sending a ctrl-e which should be the same as HEX 05 i get the response back from the scale. Below is the code for the "Test Scale" button on my form. Please take a look and see what I maybe doing wrong.
if empty(thisform.commport)
=messagebox('Missing communication.','Invalid port...')
return
endif
if empty(thisform.setting)
=messagebox('Missing setting.','Invalid setting...')
return
endif
**thisform.output = chr(5)
**thisform.output = thisform.dtext1.value
**if empty(thisform.output)
** =messagebox('Missing output string.','Invalid string...')
** return
**endif
if llportopen = .f.
wait 'Setup comm port 1 parameters' window timeout 3
thisform.cm.commport = thisform.commport
thisform.cm.settings = thisform.setting
thisform.cm.handshaking = thisform.handshake
thisform.cm.rthreshold = thisform.treshold
endif
if llportopen = .f.
wait 'Open port 1' window timeout 3
llportopen = .t.
thisform.cm.portopen = .t.
endif
thisform.output = chr(5)
**thisform.cm.output = "0x05"
thisform.timer1.enabled = .t.
wait window 'Waiting for scale to stabilize...' timeout 3
if thisform.cm.commevent <> 2
thisform.dtext2.value = 'Scale Test failed: ' + str(thisform.cm.commevent)
thisform.returnstr = 'Scale Test failed: ' + str(thisform.cm.commevent)
else
thisform.returnstr = thisform.cm.input
thisform.dtext2.value = thisform.returnstr
endif
wait 'Close port 1/2/3' window timeout 3
thisform.cm.portopen = .f.
thisform.timer1.enabled = .f.
thisform.refresh()