View previous topic :: View next topic |
Author |
Message |
Madf
Joined: 13 Nov 2011 Posts: 179 Location: Moscow
|
Posted: Thu Nov 26, 2015 11:11 am Post subject: Work with a $timeout |
|
|
Hello.
Increasingly, doing projects with data transmission over the COM-port.
Of course I use: $timeout, INPUT, WAITKEY and SERIALIN...
There was a lot of questions.
1. Why, when triggered "timeout", there is no flag of its presence?
For example, when reading a variable, it is not clear the contents. The variable contains the value of the received or was triggered "timeout" and there is no information about this. How it is possible to learn?
This applies to all operators/functions input.
It is not possible to determine the "error" receiving data. I thought that the effects of operation "timeout" is seen in the variable "Err".
2. Why is there no possibility of "timeout" on the operator INPUTBIN? It is not enough. It turns dead function as is unknown, the code of the program hangs (infinity).
3. Why not use buffer (SERIALIN) to operators: INPUT, WAITKEY, INPUTBIN and others? It would be very convenient.
(BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Nov 26, 2015 4:39 pm Post subject: |
|
|
1- because it is not designed that way. you can always ask for a change.
2-inputbin like all other serial input DOES honor the timeout but with the restriction that when you inputbin for say 10 bytes, each byte will time out. I guess what you want is that inputbin exits right away after the first occurrence of a time out
3-i do not know why you think that? all mentioned functions work with buffered serial input. otherwise post some example. _________________ Mark |
|
Back to top |
|
|
Madf
Joined: 13 Nov 2011 Posts: 179 Location: Moscow
|
Posted: Thu Nov 26, 2015 5:11 pm Post subject: |
|
|
1. Request changes Where can I ask for?
2. Yes, I thought the timeout will be triggered immediately. The timeout is reset each time data is received. If the data is not accepted, the timeout counts the time and aborts the command INPUTBIN. In the form that is now in the timeout - it is impossible to use. Especially if want to receive a large amount of data (for 1024 bytes).
3. An experiment, I tried to use a buffer "INPUT" and read the data using the command "BufSpace". Then loaded the multiple data packets "INPUT". "BufSpace" always had a value equal to the "length of Assigning buffer - 1".
Maybe I did something wrong. If commands: INPUT, WAITKEY, INPUTBIN can work with a buffer - it is a good news to me.
Now, the whole program is built on the "INPUT", but I needed a "INPUTBIN". I had to simulate it using "INKEY" + timeout count manually. The code has become much more complex and more confusion. |
|
Back to top |
|
|
toto
|
Posted: Tue Dec 08, 2015 4:43 pm Post subject: |
|
|
Hello,
I think to, that Mark could add a TIMEOUT to INPUTBIN that can be set by the programmer
I've had problems in the past in noisy environments, where it was stuck in Inputbin and then for security reasons reset by the
Watchdog.
As my program commands a motor, it will stop abruptly caused by the Watchdog Reset
Please Mark, think how you could add this. Much improved communication in noisy environments
We were all waiting ...
Thanks a lot
Best regards
toto |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|