View previous topic :: View next topic |
Author |
Message |
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Sun May 07, 2017 12:01 pm Post subject: |
|
|
I prefer to store result from the Format function into the some variable first and then print it. Mabe this is the case. Try mod code for that.
Code: | Adc_read = Getadc(0)
If Previous_adc <> Adc_read Then
Previous_adc = Adc_read
Helpw = Adc_read * 49
Helpw = Helpw / 10
Helpstr = Str(helpw)
Helpstr = Format(helpstr , "0.000")
Print "Uvor " ; Helpstr
End If |
..and maybe next improvement can be done by printing in small chunk of data (one byte) via config Serialout
Code: | '*****************************************************************
'* USART BUFFER FOR REMOTE COMMANDS *
'*****************************************************************
Config Serialin = Buffered , Size = 20
Dim Char As Byte , Cmd_timeout As Byte , Got_str As Byte
Dim Command As String * 20
Dim Helpstr As String * 15
Config Serialout = Buffered , Size = 30 '<- ADD THIS LINE <-
'***************************************************************** |
EDIT: I forget about increasing $framesize = 32 (at the top of program code). It is used when you print something and working on strings.
Because Mega328P have 2000 bytes SRAM you can increase $framesize to 64 or higher without any fear
|
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Sun May 07, 2017 2:38 pm Post subject: |
|
|
It is just a idea.
some years ago, sorry I didn't fund the file, because I have to do something similar, i used 2 µP a big one for the main job an another for the analog measurement : a Tyny 45
In this case you can use one to control the motor(s) and another one for the main and the analog input.
JP .....now it is time to go to the votation ! |
|
Back to top |
|
|
Walt
Joined: 13 Aug 2009 Posts: 14
|
Posted: Sun May 07, 2017 8:55 pm Post subject: serial port communication and analog input |
|
|
EDC
The problem is not the program. All is working fine.
The link between the PC and the Ardunio is wireless. The communication is simplex.
That the reason why print command of the ADC input was not transmitted to the PC.
If I connect the serial ports with a cable together the communication of all the signals is ok.
So I have to find a way to solve the problem with the wireless transmission.
Walter |
|
Back to top |
|
|
Walt
Joined: 13 Aug 2009 Posts: 14
|
Posted: Sun May 07, 2017 9:14 pm Post subject: serial port communication and analog input |
|
|
EDC
Thank you very much for your help.
All is working fine.
The link between the PC and the Ardunio is wireless. The communication is simplex.
In this constellation the new settings of the motor will not be transmitted form the PC to the Ardunio
It’s an overlap the in the simplex transmission of the wireless module.
If I connect the serial ports with a cable together the communication of all the signals is ok.
So I have to find a way to solve the problem with the wireless transmission.
Walter |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Sun May 07, 2017 9:23 pm Post subject: |
|
|
Good to know it work now.
For wireless ESP8266 WiFi or Bluetooth HC-05, BLE HM-10, HM-11(100m) work good for me |
|
Back to top |
|
|
|