Interface between Kinetis K20D50M and a sensor

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interface between Kinetis K20D50M and a sensor

448 Views
sosopavliashvil
Contributor I

Hi all,

I am really new to microcontrollers. I am trying to interface K20D50M with a capacitance sensor. I was wandering if there are any demo projects that I can use.

Here is the serial data format of the capacitance sensor:

The ASCII output from TXD pin of J4 contains three fields: sequence number, measurement time (in seconds), and measured capacitance. The line format is as below.

SSSSS TTTTT.tt CCCCU

where ‘SSSSS’is 5 digit sequence number, ‘TTTTT.tt’is 8 digit time stamp (in second), and CCCCU is 5 digit measured capacitance with U being unit digit. Different fields are separated by 1 space. Each line is ended with ‘LF’(0x0A) and ‘CR’(0x0D). Output baud rate is 38400bps fixed. Data format is 8 data bits, 1 stop bit, and no parity.

Output level is 5V. So a level converter is needed to connect to RS232 compatible device (PC serial port, for example).


Could you please send me If you have any demo projects that would be helpful

Thank you and have a great day


0 Kudos
1 Reply

375 Views
perlam_i_au
Senior Contributor I

In this case I suggest you to download the Kinetis 50MHz bare metal sample code, here you will find an example project for serial communication (available for 19200 and 115200 baudrate), please take a look on the path:

C:\(your download path)\kinetis_50MHz_sc\k20d50m_sc_baremetal\build\iar

The serial_test_xxxxx codes have been developed for IAR but you could use them as reference if you are using another tool.


Have a nic day :P,
Perla

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos