Serial control in scripting
5 years 4 months ago #29533659
by RudyA
Serial control in scripting was created by RudyA
Hello,
I am trying to control the FBL2360S from a host computer using a script.
There is no information about serial receive function(s), only print to serial.
Does this mean that serial Rx is not supported in scripting?
If so, a workaround would be to use it without a script in serial mode.
How can the controller be configured to work with a terminal program?
Another unrelated question: is there non-volatile memory space for variables or is it configuration only?
Is there a way to remember last position after power up?
Thanks.
I am trying to control the FBL2360S from a host computer using a script.
There is no information about serial receive function(s), only print to serial.
Does this mean that serial Rx is not supported in scripting?
If so, a workaround would be to use it without a script in serial mode.
How can the controller be configured to work with a terminal program?
Another unrelated question: is there non-volatile memory space for variables or is it configuration only?
Is there a way to remember last position after power up?
Thanks.
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
5 years 4 months ago - 5 years 4 months ago #29533660
by Gabriel_Isko
Replied by Gabriel_Isko on topic Serial control in scripting
There is no utility in microbasic to read or parse data directly from the serial port on our controllers. The serial port is dedicated to receiving commands. The best way to custom data to our controllers is through the use of user variables (the !VAR command)
You can use the !EE command to store user data in flash. Please note, that this is limited to 10,000 cycles, so you do not want to continuously use it to update your position in flash memory. This limit is the number of cycles it takes for the flash memory to wear out.
All of our user commands are documented in section 19 of our User Manual
You can use the !EE command to store user data in flash. Please note, that this is limited to 10,000 cycles, so you do not want to continuously use it to update your position in flash memory. This limit is the number of cycles it takes for the flash memory to wear out.
All of our user commands are documented in section 19 of our User Manual
Please Log in or Create an account to join the conversation.
5 years 4 months ago #29533661
by RudyA
Replied by RudyA on topic Serial control in scripting
Can you tell me how to configure the controller to accept serial commands?
If I connect it to the terminal, it spits out data, but will not respond to a command.
Is there a way to preset to go to serial mode at power-up?
Thanks
If I connect it to the terminal, it spits out data, but will not respond to a command.
Is there a way to preset to go to serial mode at power-up?
Thanks
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
5 years 4 months ago #29533662
by Gabriel_Isko
Replied by Gabriel_Isko on topic Serial control in scripting
It should be able to accept serial commands by default. You also probably have the correct baud rate if you are seeing data.
Check to make sure that you are terminating your commands over serial. This can either be done with a carriage retrun (0x0D, '\r') or an underscore (0x5F, '_').
Check to make sure that you are terminating your commands over serial. This can either be done with a carriage retrun (0x0D, '\r') or an underscore (0x5F, '_').
Please Log in or Create an account to join the conversation.
5 years 4 months ago #29533666
by RudyA
Replied by RudyA on topic Serial control in scripting
According to the manual, storing a variable in the flash memory is done by
Syntax Scripting:
setconfig(_EE, aa, dd)
What is the command to retrieve it?
For example, I would like the controller to remember the last position after a power-down / power-up cycle.
Thanks
Syntax Scripting:
setconfig(_EE, aa, dd)
What is the command to retrieve it?
For example, I would like the controller to remember the last position after a power-down / power-up cycle.
Thanks
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
5 years 4 months ago #29533667
by Gabriel_Isko
Replied by Gabriel_Isko on topic Serial control in scripting
You can use the function getconfig(_EE, aa) where aa is the adress you are trying to read. You will also need to use setcommand(_EES, 1) to save the variables to flash.
Please Log in or Create an account to join the conversation.
5 years 4 months ago #29533668
by RudyA
Replied by RudyA on topic Serial control in scripting
According to the manual, setcommand(_EES, 1) is used to save a configuration, but
setconfig(_EE, aa, dd) is used to save a variable.
It seems that it's a two-step process
Example:
^EE 1 555 : Store value 555 in RAM location 1
%EESAV or !EES : Copy data from temporary RAM to Flash
So, if use
setconfig(_EE, 1, Counter) to store the value of Counter at location 1
setcommand(_EES, 1)
how can I retrieve the stored value of Counter?
getconfig(_EE, 1)?
will the stored value be loaded into Counter?
Thanks
setconfig(_EE, aa, dd) is used to save a variable.
It seems that it's a two-step process
Example:
^EE 1 555 : Store value 555 in RAM location 1
%EESAV or !EES : Copy data from temporary RAM to Flash
So, if use
setconfig(_EE, 1, Counter) to store the value of Counter at location 1
setcommand(_EES, 1)
how can I retrieve the stored value of Counter?
getconfig(_EE, 1)?
will the stored value be loaded into Counter?
Thanks
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
5 years 4 months ago #29533672
by Gabriel_Isko
Replied by Gabriel_Isko on topic Serial control in scripting
Yes, you are correct to use the getconfig() function. Variables saved into flash using _EES will be automatically loaded into RAM memory at system startup.
Please Log in or Create an account to join the conversation.
Time to create page: 0.066 seconds