Open Sint  3.4-2
Functions
lacrosse.c File Reference

larosse tx20 interface. More...

#include <inttypes.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lacrosse.h"
Include dependency graph for lacrosse.c:

Functions

uint8_t header_ok (void)
 check if header is 00100 More...
 
uint8_t lacrosse_checksum (void)
 
 ISR (INT0_vect)
 
void lacrosse_stop (void)
 stop the lacrosse reading.
 
void lacrosse_start (void)
 
void lacrosse_init (void)
 
void lacrosse_shutdown (void)
 shutdown lacrosse operations. More...
 
uint8_t lacrosse_is_connected (void)
 check if the lacrosse is connected. More...
 
uint8_t lacrosse_adjust (void)
 correct the lacrosse readings. More...
 

Detailed Description

larosse tx20 interface.

Function Documentation

◆ header_ok()

uint8_t header_ok ( void  )

check if header is 00100

The serial protocol is as follows- a.. Approx 1.2mS bit time >> 833 bps b.. inverted data - 0V = logic 1, +3.3V = logic 0 c.. one long (20 bit) stream with start frame and end checksum d.. issued every 2 seconds while /CE is true (held at 0V) e.. 00100bbbbvvvvvvvvvvvvcccc f.. 00100 start frame g.. hhhh bearing, lsb first, 0-15 cardinal points from North, clockwise rotation, 0=N, 1=NNE, etc h.. vvvvvvvvvvvv velocity, lsb first, 0-4096, turbine counts over previous 2 second period, non accumulating i.. velocity count appears somewhat nonlinear- the turbine is quite sensitive to small gusts below 5 knots that would not move a conventional cup anemometer, but less so at higher speeds j.. knots = velocity/8 seems to be a reasonable approximation across typical wind speed ranges k.. cccc checksum, appers to be simple XOR of the 4 bbbb, vvvv,vvvv,vvvv nibbles

◆ ISR()

ISR ( INT0_vect  )

The interrupt function to get the lacrosse string.

Bug:
if the message is non-valid and there is no more reading left to be used, then the message is considered valid anyway.
Note
Maybe neccessary ~500us delay to read bits not near up/down front.

◆ lacrosse_adjust()

uint8_t lacrosse_adjust ( void  )

correct the lacrosse readings.

Bug:
return WHAT?!?

◆ lacrosse_checksum()

uint8_t lacrosse_checksum ( void  )

Check the checksum of the message.

Returns
true or false.

◆ lacrosse_is_connected()

uint8_t lacrosse_is_connected ( void  )

check if the lacrosse is connected.

This function should be used to try to autosetup which anemometer is present.

Todo:
Remove this functions, when happens the lacrosse isn't detected correctly at the startup, the sint remains without anemometer until someone reset it. never use this routine with interrupt enable.
Bug:
_delay_ms not working properly, this function should be wait 15 sec, if wind->flag is present then a lacrosse is connected.

◆ lacrosse_shutdown()

void lacrosse_shutdown ( void  )

shutdown lacrosse operations.

Note
the default EICRA settings no need to change.