Аппаратный сбой, что нужно поправить? Куда смотреть?
- Войдите на сайт для отправки комментариев
Втр, 11/11/2014 - 23:38
Взял два фрагмента "из учебника" и собрал на макетке.
Atmega168-20PU и кварц на 20Мгц + пара конденсаторов
Питание - покупной блочок в макетку, reset подтянут к плюсу через резистор.
Через некоторое время на экране LCD лезет "каша".
Что не так у меня, куда хотя бы бежать?
https://www.youtube.com/watch?v=ZG3UOIZCcn0&list=UUmn6vennk6eQ1b5ZhfkadWw&index=1
Вот так оно выглядит.
Программа не бог весть какая сложная:
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 10
/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Set the LCD address
// Pass our oneWire reference to Dallas Temperature.
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Temp;
// degree c sybmol
byte degc[8] =
{
B01000,
B10100,
B01000,
B00011,
B00100,
B00100,
B00011,
B00000,
};
/*-----( Declare Variables )-----*/
//NONE
void setup() /*----( SETUP: RUNS ONCE )----*/
{
lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines, turn on backlight
//-------- Write characters on the display ------------------
// NOTE: Cursor Position: (CHAR, LINE) start at 0
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("MyMachine");
delay(1000);
lcd.setCursor(0,1);
lcd.print("Temp IC Control");
delay(4000);
// Start up the library
sensors.begin();
// IC Default 9 bit. If you have troubles consider upping it 12.
// Ups the delay giving the IC more time to process the temperature measurement
lcd.createChar(0,degc);
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
sensors.requestTemperatures(); // Send the command to get temperatures
delay(200);
lcd.clear();
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("Temp for Dev1:");
lcd.setCursor(2,1);
Temp = sensors.getTempCByIndex(0);
lcd.print(Temp);
lcd.setCursor(8,1);
lcd.write((uint8_t)0);
lcd.write(" ");
}/* --(end main loop )-- */
/* ( THE END ) */
Ищи сопли на плате. У меня каша лезла, когда пины на макетке шатал.
Что я забыл включить?