parent
7b98c2081a
commit
58996b8327
@ -1,161 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
|
|
||||||
<PropertyGroup>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectVersion>7.0</ProjectVersion>
|
|
||||||
<ToolchainName>com.Atmel.AVRGCC8.CPP</ToolchainName>
|
|
||||||
<ProjectGuid>{6a6fbffd-b460-4b8d-ac37-72193bed073f}</ProjectGuid>
|
|
||||||
<avrdevice>ATmega328PB</avrdevice>
|
|
||||||
<avrdeviceseries>none</avrdeviceseries>
|
|
||||||
<OutputType>Executable</OutputType>
|
|
||||||
<Language>CPP</Language>
|
|
||||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
|
||||||
<OutputFileExtension>.elf</OutputFileExtension>
|
|
||||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
|
||||||
<AssemblyName>1xGenTest</AssemblyName>
|
|
||||||
<Name>1xGenTest</Name>
|
|
||||||
<RootNamespace>1xGenTest</RootNamespace>
|
|
||||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
|
||||||
<KeepTimersRunning>true</KeepTimersRunning>
|
|
||||||
<OverrideVtor>false</OverrideVtor>
|
|
||||||
<CacheFlash>true</CacheFlash>
|
|
||||||
<ProgFlashFromRam>true</ProgFlashFromRam>
|
|
||||||
<RamSnippetAddress>0x20000000</RamSnippetAddress>
|
|
||||||
<UncachedRange />
|
|
||||||
<preserveEEPROM>true</preserveEEPROM>
|
|
||||||
<OverrideVtorValue>exception_table</OverrideVtorValue>
|
|
||||||
<BootSegment>2</BootSegment>
|
|
||||||
<ResetRule>0</ResetRule>
|
|
||||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
|
||||||
<EraseKey />
|
|
||||||
<AsfFrameworkConfig>
|
|
||||||
<framework-data xmlns="">
|
|
||||||
<options />
|
|
||||||
<configurations />
|
|
||||||
<files />
|
|
||||||
<documentation help="" />
|
|
||||||
<offline-documentation help="" />
|
|
||||||
<dependencies>
|
|
||||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.52.0" />
|
|
||||||
</dependencies>
|
|
||||||
</framework-data>
|
|
||||||
</AsfFrameworkConfig>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
|
||||||
<ToolchainSettings>
|
|
||||||
<AvrGccCpp>
|
|
||||||
<avrgcc.common.Device>-mmcu=atmega328pb -B "%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\gcc\dev\atmega328pb"</avrgcc.common.Device>
|
|
||||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
|
||||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
|
||||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
|
||||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
|
||||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
|
||||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
|
||||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
|
||||||
<avrgcc.compiler.symbols.DefSymbols>
|
|
||||||
<ListValues>
|
|
||||||
<Value>NDEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\include\</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
|
||||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
|
||||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
|
||||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
|
||||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
|
||||||
<ListValues>
|
|
||||||
<Value>NDEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\include\</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
|
|
||||||
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
|
||||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
|
||||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
|
||||||
<avrgcccpp.linker.libraries.Libraries>
|
|
||||||
<ListValues>
|
|
||||||
<Value>libm</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.linker.libraries.Libraries>
|
|
||||||
<avrgcccpp.assembler.general.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\include\</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.assembler.general.IncludePaths>
|
|
||||||
</AvrGccCpp>
|
|
||||||
</ToolchainSettings>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
|
||||||
<ToolchainSettings>
|
|
||||||
<AvrGccCpp>
|
|
||||||
<avrgcc.common.Device>-mmcu=atmega328pb -B "%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\gcc\dev\atmega328pb"</avrgcc.common.Device>
|
|
||||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
|
||||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
|
||||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
|
||||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
|
||||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
|
||||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
|
||||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
|
||||||
<avrgcc.compiler.symbols.DefSymbols>
|
|
||||||
<ListValues>
|
|
||||||
<Value>DEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\include\</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
|
||||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
|
||||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
|
||||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
|
||||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
|
||||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
|
||||||
<ListValues>
|
|
||||||
<Value>DEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\include\</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<avrgcccpp.compiler.optimization.level>Optimize (-O1)</avrgcccpp.compiler.optimization.level>
|
|
||||||
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
|
||||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
|
||||||
<avrgcccpp.compiler.optimization.DebugLevel>Default (-g2)</avrgcccpp.compiler.optimization.DebugLevel>
|
|
||||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
|
||||||
<avrgcccpp.linker.libraries.Libraries>
|
|
||||||
<ListValues>
|
|
||||||
<Value>libm</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.linker.libraries.Libraries>
|
|
||||||
<avrgcccpp.assembler.general.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\2.0.401\include\</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.assembler.general.IncludePaths>
|
|
||||||
<avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel>
|
|
||||||
</AvrGccCpp>
|
|
||||||
</ToolchainSettings>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="main.cpp">
|
|
||||||
<SubType>compile</SubType>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
|
||||||
</Project>
|
|
@ -1,150 +0,0 @@
|
|||||||
#ifdef F_CPU
|
|
||||||
#undef F_CPU
|
|
||||||
#endif
|
|
||||||
#define F_CPU 16000000UL
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include "IdiBusSerialLine.h"
|
|
||||||
#include "IDIBUS_1xGen.h"
|
|
||||||
#include "MBOARD_POWER.h"
|
|
||||||
#include <avr/wdt.h>
|
|
||||||
|
|
||||||
IdiBusSerialLine Serial_Line0;
|
|
||||||
IdiBusSerialLine Serial_Line1;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MBOARD_POWER_OFF_ON();
|
|
||||||
delay(50);
|
|
||||||
|
|
||||||
IDIBUS_SERIAL_INIT_TYPEDEF L0Init;
|
|
||||||
L0Init.USART_NUMBER = IDIBUS_SERIAL_USART2; // select USART
|
|
||||||
L0Init.TIMER_NUMBER = IDIBUS_TIMER_1; // select timer
|
|
||||||
L0Init.CONFIG = IDIBUS_SERIAL_8N2; // 8 bit, 2 stop
|
|
||||||
L0Init.RS485_DIR_PIN = 6; // direction pin in-out
|
|
||||||
L0Init.BAUDRATE_DIPSW_S0_PIN = 9; // speed selector pins
|
|
||||||
L0Init.BAUDRATE_DIPSW_S1_PIN = 8;
|
|
||||||
L0Init.BAUDRATE_DIPSW_S2_PIN = 7;
|
|
||||||
Serial_Line0.Init(&L0Init); // Init line with with config above
|
|
||||||
Serial_Line0.UpdateBaudrateFromDipSwitch(); // speed setup
|
|
||||||
Serial_Line0.Start(); // run!
|
|
||||||
|
|
||||||
IDIBUS_SERIAL_ALTERNATIVE_INIT_TYPEDEF L1Init;
|
|
||||||
L1Init.USART_NUMBER = IDIBUS_SERIAL_USART1;
|
|
||||||
L1Init.TIMER_NUMBER = IDIBUS_TIMER_3;
|
|
||||||
L1Init.CONFIG = IDIBUS_SERIAL_8N2;
|
|
||||||
L1Init.RS485_DIR_GPIO.PORT = &PORTL;
|
|
||||||
L1Init.RS485_DIR_GPIO.PIN_NUM = 6;
|
|
||||||
L1Init.BAUDRATE_DIPSW.S0.PORT = &PORTD;
|
|
||||||
L1Init.BAUDRATE_DIPSW.S0.PIN_NUM = 1;
|
|
||||||
L1Init.BAUDRATE_DIPSW.S1.PORT = &PORTD;
|
|
||||||
L1Init.BAUDRATE_DIPSW.S1.PIN_NUM = 0;
|
|
||||||
L1Init.BAUDRATE_DIPSW.S2.PORT = &PORTL;
|
|
||||||
L1Init.BAUDRATE_DIPSW.S2.PIN_NUM = 7;
|
|
||||||
Serial_Line1.Init(&L1Init);
|
|
||||||
Serial_Line1.UpdateBaudrateFromDipSwitch();
|
|
||||||
Serial_Line1.Start();
|
|
||||||
|
|
||||||
Serial.begin(115200,SERIAL_8N2); // usart0 for debug
|
|
||||||
|
|
||||||
#define BAUD 16000000UL/16/250000UL-1 // BAUD speed = 250000 bod
|
|
||||||
UBRR3 = (uint16_t)(BAUD); // USART BAUD RATE INIT
|
|
||||||
UCSR3B = (1<<RXEN3)|(1<<TXEN3); // USART ENABLE TX RX
|
|
||||||
while (!(UCSR3A & (1<<UDRE3))); // wait for send
|
|
||||||
UDR3 = 'R'; // send 'R'
|
|
||||||
while (!(UCSR3A & (1<<UDRE3))); // wait for send
|
|
||||||
UDR3 = '+'; // send '+'
|
|
||||||
delay(500); // Power on delay for external periphery
|
|
||||||
|
|
||||||
volatile uint8_t ErrorCode; // buffer for error codes
|
|
||||||
IdiBusLongOpData LopData; // Long operation data (not used in current example)
|
|
||||||
Inputs Settings;
|
|
||||||
|
|
||||||
IdiBus_1xGen TEMP(&Serial_Line0, 2);
|
|
||||||
ErrorCode = TEMP.c_Init();
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
//uint8_t TxData[12] = {0x01, 0x4E, 0x20, 0x28, 0x01, 0x00, 0x01, 0x9C, 0x40, 0x28, 0x01, 0x01};
|
|
||||||
Settings.first_mode_time = 2;
|
|
||||||
Settings.first_mode_pwm_value = 40000;
|
|
||||||
Settings.first_mode_f = 40;
|
|
||||||
Settings.first_mode_invert = 1; // 0 || 1
|
|
||||||
Settings.first_mode_R1 = 0; // 0 || 1
|
|
||||||
|
|
||||||
Settings.second_mode_time = 2;
|
|
||||||
Settings.second_mode_pwm_value = 20000;
|
|
||||||
Settings.second_mode_f = 60;
|
|
||||||
Settings.second_mode_invert = 1; // 0 || 1
|
|
||||||
Settings.second_mode_R1 = 1; // 0 || 1
|
|
||||||
|
|
||||||
uint8_t TxData[12] = {Settings.first_mode_time,
|
|
||||||
(uint8_t)((Settings.first_mode_pwm_value >> 8) & 0xFF), (uint8_t)(Settings.first_mode_pwm_value & 0xFF),
|
|
||||||
Settings.first_mode_f, Settings.first_mode_invert, Settings.first_mode_R1,
|
|
||||||
Settings.second_mode_time,
|
|
||||||
(uint8_t)((Settings.second_mode_pwm_value >> 8) & 0xFF), (uint8_t)(Settings.second_mode_pwm_value & 0xFF),
|
|
||||||
Settings.second_mode_f, Settings.second_mode_invert, Settings.second_mode_R1};
|
|
||||||
TEMP.start_SPI(TxData);
|
|
||||||
|
|
||||||
//TEMP.reset_STM();
|
|
||||||
|
|
||||||
Serial_Line1.UpdateBaudrateFromDipSwitch();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t MBOARD_POWER_SET(uint8_t juction, uint8_t set) // power channel ON/OFF
|
|
||||||
{
|
|
||||||
Serial3.begin(115200,SERIAL_8N1); // usart3 for 328pb on MBoard
|
|
||||||
uint8_t string[2];
|
|
||||||
if((juction==MBOARD_POWER_J89_05V)&&(set==MBOARD_POWER_ON))
|
|
||||||
{
|
|
||||||
Serial3.print("5+"); delay(10);
|
|
||||||
Serial3.readBytes(string, 2);
|
|
||||||
if((string[0]=='O')&&(string[1]=='K')) return MBOARD_POWER_OK;
|
|
||||||
}
|
|
||||||
else if((juction==MBOARD_POWER_J89_05V)&&(set==MBOARD_POWER_OFF))
|
|
||||||
{
|
|
||||||
Serial3.print("5-"); delay(10);
|
|
||||||
Serial3.readBytes(string, 2);
|
|
||||||
if((string[0]=='O')&&(string[1]=='K')) return MBOARD_POWER_OK;
|
|
||||||
}
|
|
||||||
else if((juction==MBOARD_POWER_J89_24V)&&(set==MBOARD_POWER_ON))
|
|
||||||
{
|
|
||||||
Serial3.print("J+"); delay(10);
|
|
||||||
Serial3.readBytes(string, 2);
|
|
||||||
if((string[0]=='O')&&(string[1]=='K')) return MBOARD_POWER_OK;
|
|
||||||
}
|
|
||||||
else if((juction==MBOARD_POWER_J89_24V)&&(set==MBOARD_POWER_OFF))
|
|
||||||
{
|
|
||||||
Serial3.print("J-"); delay(10);
|
|
||||||
Serial3.readBytes(string, 2);
|
|
||||||
if((string[0]=='O')&&(string[1]=='K')) return MBOARD_POWER_OK;
|
|
||||||
}
|
|
||||||
else if((juction==MBOARD_POWER_J67_24V)&&(set==MBOARD_POWER_ON))
|
|
||||||
{
|
|
||||||
Serial3.print("R+"); delay(10);
|
|
||||||
Serial3.readBytes(string, 2);
|
|
||||||
if((string[0]=='O')&&(string[1]=='K')) return MBOARD_POWER_OK;
|
|
||||||
}
|
|
||||||
else if((juction==MBOARD_POWER_J67_24V)&&(set==MBOARD_POWER_OFF))
|
|
||||||
{
|
|
||||||
Serial3.print("R-"); delay(10);
|
|
||||||
Serial3.readBytes(string, 2);
|
|
||||||
if((string[0]=='O')&&(string[1]=='K')) return MBOARD_POWER_OK;
|
|
||||||
}
|
|
||||||
while(Serial3.available()>0) string[0]=Serial3.read();
|
|
||||||
return MBOARD_POWER_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MBOARD_POWER_OFF_ON(void) // âûêëþ÷åíèå, ïàóçà è ïîñëåäîâàòåëüíîå âêëþ÷åíèå âñåõ ïèòàíèé
|
|
||||||
{
|
|
||||||
MBOARD_POWER_SET(MBOARD_POWER_J89_05V, MBOARD_POWER_OFF);
|
|
||||||
MBOARD_POWER_SET(MBOARD_POWER_J89_24V, MBOARD_POWER_OFF);
|
|
||||||
MBOARD_POWER_SET(MBOARD_POWER_J67_24V, MBOARD_POWER_OFF);
|
|
||||||
delay(1000);wdt_reset();
|
|
||||||
MBOARD_POWER_SET(MBOARD_POWER_J89_05V, MBOARD_POWER_ON);
|
|
||||||
delay(500);wdt_reset();
|
|
||||||
MBOARD_POWER_SET(MBOARD_POWER_J89_24V, MBOARD_POWER_ON);
|
|
||||||
delay(500);wdt_reset();
|
|
||||||
MBOARD_POWER_SET(MBOARD_POWER_J67_24V, MBOARD_POWER_ON);
|
|
||||||
delay(1000);wdt_reset();
|
|
||||||
return;
|
|
||||||
}
|
|
Loading…
Reference in new issue