thomas200813
Programmer
Hi all,
I really run into a big strange trouble when I use aspect script in Procomm recently.
In short ,it seems that $RXDATA doen't work well all the time. It looks that the behavior of $RXDATA depends on the received byte. I think the script is correct without syntax and logic error in it. The script could run normally sometimes.But I found that the $RXDATA is not updated when we receive hex byte by com port sometimes.I am sure that bytes are received in fact with the help of monitor window tool.
E.g I send 0x01 0x46 by computc and get response with 0x01 0xff finally. We can observe 0x01 and 0xff in monitor window tool.But the $RXDATA is not updated in fact.It is still zero until I send next command and observe we can get the response for the last command togther with the next command.
The main functionality of my aspect script is to send hex command by COM port of my laptop to another RS232 UART interface.
The command will be sent by computc command and then the script will wait for the response from remote RS232 UART interface by monitoring $RXDATA system variable.The script uses comgetc the data from rxbuffer. Please refer to the script shown below in detail.
The big trouble is that:
The script doesn't always works well/normally. I don't think there is any syntax error or logic error in the aspect script because the script works well for sending/receiving some commands/bytes/data.Take hex byte 0x01 for example , the script will first send 0x1 by computc command to remote rs232 UART interface and then the script will receive two byte from remote interface. Those are 0x01 and FF . But the problem is that the procomm really received two bytes from remote system with the help of monitor window, yet the aspect is still deadlock running waiting for those two bytes.In fact , those responsed two bytes has arrived at procomm , but $RXDATA system varient is not updated corespondingly.So the aspect is still looping in the while loop all the time without exiting normally. At this time ,I make the script send another command , strangely I found that those two bytes for last command are counted together with this command.That is to say, the system varient $RXDATA is 3 at this time. I don't know why $RXDATA is not updated to 1 for the last command.
Is this the issue mentioned in .
"Another ASPECT user ran into a problem where Procomm Plus did not immediately process the character 0x01 (SOH) and only processed it when two additional characters were received. He verified this by monitoring the value of $RXDATA. He was able to resolve the problem by turning off the "Enable automatic download start for Zmodem and Kermit" checkbox in Procomm's Setup dialog"
aspect script :
func ITI_S01_C13:integer
integer result = SUCCESS
integer i=0
integer rx_chr
integer rx_array[3]
set aspect rxdata ON
computc 0x00+0x01
computc 0x46
i=0
while 1
while $RXDATA
comgetc rx_chr
rx_array = rx_chr
i++
endwhile
if( i >= 2)
exitwhile
endif
endwhile
result |= (rx_array[0]!=0x01||rx_array[1]!= 0x00)
txflush
rxflush
i=0
computc 0x80+0x01
while 1
while $RXDATA
comgetc rx_chr
rx_array = rx_chr
i++
endwhile
if( i >= 3)
exitwhile
endif
endwhile
result |= (rx_array[0]!=0x81||rx_array[1]!= 0x00)
result |= ((rx_array[0]^rx_array[1]^rx_array[2])!=0xAA)
return result
endfunc
Thanks a lot for your great help in advance,
Thomas.
I really run into a big strange trouble when I use aspect script in Procomm recently.
In short ,it seems that $RXDATA doen't work well all the time. It looks that the behavior of $RXDATA depends on the received byte. I think the script is correct without syntax and logic error in it. The script could run normally sometimes.But I found that the $RXDATA is not updated when we receive hex byte by com port sometimes.I am sure that bytes are received in fact with the help of monitor window tool.
E.g I send 0x01 0x46 by computc and get response with 0x01 0xff finally. We can observe 0x01 and 0xff in monitor window tool.But the $RXDATA is not updated in fact.It is still zero until I send next command and observe we can get the response for the last command togther with the next command.
The main functionality of my aspect script is to send hex command by COM port of my laptop to another RS232 UART interface.
The command will be sent by computc command and then the script will wait for the response from remote RS232 UART interface by monitoring $RXDATA system variable.The script uses comgetc the data from rxbuffer. Please refer to the script shown below in detail.
The big trouble is that:
The script doesn't always works well/normally. I don't think there is any syntax error or logic error in the aspect script because the script works well for sending/receiving some commands/bytes/data.Take hex byte 0x01 for example , the script will first send 0x1 by computc command to remote rs232 UART interface and then the script will receive two byte from remote interface. Those are 0x01 and FF . But the problem is that the procomm really received two bytes from remote system with the help of monitor window, yet the aspect is still deadlock running waiting for those two bytes.In fact , those responsed two bytes has arrived at procomm , but $RXDATA system varient is not updated corespondingly.So the aspect is still looping in the while loop all the time without exiting normally. At this time ,I make the script send another command , strangely I found that those two bytes for last command are counted together with this command.That is to say, the system varient $RXDATA is 3 at this time. I don't know why $RXDATA is not updated to 1 for the last command.
Is this the issue mentioned in .
"Another ASPECT user ran into a problem where Procomm Plus did not immediately process the character 0x01 (SOH) and only processed it when two additional characters were received. He verified this by monitoring the value of $RXDATA. He was able to resolve the problem by turning off the "Enable automatic download start for Zmodem and Kermit" checkbox in Procomm's Setup dialog"
aspect script :
func ITI_S01_C13:integer
integer result = SUCCESS
integer i=0
integer rx_chr
integer rx_array[3]
set aspect rxdata ON
computc 0x00+0x01
computc 0x46
i=0
while 1
while $RXDATA
comgetc rx_chr
rx_array = rx_chr
i++
endwhile
if( i >= 2)
exitwhile
endif
endwhile
result |= (rx_array[0]!=0x01||rx_array[1]!= 0x00)
txflush
rxflush
i=0
computc 0x80+0x01
while 1
while $RXDATA
comgetc rx_chr
rx_array = rx_chr
i++
endwhile
if( i >= 3)
exitwhile
endif
endwhile
result |= (rx_array[0]!=0x81||rx_array[1]!= 0x00)
result |= ((rx_array[0]^rx_array[1]^rx_array[2])!=0xAA)
return result
endfunc
Thanks a lot for your great help in advance,
Thomas.