|
|||
|
hi
my program is working fine, basically the code and everything is unchanged from the sample program QM that is available on the website. Now I want to save a stream of incoming text response from com port. I have a micro controller attached to the com port, I send it a chck command and it reponds with a stream of text for e.g "AH BH CH DH EH FH GH HH" I want to be able to capture this whole string so I can further write code in flash to process this information. > on a side note / although the qm program works, but in the response text box I cannot see the text properly /complete. For e.g. original response is AMOUNT OF T: 04 in the reponse textbox i can only read "T:04" this is not issue of textbox being too small to handle the whole text... //another side note: In Qm sample program is there specific Baudrate being used ? / if so what is it / I want to have a baudrate of 9600. thanks.. waiting for reply. - sz |
|
|||
|
There is a baudrate property of the cportx component, so you can use it to change the baudrate.
About the lost message, could you please send us your code of receiving com port messages? We will try to find out the reason. |
|
|||
|
Hi
I am at the university right now otherwise I would send it. But here is the thing... The code I am using is EXACTLY the same as QM.fla sample file. I downloaded the sample file and only removed the input text box and replaced it with buttons that basically define the input and also have the 'Query modem button' code on it. So for example I have a button. When i press the first button it says sumthing like command = "watever i want to send" and other code is same as QM file sample from website. Also about the property of cportx for baudrate... if you could pin point that out where it is again in the Qm sample code.... like it is called 'baud_rate" etc or it appears within some commands parameters samplecommand (xx,xx,baudrate here) etc. and/or please tell me the default baud rate that the qm is using. so i might search in code and change it to my desired one. I will go home and use the qm.exe again and see if I can actually see the text properly in the sample program or not and get back to you on that. thanks - SZ ALso in relation to this software I also posted this in a new thread. ================ i hv a software that uses the cportx active x component. Once I have made my application and run it on a new computer it says please install active x cport first. I want to put it inside my application somehow so I do not have to install it. I cannot even install cportx on uni computers because of having no admin rights. does embedding activex help with that. I saw import activex tab on the swfkit software..but i am not sure which files to import etc. Example/Sample skp project file with cportx embedding would be very koooooooool -------------- thanks for the support SZ |
|
|||
|
hi
i found out the problem which was causing the response box to only show come responses and not others. I made the text box very big and noticed that after the first reponse there are two line(vertical) spaces...and then all the rest appear at the same 3rd line. And that happens everytime the command to the microcontroller changes.... so i guess it is issue on the port of psoc that it is hitting carriage returns ? neway so now the question is how to write code about a particular part of the code. for example the reponse is AH BH CH DH EH FH GH HH AH appears then BH appears on same line then CH and so on. I need to write code to check if the reponse is AH or AL in actionscript. so if i can save the particular reponse in a string i know how to do the if loops etc. question how to get the reponse in a string. This reponse is received when a particular button is pressed so I can put some code in button to start capture stream etc if required....about when to stop capture i do not know what is convenient a can easily gave string a length and say just save the first 20 characters etc. also still curious about the baudrate... it is working fine with the microcontroller so i dont hv issue here i am just amazed that the microcontroller has 9600 baudrate and i am unable to use it with hyperlink unless I put 9600 as speed. is it a coincidence that QM sample program also has same or is it find the baudrate some how. thanks SZ |
|
|||
|
1. check the response
Code:
commx.onRxChar = function (count)
{
var stream = this.read(count);
var str = stream.read(2);
if (str == 'AH')
{
...
}
else if (str == 'AL')
{
...
}
}
Code:
commx.baudrate = 14400; trace(commx.baudrate); |
|
|||
|
hi
tried to get it to work...no luck yet... i presume " commx.onRxChar " is a command/function and should be used exactly as it is. Or is commx a variable that could have been defined as something else in the sample program QM. I do not know where to place the code. Here is what I am trying I open the sample qm.fla from website/ add a new layer and add the code on the first frame as. Code:
commx.onRxChar = function (count)
{
var stream = this.read(count);
var str = stream.read(2);
if (str == 'AH')
{
ans = "Yes";
}
else if (str == 'AL')
{
ans = "NO";
}
}
Does not work... Please tell me exactly where to put this code in the sample qm.fla file. is commx <-- supposed to be used as it is or could it have been called something different in the sample qm.fla program. I also tried to change the variable from 'ans' to _root.ans , still no results. ALso tried the baudrate command just to mess it up to something unsable, but seems the baudrate is also not being changed as microcontroller still works. (it shld not work for all baudrate , only for 9600). Again i am putting the code in a new layer/first frame in sample qm.fla program. thanks for your patience... I am almost there this is the last functionality I need for this project.... I might want to load jpgs but I have seen that issue being addressed a number of times on the forum so i will use those to figure it out if/when i run into problems. thanks again SZ |
|
|||
|
The code must be added into one of your ffish scripts, the "initialize" script would be ok.
"commx" is an instance of the CPortX ActiveX Component, which is created in ffish script: Code:
commx = new ActiveXObject("CPortX.ComPortX");
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|