.. index:: f0-disco-lmt01-gema .. _f0-disco-lmt01-gema: F0 Disco Lmt01 Gema =================== The creation of a new Forth Development system requires testing to uncover bugs, so once SVD2FORTH-V6 reached a useful stage f0-disco-lmt01-gema was created. The Test -------- One can't test a Forth development system on an embedded MCU by creating a software program alone. Embedded Forth testing requires that MCU peripherals be used, and to that end this test uses a LMT-01 thermometer chip, the TIM2 timer and Comparators 1 and 2 on a SMT32F051 MCU :ref:`F0 DISCOVERY BOARD`. Reading The Temperature ----------------------- The schematic below shows the STM32F0 Discovery board connections used, and a 'equivalent functions' diagram of the MCU peripherals. PC1 supplies power to the LMT-01 sensor when a temperature reading is needed, this takes a maximum of 100mS. PA1 feeds the voltage developed by the current pulses to comparators one and two. Comparator-2 drives a Indicator LED so the user can see that the sensor is indeed sending data. Comparator-1 sends the same data to TIM2 which counts them. The comparators compare the voltage from R2 against a MCU internal voltage reference of 0.6095 volts which represents a logic High. Hysteresis is configured for 'medium'. The software then produces a temperature printout in degrees C and F to one decimal place based on the total pulse count. Finer detail should be easily obtained by reading the source, if it's not, please let me know. .. image:: pics/f0-disco-lmt01-gema.jpg Svd2forth-v6 ------------ This project consists of six source files which are concatenated, run thru the preprocessor (to generate the includes.fs file), stripped of comments and blank lines then uploaded to the on-chip Forth. .. image:: projects/blink-f0disco-gdbtui/pics/blink-f0disco-gdbtui-ide-sml.jpg Files are uploaded in sequence, lowest number first . == ======================= ===================================================================================================== No File Description == ======================= ===================================================================================================== 1 sys.fs My general system files, 48MHz clock, 1mS delay, hardware exception tracer 2 includes.fs Auto generated source dependencies 3 gpio.fs Configure the GPIO's 4 comparator.fs Set up the comparator so it receives the LMT-01 pulses 5 pulse.fs Configure TIM2 to count the comparator pulses 6 f0-disco-lmt01-gema.fs Tie all the above files together == ======================= ===================================================================================================== A Word about Bitfields ---------------------- This is a :ref:`important part of svd2forth-v6` so I have made a separate page for it. Please read it before proceeding if you haven't already. Now including a preview screenshot of my prototype Bitfield Viewer and select tool. The Source Code --------------- .. literalinclude:: projects/f0-disco-lmt01-gema/f0-disco-lmt01-gema.project.fs Program Output -------------- :: t 15,3 C 59,6 F ok. t 15,4 C 59,7 F ok. t 15,4 C 59,7 F ok.