Software developpement » History » Version 6

« Previous - Version 6/10 (diff) - Next » - Current version
BASTIDE, Paul, 03/23/2016 11:02 AM


Software developpement

The software we are proposing is a variation of the software proposed in the [[Sputnik strikes back:| Sputnik strikes back]] project, software desgin.
As them, we are going to retriev on a sensor data, tranform it in a more appropriate format so as to send it by the RF transmitter.

General principle

We are developping for an RTOS, a real time operating system. As presented in the generalities //LINK HERE, this kind of software runs on a task driven event basis. That is to say we are creating tasks inside infinite loop (so that they keep running) and a scheduler will be operating the shift between the tasks.

In order for the tasks to release or take the processing power they need, the system rune a priority basis : tasks with higher priority, when they need to process, interrupts tsks with lower priorities ta take control. These high priorities tasks need to release the control in order for the lower priority tasks to be able to run. This is done by what we call a "context switch" functionality present in the scheduler, and notably in the "OS_Delay()" function that enables the tasks to wait and release the prcessing power to another task.

In order to set the timing between the tasks, we will implementflags, which will serve to determine when some functionalities will be accessed in the tasks. These flags have to be set by other tasks to manage the workflow between tasks.

Software definition

Tasks definition

We are going to define the following tasks and function :

  • task_sensor_phys(): this task is the main one, is used to send to the RF transmitter the bits.
  • sensor_get_update() : task used to retrieve from the ADC the voltage value and fill the buffer with the temperature
  • init_ADC(): used in sensor_update to initialize the ADC registers
  • bin_vomt(): used to convert the results from the ADC to a temperature
  • celcius_coding() : used to convert the temperarture over a 7-bits word.

We created the following buffer to conserve the data

  • bitCharBuf : contains the 7-bits word we are planning to send

We are using the following flags :

  • rts_flag : Ready To Send flag, allow the main task to know when data is ready to be sent.
  • cod_flag : Flag used to tell the update function that all the data has been sent and it can now retrieve the data

Sequence of events

We are retrieving data from the thermocouple thanks to the sensor_get_update(). As the sensor is intern, we can set our own frequency in the retrieving of the data. We are supposing that the dynamic of the temperature we want to measure is slow, that's why we are going to scan on wire at a time and not simultaneoulsy.

Once the two analog inputs have been scanned, we are using bin_voltage() function to convert the ADC output value to a voltage, and then map the voltage difference to a negative or positive temperature thanks to known tables associatde to the thermocouple.

Finally, when the temperature value has been identified, we are translating it to a 7-bit word by using the celcius_coding() function.
When the word is ready, we are setting the rts_flag so that the main tasks knows data is ready to be sent.

once the main function "sees" that the rts