Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

serial port communication and analog input
Goto page Previous  1, 2
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO
View previous topic :: View next topic  
Author Message
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 587

poland.gif
PostPosted: Sun May 07, 2017 12:01 pm    Post subject: Reply with quote

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 Very Happy
Code:
$framesize = 64
Back to top
View user's profile Visit poster's website
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 827
Location: France

france.gif
PostPosted: Sun May 07, 2017 2:38 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
Walt

Bascom Member



Joined: 13 Aug 2009
Posts: 14

blank.gif
PostPosted: Sun May 07, 2017 8:55 pm    Post subject: serial port communication and analog input Reply with quote

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
View user's profile
Walt

Bascom Member



Joined: 13 Aug 2009
Posts: 14

blank.gif
PostPosted: Sun May 07, 2017 9:14 pm    Post subject: serial port communication and analog input Reply with quote

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
Its 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
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 587

poland.gif
PostPosted: Sun May 07, 2017 9:23 pm    Post subject: Reply with quote

Good to know it work now.

For wireless ESP8266 WiFi or Bluetooth HC-05, BLE HM-10, HM-11(100m) work good for me Wink
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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