Mega2560+ADF4351+3.2 TFT ошибка заливки скетча
- Войдите на сайт для отправки комментариев
Ср, 16/10/2019 - 13:41
Доброго всем времени суток, собираю на Mega2560+ADF4351+3.2 TFT генератор, не могу залить скетч. Выскакивает вот такая ошибка:
Arduino: 1.8.5 (Windows 10), Плата:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)" libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::_convert_float(char*, double, int, unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here c:/users/dima/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::_hw_special_init()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::LCD_Writ_Bus(char, char, unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::LCD_Write_Bus_8(char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::_set_direction_registers(unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::_fast_fill_16(int, int, long)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::_fast_fill_8(int, long)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::UTFT()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::UTFT()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::UTFT(unsigned char, int, int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::UTFT(unsigned char, int, int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::LCD_Write_COM(char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::LCD_Write_DATA(char, char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::LCD_Write_DATA(char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::LCD_Write_COM_DATA(char, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::LCD_Write_DATA_8(char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setXY(unsigned int, unsigned int, unsigned int, unsigned int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::InitLCD(unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::clrXY()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawCircle(int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::clrScr()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::fillScr(unsigned int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::fillScr(unsigned char, unsigned char, unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setColor(unsigned char, unsigned char, unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setColor(unsigned int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::getColor()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setBackColor(unsigned char, unsigned char, unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setBackColor(unsigned long)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::getBackColor()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setPixel(unsigned int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawPixel(int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawHLine(int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::fillRoundRect(int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::fillCircle(int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawVLine(int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawRect(int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawRoundRect(int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::fillRect(int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawLine(int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::printChar(unsigned char, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::rotateChar(unsigned char, int, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::print(char*, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::print(String, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::printNumI(long, int, int, int, char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::printNumF(double, unsigned char, int, int, char, int, char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setFont(unsigned char*)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::getFont()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::getFontXsize()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::getFontYsize()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawBitmap(int, int, int, int, unsigned int*, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::drawBitmap(int, int, int, int, unsigned int*, int, int, int)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::lcdOff()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::lcdOn()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setContrast(char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::getDisplayXSize()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::getDisplayYSize()' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setBrightness(unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setDisplayPage(unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\UTFT\UTFT.cpp.o (symbol from plugin): In function `UTFT::_convert_float(char*, double, int, unsigned char)': (.text+0x0): multiple definition of `UTFT::setWritePage(unsigned char)' sketch\sketch_oct16a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here collect2.exe: error: ld returned 1 exit status exit status 1 Ошибка компиляции для платы Arduino/Genuino Mega or Mega 2560. Этот отчёт будет иметь больше информации с включенной опцией Файл -> Настройки -> "Показать подробный вывод во время компиляции"
библиотеки менял(UTFT)
код брал с вот этого сайта https://www.silicium628.fr/article_i.php?id=92#17
вот архив с файлами(тоже самое в принцепи) http://f4fdw.free.fr/gene_wobul/Firmware_C.tar.gz
версии ардуино пробовал разные , кто может проверить код , может у меня что с ноутои и библиотеками
#include <uart2560_628.h>
#include <memorysaver.h>
#include <UTFT.h>
/*
Firmware pour carte générateur de signaux ADF4351
et carte Uno Mega2560 + afficheur 480x320 non tactile.
par Silicium628.
Ce fichier source "GeneUHF_ADF4351.cpp" est libre, vous pouvez le redistribuer et/ou le modifier selon
les termes de la Licence Publique Générale GNU.
En ce qui concerne certaines bibliothèques incluses, issues du domaine "Arduino" (en particulier UTFT), il faut voir au cas par cas.
*/
/**
REMARQUES :
-les ports utilisés doivent être définis dans les fichiers "AD9850.h" et "AD9951.h"
-il faut copier le dossier "UTFT" dans le dossier des librairies /usr/share/arduino/libraries ET définir les permissions qui vont bien
**/
//================================
#define version "v4.0"
//================================
#include "GeneUHF_ADF4351.h"
#include <avr/io.h>
#include <stdint.h>
#include <stdlib.h>
#include <util/delay.h>
#include <math.h>
#include "UTFT.cpp"
#include "uart2560_628.c"
#include "ADF4351-628v2.h";
#define portPIN_switch PINH
#define pin_switch1 0b00000001
#define pin_switch2 0b00000010
// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
/****************************************************************************************************************************************************
//choisir le bon driver suivant, en fonction du type d'afficheur (tous deux des 480x320 qui se ressemblent, achetés au même fournisseur) ******
//la library correcte doit être installée dans le bon dossier ARDUINO, avec les permissions d'accès correctes !
UTFT TFT480(CTE32HR,38,39,40,41);
UTFT TFT480(HX8357C,38,39,40,41);
****************************************************************************************************************************************************/
UTFT TFT480(CTE32HR, 38, 39, 40, 41);
ADF4351 CarteADF4351;
AffiNombre pannel_1;
AffiNombre pannel_2;
AffiNombre pannel_3;
AffiNombre pannel_4;
AffiNombre pannel_5;
AffiNombre pannel_6;
AffiNombre pannel_7;
AffiNombre pannel_8;
AffiNombre pannel_9;
AffiNombre pannel_R0;
AffiNombre pannel_R1;
AffiNombre pannel_R2;
AffiNombre pannel_R3;
AffiNombre pannel_R4;
AffiNombre pannel_R5;
LED LED1;
LED LED2;
uint8_t mode = 0;
uint16_t x0, y0;
uint16_t x_7seg, y_7seg;
uint32_t frequence , memo_frequence; // fréquence du signal de sortie ; en multiples de 10 kHz ; ex: 240000 représente 2400.00MHz
uint32_t frq_min;
uint32_t frq_max;
uint32_t delta_F;
uint32_t lambda; // longueur d'onde en mm
uint8_t pos; // position du multiplicateur
uint8_t pos_curseur; // position du curseur (pour affichage)
uint8_t switches, memo_switches; // 8 bits permettant de mémoriser l'état de 8 inverseurs
uint32_t pas;
uint8_t etat;
uint16_t compteur1;
uint8_t envoyer_data;
float position;
String txt_hexa[33];
/**
RAPPEL variables avr-gcc (vérifiable avec le .map)
char 1 -128 .. 127 ou caractères
unsigned char 1 0 .. 255
uint8_t 1 (c'est la même chose que l'affreux 'unsigned char')
char toto[n] n
int 2 -32768 .. 32767
int16_t 2 idem 'int'
short int 2 pareil que int (?)
unsigned int 2 0 .. 65535
uint16_t 2 idem 'unsigned int'
long int 4 octets -2 147 483 648 à 2 147 483 647
int32_t 4 octets -> 32 bits ; idem long int
long long int 8 octets -> 64 bits
unsigned long int 4 octets -> 32 bits ; 0 .. 4 294 967 295 (4,2 x 10^9)
uint32_t 4 32 bits ; idem 'unsigned long int'
float 4
double ATTENTION ! 4 octets (oui, 32 bits ! et pas 64 bits (8 octets) comme en C standard)
La déclaration char JOUR[7][9];
réserve l'espace en mémoire pour 7 mots contenant 9 caractères (dont 8 caractères significatifs).
**/
void init_ports (void) // ports perso
{
// 0 = entree, 1=sortie ; les 1 sur les pins en entrees activent les R de Pull Up (tirage à VCC)
DDRD = 0b11110000;
PORTD = 0b00001111;
DDRF = 0b11101111;
PORTF = 0b00000000;
DDRH = 0b11111100;
PORTH = 0b00000011;
// DDRJ = 0b11111110; // PJ0 = RXD3 - PJ1 = TXD3 (attention c'est PJ1 qui est au bord du connecteur sur la carte Arduino mega2560)
// PORTJ = 0b00000001;
// REMARQUE : les ports utilisés doivent être définis dans les fichiers "AD4351.h" et "AD4351.h"
}
void int_EXT_setup()
{
// voir 15. External Interrupts (ATmega2560.pdf p:109)
EICRA |= 0b00001010; // bits[1,0] = 10 -> int0 sur front descendant; bits[3,2] = 10 -> int1 sur front descendant; - p:110
EIMSK |= 0b00000011; // bit[0]=1 -> INT0 enable ; bit[1]=1 -> INT1 enable - parag 15.2.3 EIMSK - p:111
}
void init_variables(void)
{
envoyer_data = 0;
frequence = 4000; // 40.00 MHz
frq_min = 3200; // 32.00 MHz - toutefois la PLL décroche au dessous de 32.4MHz (voir led LOCK)
frq_max = 440000; // 4400.00 MHz = 4.4 GHz
pos_curseur = 3;
pas = 1000;
switches = 0;
memo_switches = 0;
compteur1 = 0;
uint8_t x0 = 10;
uint8_t y0 = 20;
delta_F = 100; // 1.00 MHz
}
ISR (INT0_vect)
{
//interruption sur front descendant sur l'entree Int0
// declenchee par la rotation du codeur_ROT (1) -> +/-frequence
etat = PIND & 0b00000100;
{
if (etat == 0b00000100)
{
if (frequence >= (frq_min + pas)) {
frequence -= pas;
}
}
else
{
if ( (frequence + pas) <= frq_max) {
frequence += pas;
}
if ( (frequence + pas) > frq_max) {
frequence = frq_max;
}
}
envoyer_data = 1;
}
}
ISR (INT1_vect)
{
//interruption sur front descendant sur l'entree Int1
// declenchee par la rotation du codeur_ROT (2) -> pas
uint8_t n;
etat = PIND & 0b00001000;
if (etat == 0)
{
if (pos_curseur > 1) {
pos_curseur--;
}
}
else
{
if (pos_curseur < 6) {
pos_curseur++ ;
}
}
pas = 1;
for (n = 1; n < pos_curseur; n++) {
pas *= 10;
}
envoyer_data = 1;
}
ISR(TIMER3_COMPA_vect)
{ }
void trace_ecran()
{
TFT480.setColor(10, 10, 5);
TFT480.fillRect(0, 14, 479, 309);
trace_entete();
TFT480.setBackColor(0, 0, 0);
TFT480.setColor(180, 180, 180); // couleur de l'étiquette uniquement
TFT480.setFont(BigFont);
if (mode == 0)
{
pannel_1.init(10, 20, 210, 80, "FREQUENCE");
pannel_2.init(5, 120, 130, 50, "Lambda ");
pannel_3.init(5, 180, 130, 50, "Lambda/2");
pannel_4.init(5, 240, 130, 50, "Lambda/4");
uint16_t xp1 = 145;
uint16_t yp1 = 120;
uint8_t dy1 = 60;
pannel_5.init(xp1, yp1, 75, 50, "Div");
pannel_6.init(xp1, yp1 + dy1, 75, 50, "FRAC");
pannel_7.init(xp1, yp1 + dy1 * 2, 75, 50, "MOD");
pannel_8.init(xp1 + 80, yp1, 85, 50, "INTA");
uint16_t xp2 = 385;
uint16_t yp2 = 40;
uint8_t dy2 = 40;
pannel_R0.init(xp2, yp2, 80, 35, "R0");
pannel_R1.init(xp2, yp2 + dy2, 80, 35, "R1");
pannel_R2.init(xp2, yp2 + dy2 * 2, 80, 35, "R2");
pannel_R3.init(xp2, yp2 + dy2 * 3, 80, 35, "R3");
pannel_R4.init(xp2, yp2 + dy2 * 4, 80, 35, "R4");
pannel_R5.init(xp2, yp2 + dy2 * 5, 80, 35, "R5");
}
else
{
pannel_1.init(10, 40, 210, 80, "F centrale");
pannel_9.init(10, 130, 210, 35, "delta F");
}
}
void trace_entete()
{
TFT480.setColor(64, 64, 64);
TFT480.fillRect(0, 0, 479, 13); // bandeau en haut
TFT480.setColor(30, 30, 30);
TFT480.fillRect(0, 300, 479, 319); // bandeau en bas
// TFT480.setBackColor(64, 64, 64);
TFT480.setColor(255, 255, 255);
TFT480.print("GENE 35MHz .. 4400MHz - ADF4351", CENTER, 1);
// TFT480.setBackColor(64, 64, 64);
TFT480.setColor(255, 255, 255);
TFT480.print(version, 5, 300);
TFT480.setColor(255, 255, 255);
TFT480.print("ATmega2560 - ", 100, 300);
TFT480.setColor(255, 255, 255);
TFT480.print("Silicium628", 210, 300);
}
void TFT_aff_ICI()
{
TFT480.setFont(BigFont);
TFT480.setColor(255, 255, 255);
TFT480.print("ICI", 0, 220);
}
void TFT_affiche_chiffre_7seg(uint8_t num)
{
TFT480.setFont(SevenSegNumFont);
TFT480.printNumI(num, x_7seg, y_7seg);
}
void TFT_aff_nb_form3 (uint32_t valeur, uint8_t nb_chiffres, uint8_t curseur, uint8_t R, uint8_t G, uint8_t B)
{
//affiche un nombre en representation decimale en separant les groupes de 3 chiffres
unsigned char r ;
char tbl[7];
uint8_t i;
curseur = nb_chiffres + 1 - curseur;
for (i = 1; i <= nb_chiffres; i++)
{
r = valeur % 10; // modulo (reste de la division)
valeur /= 10; // quotient
tbl[i] = r;
}
for (i = 1; i <= nb_chiffres; i++)
{
TFT480.setColor(R, G, B);
if (i == curseur)
{
TFT480.setColor(0, 250, 250);
}
TFT_affiche_chiffre_7seg(tbl[nb_chiffres + 1 - i]);
x_7seg += 30;
uint8_t m, k, u;
m = nb_chiffres - 6;
k = nb_chiffres - 3;
u = nb_chiffres;
//if (i== 3)
if (i == m)
{
TFT480.setFont(BigFont);
TFT480.setColor(100, 100, 100);
TFT480.print("M", x_7seg, y_7seg + 30);
x_7seg += 15;
}
//if (i== 6)
if (i == k)
{
TFT480.setFont(BigFont);
TFT480.setColor(100, 100, 100);
TFT480.print("k", x_7seg, y_7seg + 30);
x_7seg += 15;
}
//if (i== 9)
if (i == u)
{
TFT480.setFont(BigFont);
TFT480.setColor(100, 100, 100);
TFT480.print("Hz", x_7seg, y_7seg + 30);
}
}
}
void TFT_aff_nb_form3b (uint32_t valeur, uint8_t nb_chiffres, uint8_t curseur, uint8_t R, uint8_t G, uint8_t B)
{
//affiche un nombre en representation decimale avec separateur 'M' à gauche des 2 chiffres de droite
unsigned char r ;
char tbl[7];
uint8_t i;
curseur = nb_chiffres + 1 - curseur;
for (i = 1; i <= nb_chiffres; i++)
{
r = valeur % 10; // modulo (reste de la division)
valeur /= 10; // quotient
tbl[i] = r;
}
for (i = 1; i <= nb_chiffres; i++)
{
TFT480.setColor(R, G, B);
if (i == curseur)
{
TFT480.setColor(0, 250, 250);
}
TFT_affiche_chiffre_7seg(tbl[nb_chiffres + 1 - i]);
x_7seg += 30;
uint8_t m = nb_chiffres - 2;
if (i == m)
{
TFT480.setFont(BigFont);
TFT480.setColor(200, 200, 200);
TFT480.print("M", x_7seg, y_7seg + 30); // affichage du separateur 'M' (M comme Megahertz)
x_7seg += 15;
}
}
}
// ===================================================================================================================================================
void setup()
{
init_ports();
init_variables();
// USART_Init();
TFT480.InitLCD();
// TFT480.rotate_screen_180();
TFT480.setFont(SmallFont);
TFT480.clrScr();
int_EXT_setup();
CarteADF4351.init();
trace_ecran();
affiche_leds();
sei(); // enable interruptions
envoyer_data = 1;
}
void affiche_leds()
{
LED1.init(245, 80, 0, 255, 0, "LOCK" );
LED2.init(245, 40, 255, 0, 0, "ON" );
}
void calcul_lambda()
{
lambda = 3e7 / frequence; // en mm
}
void loop()
{
uint8_t r1;
while (1)
{
// memo_mode = mode;
// memo_switches = switches;
// mode = portPIN_switch & pin_switch1; // mode = 0 ou 1 suivant la position du switch1
// if ((portPIN_switch & pin_switch2) == 0) mode = 3; // =2
if ((portPIN_switch & pin_switch1) == pin_switch1) {
switches |= 0b00000001;
} else {
switches &= 0b11111110;
}
if ((portPIN_switch & pin_switch2) == pin_switch2) {
switches |= 0b00000010;
} else {
switches &= 0b11111101;
}
if (memo_switches != switches) { }
if ((port_PIN_ADF4351 & pin_MUXOUT) == pin_MUXOUT) {
LED1.setEtat(1);
} else {
LED1.setEtat(0);
}
LED2.setEtat(1); // pour faire joli !
if (envoyer_data > 0)
{
envoyer_data = 0;
calcul_lambda();
_delay_ms(1);
if ( (switches & 0b00000010) == 0) {
affiche_leds();
}
double F2;
F2 = frequence / 100.0; // F2 en MHz (avec 2 décimales)
CarteADF4351.setFreq(F2);
pannel_1.affiche_frequence(frequence, 0, 100, 255); // (avec de grands chiffres 7 segments)
if (mode == 0)
{
uint8_t DIV = CarteADF4351.DIV;
pannel_5.affiche_valeur(DIV, 4, " ");
uint16_t FRAC = CarteADF4351.FRAC;
pannel_6.affiche_valeur(FRAC, 4, " ");
uint32_t MOD = CarteADF4351.MOD;
pannel_7.affiche_valeur(MOD, 4, " ");
uint32_t INTA = CarteADF4351.INTA;
pannel_8.affiche_valeur(INTA, 5, " ");
_delay_ms(1);
//unite="mm";
pannel_2.affiche_valeur(lambda, 4, "mm");
pannel_3.affiche_valeur(lambda / 2, 4, "mm");
pannel_4.affiche_valeur(lambda / 4, 4, "mm");
pannel_R0.affiche_HEXA(CarteADF4351.registers[0]);
pannel_R1.affiche_HEXA(CarteADF4351.registers[1]);
pannel_R2.affiche_HEXA(CarteADF4351.registers[2]);
pannel_R3.affiche_HEXA(CarteADF4351.registers[3]);
pannel_R4.affiche_HEXA(CarteADF4351.registers[4]);
pannel_R5.affiche_HEXA(CarteADF4351.registers[5]);
}
else
{
pannel_9.affiche_valeur(delta_F, 4, "M ");
}
_delay_ms(1);
}
/**
if((portPIN_RAZ & pin_RAZ) == 0) // RAZ de la fréquence sur appui de l'encodeurs rotatif du haut (qui comprend un switch)
{
if ( (switches & 0b00000001) == 0) {frequence =0; envoyer_data += 1; }
if ((switches & 0b00000010) == 0)
{ // soft reset
switches == 0;
TFT480.clrScr();
TFT480.setColor(30, 30, 30);
TFT480.fillRect(0, 150, 479, 200); // bandeau
TFT480.setColor(255,0,0);
TFT480.print("SOFT RESET", CENTER, 160);
_delay_ms(1000);
TFT480.clrScr();
setup();
}
}
**/
_delay_ms(1);
}
}
/** ***********************************************************************************
CLASS AffiNombre
***************************************************************************************/
// Constructeur
AffiNombre::AffiNombre()
{
}
void AffiNombre::init(uint16_t x, uint16_t y, uint16_t dx, uint16_t dy, char txt_etiquette_i[10])
{
x0 = x;
y0 = y;
for (int i = 0; i < 10; i++) {
txt_etiquette[i] = txt_etiquette_i[i];
}
txt_etiquette[10] = '\0'; // zero terminal
TFT480.setColor(10, 10, 5);
TFT480.fillRect(x0, y0, x0 + dx, y0 + dy);
TFT480.setColor(100, 100, 100);
TFT480.drawRect(x0, y0, x0 + dx, y0 + dy);
TFT480.setBackColor(0, 0, 0);
TFT480.setColor(180, 180, 180); // couleur de l'étiquette
TFT480.setFont(BigFont);
TFT480.print(txt_etiquette, x0, y0); // Etiquette
}
void AffiNombre::affiche_frequence(uint32_t F_i, uint8_t R, uint8_t G, uint8_t B)
{
x_7seg = x0 + 10;
y_7seg = y0 + 20;
uint8_t p2;
p2 = pos_curseur;
TFT_aff_nb_form3b (F_i, 6, p2, R, G, B); // 6 chiffres significatifs
}
void AffiNombre::affiche_valeur(uint16_t valeur, uint8_t nb_chiffres, char txt_unite_i[3])
{
for (int i = 0; i < 2; i++) {
txt_unite[i] = txt_unite_i[i];
}
txt_unite[2] = '\0'; // zero terminal
TFT480.setColor(220, 220, 0);
TFT480.setFont(BigFont);
TFT480.printNumI(valeur, x0 + 5, y0 + 20, nb_chiffres, ' ');
TFT480.setFont(BigFont);
TFT480.print(txt_unite, x0 + 80, y0 + 20); // ex : mm, kHz, etc...
// TFT480.print("ab", x0+80,y0+20); // ex : mm, kHz, etc...
}
void AffiNombre::affiche_HEXA(uint32_t valeur)
{
// affiche un nombre en representation hexadécimale
// 16 nb_signes hexa max
uint8_t r;
uint8_t i;
char tbl[9];
char signes[17] = "0123456789ABCDEF";
for (i = 0; i < 8; i++)
{
r = valeur % 16; // modulo (reste de la division)
valeur /= 16; // quotient
tbl[7 - i] = signes[r];
};
tbl[8] = '\0';
TFT480.setColor(0, 255, 255);
TFT480.setFont(SmallFont);
TFT480.print(tbl, x0 + 10, y0 + 15);
}
/** ***********************************************************************************
CLASS LED
***************************************************************************************/
// Constructeur
LED::LED()
{
}
void LED::init(uint16_t x_i, uint16_t y_i, uint8_t R_i, uint8_t G_i, uint8_t B_i, char txt_etiquette[5])
{
x = x_i;
y = y_i;
R = R_i;
G = G_i;
B = B_i;
TFT480.setColor(40, 40, 40); // gris
TFT480.fillCircle(x, y, 10); // dessine la led éteinte (cercle plein grisé)
TFT480.setColor(180, 180, 180);
TFT480.setFont(BigFont);
TFT480.print(txt_etiquette, x + 15, y - 8); // Etiquette
}
void LED::setEtat(uint8_t etat_i)
{
if (etat_i == 0)
{
TFT480.setColor(40, 40, 40); // gris
TFT480.fillCircle(x, y, 10);
}
if (etat_i == 1)
{
TFT480.setColor(R, G, B); // couleur choisie
TFT480.fillCircle(x, y, 10);
}
}
Заранее спасибо
а аффтар кода что говорит?
Автор немец, не отвечает
39ю строку поправь на
#include <UTFT.h>
039 строка скетча зачем ??? И 040 то же ...
DetSimen
Она выше уже подгружена.
039 строка скетча зачем ??? И 040 то же ...
DetSimen
Она выше уже подгружена.
согласен, выкинуть нахрен обе. Немцы, чо, дикий нарот.
Хотя, мне кажеца, это вовсе не немец приписал. :)
#include "UTFT.cpp" эту убрал
библиотека UTFT подключена выше, всё заработало, Всем спасибо 2е суток подбирал UTFT библиотеки, и код ковырял, всё оказалось намного проще, всем спасибо ОГРОМНОЕ
040 так же лишняя скорее всего !
В тексте ошибки ЯВНО написано - множественное определение функции
Всем спасибо 2е суток подбирал UTFT библиотеки, и код ковырял, всё оказалось намного проще, всем спасибо ОГРОМНОЕ
в следующий раз внимательно читайте сообщение об ошибке - там все написано. и не придется 2е суток подбирать библиотеки