Tagged: send data, UART communication
- AuthorPosts
Hello,
Due to the setting of the command, changing the value is a dynamic change process, so there is more data return value.
You can filter out some return values that you think need to be filtered through your program.Hello Patricia,
I have done various types of filtering on the mcu side but due to the vast data being bounced back by command “set_value”, not everything can be filtered.
Some data still changes the status of buttons, etc.
I do wonder why data should bounce back to the mcu when the command is simply “set_value” meaning I’m sending the value of the progress bar, not necessarily wanting data bouncing.
If I want data from the bar then I can use command “get_value” instead which makes more sense.
Please advise.
Thanks.
Can you tell me what MCU you are using? preferably with the program code
Hello Bowei,
We use a PIC18F47K40 micro in our mcu.
Sample program loop as follows:
———————————————————————–
main_loop:
‘Gosub calculate sensor values….
‘Calculate percentage of sensor capacity (sensor value/capacity x 100) – the result will be the value to be sent to the progress_bar
Serial_out, baud_rate, [Sensor_1, Sensor_2, etc…] – display the sensor values
Serial_out, baud_rate, [ ST<{“cmd_code”:”set_value”,”type”:”progress_bar”,”widget”:”progress_bar”,”value”:sensor_percentage_result}>ET] – send value to progress_bar
Serial_in, baud_rate, [button_press_arrays] – wait for button press and jump to next code if button press is detected
If button_press = “AA” then jump to subroutine A…
If button_press = “BB” then jump to subroutine B…
Goto main_loop – keep on looping while no button is pressed
———————————————————————–
Above is a simple representation of our program code. What happens is the progress_bar also sends back data/values (which I don’t need) and these values sometimes cause a problem with the serial_in command. For example, a button will be pressed by itself and jump to a subroutine even without pressing it physically. This is because the serial_in command continuously monitors and reads data, including the progress_bar.
I have tried filtering the data being received by the serial_in command, but still some data from the progress_bar comes through and cause problems.
It would really be nice if the progress_bar doesn’t send data/value back when you send the “set_value” command to it.
If I need the data/value, then I should just be able to use “get_value” command.
Thanks.
I haven’t used this MCU, can it be programmed in C? How does it determine the data received by the serial port? Is it polling or interrupt? One idea I’ve come up with is to send the set_value progress bar and then do a loop to clear the data coming next.
//Like this Arduino program:
#include “stone.h”
extern unsigned char receive_over_flage;
extern recive_group STONER;
extern unsigned char STONE_RX_BUF[RX_LEN];char timer_flag = 0;
void setup()
{
TCCR1A = 0;
TCCR1B = 1 << CS12 | 1 << CS10; //1024fractional frequency 16000000/1024 = 15625HZ = 64us
TCCR1B |= 1 << WGM13 | 1 << WGM12; //MODE: CTC
ICR1 = 15625; //Reloading the value 64*15625 = 1S
TIMSK1 |= (1 << OCIE1A); //Enable the capture interrupt of timer 1
Serial.begin(115200);
}void loop() {
serial_receive();
if (timer_flag == 1)
{
set_value(“progress_bar”, “progress_bar1”, “66”);
timer_flag = 0;
delay(1000);
while(Serial.read()>0);
}}
ISR(TIMER1_COMPA_vect){ //Timer 1 interrupt function
timer_flag = 1;
}In this example, the set_value is sent to the progress control once per second, and the data received in the next 1 second is cleared directly after the sending is completed, which can have a certain effect
Hello,
I have tried various filtering methods to ignore the incoming data from the progress bar, but still no luck.
I would suggest just removing this from the firmware itself.
To update the progress bar, just use the “set_value” command, without any data coming back from the LCD to the MCU. This is the same as when you “set_text” to the LCD, no data comes back to the MCU.
To read the progress bar, then just use “get_value” and the LCD will send the data to the MCU.
I think this makes more sense.
Thank you very much.
This feature will be updated later to add the option to turn off automatic data sending, which can be turned off by the user.
Hello Patricia,
Thank you for looking into this.
When do you think this becomes available so that I can update the LCD’s we have out there in the field.
Thanks again.
Hello Patricia,
Has this feature been added to the latest firmware 1.1.6?
Thanks and best regards.
Sorry, I don’t understand exactly what you mean by needs, can you describe it or show me a picture?
Sorry, I don’t understand exactly what you mean by needs, can you describe it or show me a picture?
Hello Patricia,
Thanks for your reply.
Kindly back read on previous messages to give you an understanding of the problem please. This is regarding the “set_value” command on the progress bar.
You actually replied on September 26, 2022 (Reply #3412), and you said that “the feature will be updated later to add to the option to turn off automatic data sending, which can be turned off by the user.”
Kindly check please.
Thanks again.
Hello Patricia,
Thanks for your reply.
Kindly back read on previous messages to give you an understanding of the problem please. This is regarding the “set_value” command on the progress bar.
You actually replied on September 26, 2022 (Reply #3412), and you said that “the feature will be updated later to add to the option to turn off automatic data sending, which can be turned off by the user.”
Kindly check please.
Thanks again.
Hello! We are studying this function and it will take some time. I have written down your requirements. If we finish this function, someone will inform you to update the firmware and tell you the specific operation steps. Please be patient for some time.
Thanks!Ok Patricia.
Thanks.
Hi I have the same problem, when i sent a value to a label, the HMI returns data. it does that my mcu collaps because there are a lot of data on serial buffer. Can you help me, I have the stone-designer 2.0.27
- AuthorPosts
You must be logged in to reply to this topic.