Support Forums
Serial comms on host port

Hi Roger,

I asked your help in logging weather data for a wind turbine back in May. Now I would like to add serial functionality to send this data to a microcontroller and receive the value of the turbines speed in return.

The returned value should be also be displayed as "main shaft speed" on the LCD screen I have tried to use the following code to achieve this but as yet no luck. I can't even get any information from a terminal program (I use CoolTerm).

Is there something I am doing wrong here?

BEGIN "SVAWT" 
PROFILE "HOST_PORT" "FUNCTION"="SERIAL" 
'set rs232 port to send and receive serial data 
RA"weather"("B:",DATA:OV:7D)1s 
'Schedule scans weather station every second, saves up to 7 days of data 
S1=0,352,0,9500"Degrees" 'Define span for wind direction 
1R(S1,"Wind Direction",=4CV) 'Read pot and convert to degrees 
1HSC(LT,R,RS,W,=1CV) 'Sample cup anemometer 
3CV("Wind Speed~m/s")=0.75*1CV+0.2 'Convert freq to m/s as per weather station datasheet 
5CV("Main shaft speed~RPM")=0 
2SERIAL("\e{%f[3CV], %f[4CV]}%f[5CV]",W)
5CV 
LOGON 
END
Hi Roger, I asked your help in logging weather data for a wind turbine back in May. Now I would like to add serial functionality to send this data to a microcontroller and receive the value of the turbines speed in return. The returned value should be also be displayed as "main shaft speed" on the LCD screen I have tried to use the following code to achieve this but as yet no luck. I can't even get any information from a terminal program (I use CoolTerm). Is there something I am doing wrong here? ```` BEGIN "SVAWT" PROFILE "HOST_PORT" "FUNCTION"="SERIAL" 'set rs232 port to send and receive serial data RA"weather"("B:",DATA:OV:7D)1s 'Schedule scans weather station every second, saves up to 7 days of data S1=0,352,0,9500"Degrees" 'Define span for wind direction 1R(S1,"Wind Direction",=4CV) 'Read pot and convert to degrees 1HSC(LT,R,RS,W,=1CV) 'Sample cup anemometer 3CV("Wind Speed~m/s")=0.75*1CV+0.2 'Convert freq to m/s as per weather station datasheet 5CV("Main shaft speed~RPM")=0 2SERIAL("\e{%f[3CV], %f[4CV]}%f[5CV]",W) 5CV LOGON END ````

Good morning scottmechx,

Before you can start writing a program you must be able to establish communication. You will need to know:

  • communications type e.g RS232, RS422, RS485
  • baud rate & parity
  • number of data bits & stop bits
  • flow control.

Once you have this you can the connect to the device and start reading data. The next you need to establish what messages to send and receive. Some devices need to be "Polled" for data. When polling you will need to send a command of some kind then the device will return data.

Other device will simply send out data at a set rate in which case the DT80 need to listen for the incoming data. When the data comes back you also need to know the data structure:

  • Is the data binary or ASCII?
  • How is the data items separated? (e.g. CSV? Space, Tab etc?)
  • Is there a header you can lock on to as the start of the string?
  • How it the data terminated? (Cr? CrLf? Other?)

Once we know this we can then work out what commands we need to send or uses to read the data in. So to start the process what ate the communications parameters we need to set?

Does the device need to be polled for data. If it does then we need to know the command structure. Do we know the data the format of the data we need to read?

Cheers,
Roger

Good morning scottmechx, Before you can start writing a program you must be able to establish communication. You will need to know: - communications type e.g RS232, RS422, RS485 - baud rate & parity - number of data bits & stop bits - flow control. Once you have this you can the connect to the device and start reading data. The next you need to establish what messages to send and receive. Some devices need to be "Polled" for data. When polling you will need to send a command of some kind then the device will return data. Other device will simply send out data at a set rate in which case the DT80 need to listen for the incoming data. When the data comes back you also need to know the data structure: - Is the data binary or ASCII? - How is the data items separated? (e.g. CSV? Space, Tab etc?) - Is there a header you can lock on to as the start of the string? - How it the data terminated? (Cr? CrLf? Other?) Once we know this we can then work out what commands we need to send or uses to read the data in. So to start the process what ate the communications parameters we need to set? Does the device need to be polled for data. If it does then we need to know the command structure. Do we know the data the format of the data we need to read? Cheers, Roger
59
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft