Skip to main content

Posts

Programing on Launchpad MSP432 Interrupt button Prerequisite: Hardware: Launchpad MSP432P401 IDE software: IAR/CCS/KEIL Tool: Simplelink SDK MSP432 v3.20.00.06 Description: Simple program using two buttons connected to P1.0  and P1.4 to turn on or turn off LED on P1.0 Step1. Open example of Simplelink SDK without RTOS Step2. modify the code as below Step3. Compile and debug the program /* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> volatile uint32_t SW1, SW2; //semaphores void VectorButtons_Init(void){   __disable_interrupt;   //DisableInterrupts();          // set the I bit during initialization   SW1 = 0; SW2 = 0;             // clear semaphores   P1->SEL0 &= ~0x12;   P1->SEL1 &= ~0x12;      P1->D...

AFE4300 with Arduino Due

In this post, I make an experiment to use Arduino Due to control AFE4300 for measuring in BCM mode. The code based on a guy in this link from Arduino Forum https://forum.arduino.cc/index.php?topic=319141.0 However, this not work now because the SPI library now have changed to new style and really different if you want control Clock of SPI with the command SPI.setClockDevider(). Actually, if you use this function to control SPI, the clock of SCLK keep around 4Mhz and it gives incorrect data when you communicate with AFE4300. For solving it, you need to rewrite two functions writeRegister() and readRegister() as below: void writeRegister(unsigned char address, unsigned int data) { unsigned char firstByte = (unsigned char)(data >> 8); //LA CARA ES UN OCHO) unsigned char secondByte = (unsigned char)data; SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1)); digitalWrite(SS,LOW); SPI.transfer(address); //Send 2 bytes to be written SPI.transfer(firstBy...
Some stuff are useful for C# programming Dial, KNob, Button and LED indicator https://www.codeproject.com/Articles/36116/Industrial-Controls-2 Gauge https://www.codeproject.com/Articles/448721/AGauge-WinForms-Gauge-Control http://www.codearteng.com/2012/08/agauge-winforms-gauge-control.html Scott Plot https://github.com/swharden/ScottPlot#cookbook DSP toolbox http://www.codearteng.com/2012/08/agauge-winforms-gauge-control.html

Arduino Code for test Heart Rate 7 Click

Heart Rate 7 Click is the newest module from MikroE which uses VEM8080 photodetector has a wide range spectrum from 300nm - 1000nm. To control and acquisition data, AFE4404 from TI inc. is adopted. This chip permits control 3 LED channels, and sample heart rate default 100 SPS.  A 22-bit ADC permit collecting very small changed voltage from a PD sensor. In this example we config Arduino Mega  2650 as below: Pin 4 for RST PIN 5 CLK PIN 6 INT PIN 20 SDA PIN 21 SCL Config registers follow the default of AFE4404 datasheet Page 27 with some minor changes. 1. Config Internal Clock through  AFE_CONTROL2 register addr.: 0x23 value: 0x104218  // setup all dynamic power to save energy 2. Control LED2 current through AFE_LEDCNTRL register addr: 0x22 value: 0x000100 3. Read data using PROG_TG_EN signal through AFE_TIA_GAIN register addr: 0x21 value: 0x000125 Time to start and end of PROG_TG setup through two registers: AFE_PROG_TG_STC register (...

Test the hello-world.c on Contiki-ng system for CC2650 launchpad

This is my testing for my experiment to use contiki-ng for my cc2650 board on Windows 10. Because Contiki needs an environment like Linux, here we use Docker + Virtualbox to make build and compile more convenient.  Below are there steps to make it. Step 1 . Install Docker Toolbox Notice 1. Using Virtual box 5.2.30 to assure that the Docker Work Notice 2. After install need to restart the windows 10 Notice 3. Config virtual box host-only network Step2 . Pull Contiki-Ng from website Here I put my Contiki-ng in c:/user/myname/Contiki-ng After Docker can setup the connection you need to login to user state of contiki-ng with command docker run --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 --mount type=bind,source=/c/Users/myname/contiki-ng,destination=/home/user/contiki-ng -e DISPLAY=host.docker.internal:0.0 -ti contiker/contiki-ng Step 3 .   Test an hello-world project in examples folder #include "contiki.h" #include "dev/cc26xx...

Test BME280 on Sensor Booster Pack

From the datasheet and  it's Guide Manual  http://www.ti.com/lit/ug/slau666b/slau666b.pdf BME280 has a slave address: 0x77; To control it we need to config several register as below: Control Humidity Register (ADDR: 0xF2) Default 0x00 not activate Control Measure Register (ADDR: 0xF4) Default 0x00 not activate            b[7:5]: control temperature measurement            b[4:2]: control pressure measurement            b[1-0]: Control IC mode                          00: sleep mode                          01,10: force mode                          11: normal mode Control filter Register (ADDR: 0xF5) Default 0x00            b[7:5]: control standby time ...
Analog-Digital Converter(ADC) with Low gain and High-resolution The reason to use high-resolution (24 bits) ADC is to simplify the hardware, reduce energy consumption (Sigma Delta Structured will be employed). For low-resolution (16bits) ADC, it requires a more complicated system for filtering, high-gain amplifies and apply high-speed anti-aliasing sampling