This is test program of mcp3204. This is operating normally.
Dependencies: mbed MCP320x TextLCD
Nucleo_mcp3204test.cpp
- Committer:
- SK_ROBO_
- Date:
- 2016-01-29
- Revision:
- 1:50f0c5749724
- Parent:
- 0:55aac36c4f0f
File content as of revision 1:50f0c5749724:
#include "mbed.h" #include "TextLCD.h" #include "MCP320x.h" #define MOSI D11 #define MISO D12 #define CLK D13 #define CS D10 #define CHIPFAMILLY CMCP320x_SPI::_3204 #define FREQ 100000 TextLCD lcd(PB_0, PB_1, PA_12, PF_0, PF_1, PA_8, TextLCD::LCD20x2); // rs, e, d4-d7 CMCP320x_SPI mcp3204(MOSI, MISO, CLK, CS, CHIPFAMILLY, FREQ); int main() { // notify the user that we are starting with the ADC communication printf("Starting ADC interaction\n"); // lets just do this forever while (1) { //lcd.cls(); lcd.printf("CH0:%3.2f[deg]\n", mcp3204.Read(CMCP320x_SPI::CH0)/*/ 4095.0f*270.0f */); lcd.printf("CH1:%3.2f[deg]\n", mcp3204.Read(CMCP320x_SPI::CH1)/*/ 4095.0f*270.0f */); // delay some time before reading again wait(0.5); lcd.printf("CH2:%3.2f[deg]\n", mcp3204.Read(CMCP320x_SPI::CH2)/*/ 4095.0f*270.0f */); lcd.printf("CH3:%3.2f[deg]\n", mcp3204.Read(CMCP320x_SPI::CH3)/*/ 4095.0f*270.0f */); // delay some time before reading again wait(0.5); } }