first commit

This commit is contained in:
eddyem 2017-06-06 22:18:45 +03:00
parent f2789cb93e
commit 5b24002aea
19 changed files with 2953 additions and 50 deletions

52
.gitignore vendored
View File

@ -1,52 +1,4 @@
# Prerequisites *~
*.d
# Object files
*.o *.o
*.ko
*.obj
*.elf *.elf
*.lst
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

76
Makefile Normal file
View File

@ -0,0 +1,76 @@
### https://habrahabr.ru/post/247663/
NAME = scorpio2
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
CC = avr-gcc
OPTIMIZE= -Os
DEFS = -DBAUD=9600
LIBS =
SRC=$(wildcard *.c)
HEX = $(NAME).hex
ELF = $(NAME).elf
OBJECTS = $(SRC:%.c=%.o)
# controller
DEVICE = atmega328p
#atmega8535
CFLAGS = -g -Wall $(OPTIMIZE) $(DEFS)
LDFLAGS = -Wl,-Map,$(NAME).map
# programmer (for avrdude)
PROGRAMMER = arduino
# partno (for avrdude)
PARTNO = m328p
# serial port device (for avrdude)
SERPORT = /dev/ttyUSB0
#Тактовая частота 16 МГц
CLOCK = 16000000
# avrdude command from arduino IDE
AVRDUDE = avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -p$(PARTNO) -c$(PROGRAMMER) -P$(SERPORT) -b115200 -D
COMPILE = $(CC) $(CFLAGS) -mmcu=$(DEVICE) -DF_CPU=$(CLOCK)
all: $(HEX) lst
$(ELF): $(OBJECTS)
@echo "ELF"
@$(COMPILE) -o $(ELF) $(OBJECTS) $(LIBS)
$(HEX): $(ELF)
@echo "HEX"
@rm -f $(HEX)
@$(OBJCOPY) -j .text -j .data -O ihex $(ELF) $(HEX)
@avr-size $(ELF)
.c.o:
@$(COMPILE) -c $< -o $@
.S.o:
@$(COMPILE) -x assembler-with-cpp -c $< -o $@
.c.s:
@$(COMPILE) -S $< -o $@
lst: $(NAME).lst
%.lst: %.elf
@echo "Make listing"
@$(OBJDUMP) -h -S $< > $@
flash: all
@echo "Flash"
@$(AVRDUDE) -U flash:w:$(HEX):i
clean:
@echo "Clean"
@rm -f $(HEX) $(ELF) $(OBJECTS) *.lst *.map
gentags:
CFLAGS="$(CFLAGS) -I/usr/avr/include" geany -g $(NAME).c.tags *.[hc] 2>/dev/null
.PHONY: gentags clean

3
Readme Normal file
View File

@ -0,0 +1,3 @@
Прошивка для микроконтроллера платформы SCORPIO-1
Так как никакой поддержки этого не планируется, все сделано тяп-ляп. Абы проработало до разработки нормальной системы управления.

40
includes.h Normal file
View File

@ -0,0 +1,40 @@
/*
* geany_encoding=koi8-r
* includes.h
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#pragma once
#ifndef __INCLUDES_H__
#define __INCLUDES_H__
#include <avr/io.h> // IO ports
#include <avr/wdt.h> // WDT
#include <avr/interrupt.h>
#include <avr/io.h> // IO ports
#include <stdint.h> // int types
#include <util/setbaud.h> // baudrate calculation helper
#include "proto.h"
#include "uart.h"
#include "stepper.h"
#endif // __INCLUDES_H__

102
main.c Normal file
View File

@ -0,0 +1,102 @@
/*
* geany_encoding=koi8-r
* main.c
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#include "includes.h"
#define LED_PIN (_BV(5))
volatile uint16_t Milliseconds = 0, Seconds = 0, days = 0;
void print_time(){
printUint((uint8_t*)&days, 2);
usart_send("d");
printUint((uint8_t*)&Seconds, 2);
usart_send("s");
printUint((uint8_t*)&Milliseconds, 2);
usart_send("ms\n");
}
int main() {
// LED for debug
DDRB |= LED_PIN;
/** setup all other pins **/
PORTD |= 0xfc; // turn off steppers before configuring to output
DDRD = 0xfc; // steppers
PORTD |= 0x0f;
DDRC = 0x0f; // steppers diagram
// 328p have no port A
#if defined (__AVR_ATmega8535__)
DDRA = 0xe0; // flat, neon, shutter
#endif
/** USART config **/
// set baudrate (using macros from util/setbaud.h)
UBRR0H = UBRRH_VALUE;
UBRR0L = UBRRL_VALUE;
#if USE_2X
UCSR0A |= _BV(U2X0);
#else
UCSR0A &= ~(_BV(U2X0));
#endif
UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); // 8-bit data
UCSR0B = _BV(RXEN0) | _BV(TXEN0) | _BV(RXCIE0); // Enable RX and TX, enable RX interrupt
/** setup timer 0 - system timer **/
// set prescaler to 64 and start the timer
#if defined (__AVR_ATmega8535__)
TCCR0 |= _BV(CS01) | _BV(CS00);
#else
TCCR0B |= _BV(CS01) | _BV(CS00);
#endif
TIMSK0 |= _BV(TOIE0);
stepper_setup();
sei(); // enable interrupts
wdt_enable(WDTO_2S); // start watchdog
while(1){
wdt_reset();
if(stepper_pulse) stepper_process();
// testing blinking - remove later
if(Milliseconds == 500) PORTB |= LED_PIN;
else if(Milliseconds == 0) PORTB &= ~LED_PIN;
if(usart_flags & U_RX_COMPLETE)
process_string();
}
return 0;
}
ISR(TIMER0_OVF_vect){
TCNT0 += 6;
if(++Milliseconds == 1000){
Milliseconds = 0;
if(++Seconds == 86400){
Seconds = 0;
++days;
}
}
}

BIN
main.o Normal file

Binary file not shown.

125
proto.c Normal file
View File

@ -0,0 +1,125 @@
/*
* geany_encoding=koi8-r
* proto.c - base protocol definitions
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#include "includes.h"
/**
* Move motor for given amount of steps, cmd should be 'N nnnn any other symbols',
* N - motor number,
* nnnn - steps (-32768...32768)
* @return 1 if all OK
*/
uint8_t move_motor(char *cmd){
uint8_t N = (uint8_t)*cmd - '0';
if(N < 1 || N > 6) return 0;
cmd = omit_whitespace(cmd+1);
int16_t steps;
if(!readInt(cmd, &steps)) return 0;
usart_send("Move motor ");
printUint((uint8_t*)&N, 1);
usart_send(" for ");
print_long((uint32_t)steps);
usart_send("steps\n");
return stepper_move(N, steps);
}
extern void print_time();
/**
* process commands from user buffer
* @return 1 if all OK
*/
uint8_t process_commands(){
char *cmd = omit_whitespace(&rx_buffer[1]);
switch(*cmd){
case 't':
print_time();
return 1;
break;
case '2':
cmd = omit_whitespace(cmd + 1);
break;
default:
return 0;
}
if(*cmd > '0' && *cmd < '7')
return move_motor(cmd);
switch(*cmd){
case '0':
usart_send("restart");
break;
case '7':
usart_send("Shutter");
break;
case '8':
usart_send("Neon");
break;
case '9':
usart_send("Flat");
break;
case 'a':
cmd = omit_whitespace(cmd + 1);
return stepper_ch_speed(cmd);
break;
case 'b':
usart_send("LED1");
break;
case 'c':
usart_send("LED2");
break;
case 'd':
usart_send("LED3");
break;
default:
return 0;
}
usart_send("\n");
return 1;
}
void process_string(){
if((usart_flags & U_RX_COMPLETE) == 0) return;
uint8_t noerr = 1, oldflags = usart_flags;
usart_flags &= ~(U_RX_COMPLETE | U_RX_OVERFL | U_RX_ERROR);
if(oldflags & U_RX_OVERFL){
usart_send("Input buffer overflow\n");
noerr = 0;
}
if(oldflags & U_RX_ERROR){
usart_send("Rx error\n");
noerr = 0;
}
if(rx_bufsize < 3 || rx_buffer[0] != '[' || rx_buffer[rx_bufsize - 2] != ']'){
rx_bufsize = 0;
usart_send("Enter \"[cmd]\"\n");
noerr = 0;
}
if(noerr){ // echo back given string
rx_buffer[rx_bufsize] = 0;
uint8_t rbs = rx_bufsize;
rx_bufsize = 0;
usart_send(rx_buffer);
rx_buffer[rbs - 2] = 0;
process_commands();
}
}

30
proto.h Normal file
View File

@ -0,0 +1,30 @@
/*
* geany_encoding=koi8-r
* proto.h
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#pragma once
#ifndef __PROTO_H__
#define __PROTO_H__
void process_string();
#endif // __PROTO_H__

BIN
proto.o Normal file

Binary file not shown.

532
scorpio2.c.tags Normal file
View File

@ -0,0 +1,532 @@
# format=tagmanager
AVR_STACK_POINTER_ADDRÌ65536Ö0
AVR_STACK_POINTER_LO_ADDRÌ65536Ö0
AVR_STACK_POINTER_LO_REGÌ65536Ö0
AVR_STACK_POINTER_REGÌ65536Ö0
AVR_STATUS_ADDRÌ65536Ö0
AVR_STATUS_REGÌ65536Ö0
BADISR_vectÌ65536Ö0
BAUDÌ65536Ö0
BAUD_TOLÌ65536Ö0
DD0Ì65536Ö0
DD1Ì65536Ö0
DD2Ì65536Ö0
DD3Ì65536Ö0
DD4Ì65536Ö0
DD5Ì65536Ö0
DD6Ì65536Ö0
DD7Ì65536Ö0
EMPTY_INTERRUPTÌ131072Í(vector)Ö0
FUSEMEMÌ65536Ö0
FUSESÌ65536Ö0
F_CPUÌ65536Ö0
INFINITYÌ65536Ö0
ISRÌ131072Í(vector,...)Ö0
ISR_ALIASÌ131072Í(vector,tgt)Ö0
ISR_ALIASOFÌ131072Í(v)Ö0
ISR_BLOCKÌ65536Ö0
ISR_NAKEDÌ65536Ö0
ISR_NOBLOCKÌ65536Ö0
LED_PINÌ65536Ö0
LOCKBITSÌ65536Ö0
LOCKBITS_DEFAULTÌ65536Ö0
LOCKMEMÌ65536Ö0
M_1_PIÌ65536Ö0
M_2_PIÌ65536Ö0
M_2_SQRTPIÌ65536Ö0
M_EÌ65536Ö0
M_LN10Ì65536Ö0
M_LN2Ì65536Ö0
M_LOG10EÌ65536Ö0
M_LOG2EÌ65536Ö0
M_PIÌ65536Ö0
M_PI_2Ì65536Ö0
M_PI_4Ì65536Ö0
M_SQRT1_2Ì65536Ö0
M_SQRT2Ì65536Ö0
MillisecondsÌ16384Ö0Ïvolatile uint16_t
NANÌ65536Ö0
PIN0Ì65536Ö0
PIN1Ì65536Ö0
PIN2Ì65536Ö0
PIN3Ì65536Ö0
PIN4Ì65536Ö0
PIN5Ì65536Ö0
PIN6Ì65536Ö0
PIN7Ì65536Ö0
PORT0Ì65536Ö0
PORT1Ì65536Ö0
PORT2Ì65536Ö0
PORT3Ì65536Ö0
PORT4Ì65536Ö0
PORT5Ì65536Ö0
PORT6Ì65536Ö0
PORT7Ì65536Ö0
RX_BUFFER_SIZEÌ65536Ö0
SIGNALÌ131072Í(vector)Ö0
SPÌ65536Ö0
SPLÌ65536Ö0
SREGÌ65536Ö0
SREG_CÌ65536Ö0
SREG_HÌ65536Ö0
SREG_IÌ65536Ö0
SREG_NÌ65536Ö0
SREG_SÌ65536Ö0
SREG_TÌ65536Ö0
SREG_VÌ65536Ö0
SREG_ZÌ65536Ö0
SecondsÌ16384Ö0Ïuint16_t
TIMER0_OVF_vectÌ16Í(void)Ö0Ïvoid
TIMER0_OVF_vectÌ1024Í(void)Ö0ÏÓ void
TX_BUFFER_SIZEÌ65536Ö0
UBRRH_VALUEÌ65536Ö0
UBRRL_VALUEÌ65536Ö0
UBRR_VALUEÌ65536Ö0
USART_RX_vectÌ16Í(void)Ö0Ïvoid
USART_RX_vectÌ1024Í(void)Ö0ÏÓ void
USART_UDRE_vectÌ16Í(void)Ö0Ïvoid
USART_UDRE_vectÌ1024Í(void)Ö0ÏÓ void
USE_2XÌ65536Ö0
U_RX_COMPLETEÌ65536Ö0
U_RX_ERRORÌ65536Ö0
U_RX_OVERFLÌ65536Ö0
U_TX_COMPLETEÌ65536Ö0
U_TX_ERRORÌ65536Ö0
WDTO_120MSÌ65536Ö0
WDTO_15MSÌ65536Ö0
WDTO_1SÌ65536Ö0
WDTO_250MSÌ65536Ö0
WDTO_2SÌ65536Ö0
WDTO_30MSÌ65536Ö0
WDTO_500MSÌ65536Ö0
WDTO_60MSÌ65536Ö0
XHÌ65536Ö0
XLÌ65536Ö0
YHÌ65536Ö0
YLÌ65536Ö0
ZHÌ65536Ö0
ZLÌ65536Ö0
_AVR_COMMON_HÌ65536Ö0
_AVR_FUSE_H_Ì65536Ö0
_AVR_INTERRUPT_H_Ì65536Ö0
_AVR_IO_H_Ì65536Ö0
_AVR_LOCK_H_Ì65536Ö0
_AVR_PORTPINS_H_Ì65536Ö0
_AVR_SFR_DEFS_H_Ì65536Ö0
_AVR_VERSION_H_Ì65536Ö0
_AVR_WDT_H_Ì65536Ö0
_BVÌ131072Í(bit)Ö0
_FORTIFY_SOURCEÌ65536Ö0
_GNU_SOURCEÌ65536Ö0
_LP64Ì65536Ö0
_MMIO_BYTEÌ131072Í(mem_addr)Ö0
_MMIO_DWORDÌ131072Í(mem_addr)Ö0
_MMIO_WORDÌ131072Í(mem_addr)Ö0
_SFR_ADDRÌ131072Í(sfr)Ö0
_SFR_ASM_COMPATÌ65536Ö0
_SFR_BYTEÌ131072Í(sfr)Ö0
_SFR_DWORDÌ131072Í(sfr)Ö0
_SFR_IO16Ì131072Í(io_addr)Ö0
_SFR_IO8Ì131072Í(io_addr)Ö0
_SFR_IO_ADDRÌ131072Í(sfr)Ö0
_SFR_IO_REG_PÌ131072Í(sfr)Ö0
_SFR_MEM16Ì131072Í(mem_addr)Ö0
_SFR_MEM32Ì131072Í(mem_addr)Ö0
_SFR_MEM8Ì131072Í(mem_addr)Ö0
_SFR_MEM_ADDRÌ131072Í(sfr)Ö0
_SFR_WORDÌ131072Í(sfr)Ö0
_STDC_PREDEF_HÌ65536Ö0
_UTIL_DELAY_BASIC_H_Ì65536Ö0
_UTIL_DELAY_H_Ì65536Ö0
_VECTORÌ131072Í(N)Ö0
_WD_CHANGE_BITÌ65536Ö0
_WD_CONTROL_REGÌ65536Ö0
_WD_PS3_MASKÌ65536Ö0
__ATOMIC_ACQUIREÌ65536Ö0
__ATOMIC_ACQ_RELÌ65536Ö0
__ATOMIC_CONSUMEÌ65536Ö0
__ATOMIC_HLE_ACQUIREÌ65536Ö0
__ATOMIC_HLE_RELEASEÌ65536Ö0
__ATOMIC_RELAXEDÌ65536Ö0
__ATOMIC_RELEASEÌ65536Ö0
__ATOMIC_SEQ_CSTÌ65536Ö0
__ATTR_CONST__Ì65536Ö0
__AVR_LIBC_DATE_Ì65536Ö0
__AVR_LIBC_DATE_STRING__Ì65536Ö0
__AVR_LIBC_MAJOR__Ì65536Ö0
__AVR_LIBC_MINOR__Ì65536Ö0
__AVR_LIBC_REVISION__Ì65536Ö0
__AVR_LIBC_VERSION_STRING__Ì65536Ö0
__AVR_LIBC_VERSION__Ì65536Ö0
__BIGGEST_ALIGNMENT__Ì65536Ö0
__BYTE_ORDER__Ì65536Ö0
__CHAR16_TYPE__Ì65536Ö0
__CHAR32_TYPE__Ì65536Ö0
__CHAR_BIT__Ì65536Ö0
__CONCATÌ131072Í(left,right)Ö0
__CONCATenateÌ131072Í(left,right)Ö0
__DBL_DECIMAL_DIG__Ì65536Ö0
__DBL_DENORM_MIN__Ì65536Ö0
__DBL_DIG__Ì65536Ö0
__DBL_EPSILON__Ì65536Ö0
__DBL_HAS_DENORM__Ì65536Ö0
__DBL_HAS_INFINITY__Ì65536Ö0
__DBL_HAS_QUIET_NAN__Ì65536Ö0
__DBL_MANT_DIG__Ì65536Ö0
__DBL_MAX_10_EXP__Ì65536Ö0
__DBL_MAX_EXP__Ì65536Ö0
__DBL_MAX__Ì65536Ö0
__DBL_MIN_10_EXP__Ì65536Ö0
__DBL_MIN_EXP__Ì65536Ö0
__DBL_MIN__Ì65536Ö0
__DEC128_EPSILON__Ì65536Ö0
__DEC128_MANT_DIG__Ì65536Ö0
__DEC128_MAX_EXP__Ì65536Ö0
__DEC128_MAX__Ì65536Ö0
__DEC128_MIN_EXP__Ì65536Ö0
__DEC128_MIN__Ì65536Ö0
__DEC128_SUBNORMAL_MIN__Ì65536Ö0
__DEC32_EPSILON__Ì65536Ö0
__DEC32_MANT_DIG__Ì65536Ö0
__DEC32_MAX_EXP__Ì65536Ö0
__DEC32_MAX__Ì65536Ö0
__DEC32_MIN_EXP__Ì65536Ö0
__DEC32_MIN__Ì65536Ö0
__DEC32_SUBNORMAL_MIN__Ì65536Ö0
__DEC64_EPSILON__Ì65536Ö0
__DEC64_MANT_DIG__Ì65536Ö0
__DEC64_MAX_EXP__Ì65536Ö0
__DEC64_MAX__Ì65536Ö0
__DEC64_MIN_EXP__Ì65536Ö0
__DEC64_MIN__Ì65536Ö0
__DEC64_SUBNORMAL_MIN__Ì65536Ö0
__DECIMAL_BID_FORMAT__Ì65536Ö0
__DECIMAL_DIG__Ì65536Ö0
__DEC_EVAL_METHOD__Ì65536Ö0
__DEPRECATEDÌ65536Ö0
__ELF__Ì65536Ö0
__EXCEPTIONSÌ65536Ö0
__FINITE_MATH_ONLY__Ì65536Ö0
__FLOAT_WORD_ORDER__Ì65536Ö0
__FLT_DECIMAL_DIG__Ì65536Ö0
__FLT_DENORM_MIN__Ì65536Ö0
__FLT_DIG__Ì65536Ö0
__FLT_EPSILON__Ì65536Ö0
__FLT_EVAL_METHOD__Ì65536Ö0
__FLT_HAS_DENORM__Ì65536Ö0
__FLT_HAS_INFINITY__Ì65536Ö0
__FLT_HAS_QUIET_NAN__Ì65536Ö0
__FLT_MANT_DIG__Ì65536Ö0
__FLT_MAX_10_EXP__Ì65536Ö0
__FLT_MAX_EXP__Ì65536Ö0
__FLT_MAX__Ì65536Ö0
__FLT_MIN_10_EXP__Ì65536Ö0
__FLT_MIN_EXP__Ì65536Ö0
__FLT_MIN__Ì65536Ö0
__FLT_RADIX__Ì65536Ö0
__FXSR__Ì65536Ö0
__GCC_ATOMIC_BOOL_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_CHAR16_T_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_CHAR32_T_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_CHAR_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_INT_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_LLONG_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_LONG_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_POINTER_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_SHORT_LOCK_FREEÌ65536Ö0
__GCC_ATOMIC_TEST_AND_SET_TRUEVALÌ65536Ö0
__GCC_ATOMIC_WCHAR_T_LOCK_FREEÌ65536Ö0
__GCC_HAVE_DWARF2_CFI_ASMÌ65536Ö0
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1Ì65536Ö0
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2Ì65536Ö0
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4Ì65536Ö0
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8Ì65536Ö0
__GCC_IEC_559Ì65536Ö0
__GCC_IEC_559_COMPLEXÌ65536Ö0
__GLIBCXX_BITSIZE_INT_N_0Ì65536Ö0
__GLIBCXX_TYPE_INT_N_0Ì65536Ö0
__GNUC_GNU_INLINE__Ì65536Ö0
__GNUC_MINOR__Ì65536Ö0
__GNUC_PATCHLEVEL__Ì65536Ö0
__GNUC__Ì65536Ö0
__GNUG__Ì65536Ö0
__GXX_ABI_VERSIONÌ65536Ö0
__GXX_RTTIÌ65536Ö0
__GXX_WEAK__Ì65536Ö0
__HAS_DELAY_CYCLESÌ65536Ö0
__INT16_CÌ131072Í(c)Ö0
__INT16_MAX__Ì65536Ö0
__INT16_TYPE__Ì65536Ö0
__INT32_CÌ131072Í(c)Ö0
__INT32_MAX__Ì65536Ö0
__INT32_TYPE__Ì65536Ö0
__INT64_CÌ131072Í(c)Ö0
__INT64_MAX__Ì65536Ö0
__INT64_TYPE__Ì65536Ö0
__INT8_CÌ131072Í(c)Ö0
__INT8_MAX__Ì65536Ö0
__INT8_TYPE__Ì65536Ö0
__INTMAX_CÌ131072Í(c)Ö0
__INTMAX_MAX__Ì65536Ö0
__INTMAX_TYPE__Ì65536Ö0
__INTPTR_MAX__Ì65536Ö0
__INTPTR_TYPE__Ì65536Ö0
__INTR_ATTRSÌ65536Ö0
__INTTYPES_H_Ì65536Ö0
__INT_FAST16_MAX__Ì65536Ö0
__INT_FAST16_TYPE__Ì65536Ö0
__INT_FAST32_MAX__Ì65536Ö0
__INT_FAST32_TYPE__Ì65536Ö0
__INT_FAST64_MAX__Ì65536Ö0
__INT_FAST64_TYPE__Ì65536Ö0
__INT_FAST8_MAX__Ì65536Ö0
__INT_FAST8_TYPE__Ì65536Ö0
__INT_LEAST16_MAX__Ì65536Ö0
__INT_LEAST16_TYPE__Ì65536Ö0
__INT_LEAST32_MAX__Ì65536Ö0
__INT_LEAST32_TYPE__Ì65536Ö0
__INT_LEAST64_MAX__Ì65536Ö0
__INT_LEAST64_TYPE__Ì65536Ö0
__INT_LEAST8_MAX__Ì65536Ö0
__INT_LEAST8_TYPE__Ì65536Ö0
__INT_MAX__Ì65536Ö0
__LDBL_DENORM_MIN__Ì65536Ö0
__LDBL_DIG__Ì65536Ö0
__LDBL_EPSILON__Ì65536Ö0
__LDBL_HAS_DENORM__Ì65536Ö0
__LDBL_HAS_INFINITY__Ì65536Ö0
__LDBL_HAS_QUIET_NAN__Ì65536Ö0
__LDBL_MANT_DIG__Ì65536Ö0
__LDBL_MAX_10_EXP__Ì65536Ö0
__LDBL_MAX_EXP__Ì65536Ö0
__LDBL_MAX__Ì65536Ö0
__LDBL_MIN_10_EXP__Ì65536Ö0
__LDBL_MIN_EXP__Ì65536Ö0
__LDBL_MIN__Ì65536Ö0
__LONG_LONG_MAX__Ì65536Ö0
__LONG_MAX__Ì65536Ö0
__LP64__Ì65536Ö0
__MATH_HÌ65536Ö0
__MMX__Ì65536Ö0
__OPTIMIZE_SIZE__Ì65536Ö0
__OPTIMIZE__Ì65536Ö0
__ORDER_BIG_ENDIAN__Ì65536Ö0
__ORDER_LITTLE_ENDIAN__Ì65536Ö0
__ORDER_PDP_ENDIAN__Ì65536Ö0
__PRAGMA_REDEFINE_EXTNAMEÌ65536Ö0
__PROTO_H__Ì65536Ö0
__PTRDIFF_MAX__Ì65536Ö0
__PTRDIFF_TYPE__Ì65536Ö0
__REGISTER_PREFIX__Ì65536Ö0
__SCHAR_MAX__Ì65536Ö0
__SFR_OFFSETÌ65536Ö0
__SHRT_MAX__Ì65536Ö0
__SIG_ATOMIC_MAX__Ì65536Ö0
__SIG_ATOMIC_MIN__Ì65536Ö0
__SIG_ATOMIC_TYPE__Ì65536Ö0
__SIZEOF_DOUBLE__Ì65536Ö0
__SIZEOF_FLOAT128__Ì65536Ö0
__SIZEOF_FLOAT80__Ì65536Ö0
__SIZEOF_FLOAT__Ì65536Ö0
__SIZEOF_INT128__Ì65536Ö0
__SIZEOF_INT__Ì65536Ö0
__SIZEOF_LONG_DOUBLE__Ì65536Ö0
__SIZEOF_LONG_LONG__Ì65536Ö0
__SIZEOF_LONG__Ì65536Ö0
__SIZEOF_POINTER__Ì65536Ö0
__SIZEOF_PTRDIFF_T__Ì65536Ö0
__SIZEOF_SHORT__Ì65536Ö0
__SIZEOF_SIZE_T__Ì65536Ö0
__SIZEOF_WCHAR_T__Ì65536Ö0
__SIZEOF_WINT_T__Ì65536Ö0
__SIZE_MAX__Ì65536Ö0
__SIZE_TYPE__Ì65536Ö0
__SSE2_MATH__Ì65536Ö0
__SSE2__Ì65536Ö0
__SSE_MATH__Ì65536Ö0
__SSE__Ì65536Ö0
__SSP_STRONG__Ì65536Ö0
__STDC_HOSTED__Ì65536Ö0
__STDC_IEC_559_COMPLEX__Ì65536Ö0
__STDC_IEC_559__Ì65536Ö0
__STDC_ISO_10646__Ì65536Ö0
__STDC_NO_THREADS__Ì65536Ö0
__STDC__Ì65536Ö0
__STDINT_H_Ì65536Ö0
__STRINGIFYÌ131072Í(x)Ö0
__UART_H__Ì65536Ö0
__UINT16_CÌ131072Í(c)Ö0
__UINT16_MAX__Ì65536Ö0
__UINT16_TYPE__Ì65536Ö0
__UINT32_CÌ131072Í(c)Ö0
__UINT32_MAX__Ì65536Ö0
__UINT32_TYPE__Ì65536Ö0
__UINT64_CÌ131072Í(c)Ö0
__UINT64_MAX__Ì65536Ö0
__UINT64_TYPE__Ì65536Ö0
__UINT8_CÌ131072Í(c)Ö0
__UINT8_MAX__Ì65536Ö0
__UINT8_TYPE__Ì65536Ö0
__UINTMAX_CÌ131072Í(c)Ö0
__UINTMAX_MAX__Ì65536Ö0
__UINTMAX_TYPE__Ì65536Ö0
__UINTPTR_MAX__Ì65536Ö0
__UINTPTR_TYPE__Ì65536Ö0
__UINT_FAST16_MAX__Ì65536Ö0
__UINT_FAST16_TYPE__Ì65536Ö0
__UINT_FAST32_MAX__Ì65536Ö0
__UINT_FAST32_TYPE__Ì65536Ö0
__UINT_FAST64_MAX__Ì65536Ö0
__UINT_FAST64_TYPE__Ì65536Ö0
__UINT_FAST8_MAX__Ì65536Ö0
__UINT_FAST8_TYPE__Ì65536Ö0
__UINT_LEAST16_MAX__Ì65536Ö0
__UINT_LEAST16_TYPE__Ì65536Ö0
__UINT_LEAST32_MAX__Ì65536Ö0
__UINT_LEAST32_TYPE__Ì65536Ö0
__UINT_LEAST64_MAX__Ì65536Ö0
__UINT_LEAST64_TYPE__Ì65536Ö0
__UINT_LEAST8_MAX__Ì65536Ö0
__UINT_LEAST8_TYPE__Ì65536Ö0
__USER_LABEL_PREFIX__Ì65536Ö0
__USING_MINT8Ì65536Ö0
__VERSION__Ì65536Ö0
__WCHAR_MAX__Ì65536Ö0
__WCHAR_MIN__Ì65536Ö0
__WCHAR_TYPE__Ì65536Ö0
__WINT_MAX__Ì65536Ö0
__WINT_MIN__Ì65536Ö0
__WINT_TYPE__Ì65536Ö0
__amd64Ì65536Ö0
__amd64__Ì65536Ö0
__code_model_small__Ì65536Ö0
__cplusplusÌ65536Ö0
__cpp_binary_literalsÌ65536Ö0
__cpp_exceptionsÌ65536Ö0
__cpp_rttiÌ65536Ö0
__cpp_runtime_arraysÌ65536Ö0
__gnu_linux__Ì65536Ö0
__has_includeÌ131072Í(STR)Ö0
__has_include_nextÌ131072Í(STR)Ö0
__k8Ì65536Ö0
__k8__Ì65536Ö0
__linuxÌ65536Ö0
__linux__Ì65536Ö0
__unixÌ65536Ö0
__unix__Ì65536Ö0
__x86_64Ì65536Ö0
__x86_64__Ì65536Ö0
_delay_loop_1Ì16Í(uint8_t __count)Ö0Ïvoid
_delay_loop_1Ì1024Í(uint8_t __count)Ö0Ïinline void
_delay_loop_2Ì16Í(uint16_t __count)Ö0Ïvoid
_delay_loop_2Ì1024Í(uint16_t __count)Ö0Ïinline void
_delay_msÌ16Í(double __ms)Ö0Ïvoid
_delay_msÌ1024Í(double __ms)Ö0Ïinline void
_delay_usÌ16Í(double __us)Ö0Ïvoid
_delay_usÌ1024Í(double __us)Ö0Ïinline void
acosfÌ65536Ö0
asinfÌ65536Ö0
atan2fÌ65536Ö0
atanfÌ65536Ö0
bit_is_clearÌ131072Í(sfr,bit)Ö0
bit_is_setÌ131072Í(sfr,bit)Ö0
cbrtfÌ65536Ö0
ceilfÌ65536Ö0
cliÌ131072Í()Ö0
copysignfÌ65536Ö0
cosfÌ65536Ö0
coshfÌ65536Ö0
daysÌ16384Ö0Ïuint16_t
expfÌ65536Ö0
fabsfÌ65536Ö0
fdimfÌ65536Ö0
floorfÌ65536Ö0
fmafÌ65536Ö0
fmaxfÌ65536Ö0
fminfÌ65536Ö0
fmodfÌ65536Ö0
frexpfÌ65536Ö0
hypotfÌ65536Ö0
int16_tÌ4096Ö0Ïsigned int
int32_tÌ4096Ö0Ïsigned int
int64_tÌ4096Ö0Ïsigned int
int8_tÌ4096Ö0Ïsigned int
int_farptr_tÌ4096Ö0Ïint32_t
int_fast16_tÌ4096Ö0Ïint16_t
int_fast32_tÌ4096Ö0Ïint32_t
int_fast64_tÌ4096Ö0Ïint64_t
int_fast8_tÌ4096Ö0Ïint8_t
int_least16_tÌ4096Ö0Ïint16_t
int_least32_tÌ4096Ö0Ïint32_t
int_least64_tÌ4096Ö0Ïint64_t
int_least8_tÌ4096Ö0Ïint8_t
intmax_tÌ4096Ö0Ïint64_t
intptr_tÌ4096Ö0Ïint16_t
isfinitefÌ65536Ö0
isinffÌ65536Ö0
isnanfÌ65536Ö0
ldexpfÌ65536Ö0
linuxÌ65536Ö0
log10fÌ65536Ö0
logfÌ65536Ö0
loop_until_bit_is_clearÌ131072Í(sfr,bit)Ö0
loop_until_bit_is_setÌ131072Í(sfr,bit)Ö0
lrintfÌ65536Ö0
lroundfÌ65536Ö0
mainÌ16Í()Ö0Ïint
move_motorÌ16Í(char *cmd)Ö0Ïuint8_t
omit_watespaceÌ16Í(char *str)Ö0Ïchar *
omit_watespaceÌ1024Í(char *str)Ö0Ïchar *
powfÌ65536Ö0
printUintÌ16Í(uint8_t *val, uint8_t len)Ö0Ïvoid
printUintÌ1024Í(uint8_t *val, uint8_t len)Ö0Ïvoid
print_longÌ16Í(int32_t Number)Ö0Ïvoid
print_longÌ1024Í(int32_t Number)Ö0Ïvoid
print_timeÌ16Í()Ö0Ïvoid
print_timeÌ1024Í()Ö0Ïvoid
process_commandsÌ16Í()Ö0Ïuint8_t
process_stringÌ16Í()Ö0Ïvoid
process_stringÌ1024Í()Ö0Ïvoid
readIntÌ16Í(char *buff, int16_t *val)Ö0Ïuint8_t
readIntÌ1024Í(char *buff, int16_t *val)Ö0Ïuint8_t
retiÌ131072Í()Ö0
roundfÌ65536Ö0
rx_bufferÌ16384Ö0Ïchar
rx_bufferÌ32768Ö0Ïchar
rx_bufsizeÌ16384Ö0Ïvolatile uint8_t
rx_bufsizeÌ32768Ö0Ïvolatile uint8_t
seiÌ131072Í()Ö0
signbitfÌ65536Ö0
sinfÌ65536Ö0
sinhfÌ65536Ö0
sqrtfÌ65536Ö0
squarefÌ65536Ö0
tanfÌ65536Ö0
tanhfÌ65536Ö0
truncfÌ65536Ö0
tx_bufferÌ16384Ö0Ïchar
tx_bufsizeÌ16384Ö0Ïvolatile uint8_t
tx_idxÌ16384Ö0Ïuint8_t
uint16_tÌ4096Ö0Ïunsigned int
uint32_tÌ4096Ö0Ïunsigned int
uint64_tÌ4096Ö0Ïunsigned int
uint8_tÌ4096Ö0Ïunsigned int
uint_farptr_tÌ4096Ö0Ïuint32_t
uint_fast16_tÌ4096Ö0Ïuint16_t
uint_fast32_tÌ4096Ö0Ïuint32_t
uint_fast64_tÌ4096Ö0Ïuint64_t
uint_fast8_tÌ4096Ö0Ïuint8_t
uint_least16_tÌ4096Ö0Ïuint16_t
uint_least32_tÌ4096Ö0Ïuint32_t
uint_least64_tÌ4096Ö0Ïuint64_t
uint_least8_tÌ4096Ö0Ïuint8_t
uintmax_tÌ4096Ö0Ïuint64_t
uintptr_tÌ4096Ö0Ïuint16_t
unixÌ65536Ö0
usart_flagsÌ16384Ö0Ïvolatile uint8_t
usart_flagsÌ32768Ö0Ïvolatile uint8_t
usart_sendÌ16Í(char *Str)Ö0Ïint
usart_sendÌ1024Í(char *Str)Ö0Ïint
wdt_disableÌ131072Í()Ö0
wdt_enableÌ131072Í(value)Ö0
wdt_resetÌ131072Í()Ö0

BIN
scorpio2.elf Executable file

Binary file not shown.

151
scorpio2.hex Normal file
View File

@ -0,0 +1,151 @@
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C94B200AB
:100030000C9451000C9451000C9451000C945100FC
:100040000C94AA020C9451000C9424020C945902B2
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD8E026
:10007000DEBFCDBF11E0A0E0B1E0E0ECF8E002C0EF
:1000800005900D92AE39B107D9F721E0AEE9B1E0A4
:1000900001C01D92A93EB207E1F70E94AD030C9486
:1000A0005E040C940000E1E8F0E0808188608083C9
:1000B00088EE93E09093890080938800808182602D
:1000C0008083EFE6F0E08081826080830895CF93A3
:1000D000DF9300D000D0CDB7DEB7BE016D5F7F4F9C
:1000E0000E94DD018823B1F16B817C81683F8FEF35
:1000F000780764F16F3F8FE7780741F1665F7F4FC4
:100100008FEF9FEF0E94EF037A83698380916F00E6
:100110008D7F80936F0089819A819093890080936D
:100120008800109285001092840080916F00826098
:1001300080936F0081E091E00E94BC0062E0CE01FC
:1001400001960E945D018CE991E002C083E191E09B
:100150000E94BC0080E00F900F900F900F90DF91F5
:10016000CF9108951F920F920FB60F9211240F9006
:100170000FBE0F901F9018952091000120FFFCCF1B
:10018000209100012A7F2093000110929F0110927C
:10019000A001DC018091A001803278F48D91882348
:1001A00061F0E091A001F0E0EE55FE4F8083809178
:1001B000A0018F5F8093A001EDCF8091A0018032DC
:1001C00051F41092A00180910001816080930001A0
:1001D00081E090E008958091C10080628093C10029
:1001E00080E090E008958F929F92AF92BF92DF924D
:1001F000EF92FF920F931F93CF93DF93CDB7DEB7AC
:100200002C970FB6F894DEBF0FBECDBF1C8697FFAC
:100210000AC090958095709561957F4F8F4F9F4F45
:10022000DD24D39401C0D12C0BE03AE0832E912C35
:10023000A12CB12C1FEF100FEE24E394F12CEC0E47
:10024000FD1EE10EF11CA50194010E942504605DD4
:10025000F7016083B901CA01611571058105910536
:1002600021F0012F1111E6CF0EC0112361F0DD2026
:1002700051F01EEF100FE1E0F0E0EC0FFD1FE10F79
:10028000F11D8DE2808381E090E08C0F9D1F810F36
:10029000911D0E94BC002C960FB6F894DEBF0FBED5
:1002A000CDBFDF91CF911F910F91FF90EF90DF9025
:1002B000BF90AF909F908F9008958F929F92AF9232
:1002C000BF92CF92DF92FF920F931F93CF93DF9352
:1002D000CDB7DEB72B970FB6F894DEBF0FBECDBFFC
:1002E000DC01633009F44AC08FEF860F843008F0D8
:1002F00045C0FE013196CE010C968F0111928E17EA
:100300009F07E1F7623039F0643051F0613069F4F1
:100310006C9170E002C06D917C9180E090E008C02B
:100320006D917D918D919C9103C060E070E0CB0157
:100330006E012BE0C20ED11C29E0F22E3AE0832E92
:10034000912CA12CB12CFA94A50194010E940304D4
:10035000605DF60162936F01B901CA016115710513
:100360008105910519F0FFEFFF12EDCF8F2DFF0CE6
:10037000990B0196800F911F0E94BC002B960FB61F
:10038000F894DEBF0FBECDBFDF91CF911F910F91CB
:10039000FF90DF90CF90BF90AF909F908F90089587
:1003A000FC012081203211F40196FACF37EF320F91
:1003B0003230D0F32D30C1F308950F931F93CF93B4
:1003C000DF93EB01FC0120812D3219F4019611E03D
:1003D00001C010E0FC0120E030E0A90181E00191C2
:1003E00090ED900F9A30C0F4AAE0B0E00E9444046F
:1003F000DC01CB01800F911DA11DB11D9C01AD0140
:10040000205331094109510980E0211590E839074D
:100410004105510524F310C081110EC0112339F09C
:1004200050954095309521953F4F4F4F5F4F209706
:1004300029F03983288302C080E001C081E0DF9188
:10044000CF911F910F9108951F920F920FB60F92A7
:1004500011248F939F93EF93FF939091C600809107
:10046000C0008C71C1F4E091A10181E08E0F8093F6
:10047000A101F0E0E853FE4F90839A3021F480917F
:10048000000182600BC08091A101803249F480910B
:100490000001826103C0809100018A6080930001A5
:1004A000FF91EF919F918F910F900FBE0F901F9032
:1004B00018951F920F920FB60F9211248F939F934E
:1004C000EF93FF938091A0018823B1F0E0919F0109
:1004D00081E08E0F80939F01F0E0EE55FE4F80810A
:1004E0008093C60090919F018091A00198130EC047
:1004F00010929F011092A0018091C1008F7D809386
:10050000C10080910001816080930001FF91EF9113
:100510009F918F910F900FBE0F901F90189562E0E2
:1005200082EC91E00E945D0184E291E00E94BC00B7
:1005300062E084EC91E00E945D0186E291E00E941D
:10054000BC0062E086EC91E00E945D0188E291E0EF
:100550000C94BC001F920F920FB60F9211242F9390
:100560008F939F9386B58A5F86BD8091C6019091D7
:10057000C70101969093C7018093C601883E9340BE
:1005800069F41092C7011092C6018091C401909144
:10059000C50101969093C5018093C4019F918F91ED
:1005A0002F910F900FBE0F901F901895CF93DF9350
:1005B00000D01F92CDB7DEB7FC01908180ED890F8E
:1005C0008B839153963010F080E025C0CF010196C7
:1005D0000E94D001BE016F5F7F4F0E94DD01882322
:1005E00099F38CE291E00E94BC0061E0CE01039699
:1005F0000E945D0188E391E00E94BC0069817A81DC
:10060000072E000C880B990B0E94F3008EE391E0FB
:100610000E94BC0081E00F900F900F90DF91CF916E
:10062000089589EC91E00E94D001FC0120812233E1
:1006300031F0243709F042C00E948F023DC001967C
:100640000E94D001FC0190818FEC890F863018F454
:10065000CF010C94D602993309F144F49733C1F0D9
:10066000D4F4903359F585E491E020C09236C9F076
:1006700044F4913619F5CF0101960E94D0010C94F3
:100680006700933689F09436C9F489E691E00EC08C
:100690008DE491E00BC085E591E008C08AE591E02A
:1006A00005C08FE591E002C084E691E00E94BC00A5
:1006B0008CE991E00E94BC0081E0089580E00895FB
:1006C000CF938091000181FF46C0C09100018091CD
:1006D0000001857E80930001C4FF06C08EE691E094
:1006E0000E94BC0080E001C081E0C3FF05C085E836
:1006F00091E00E94BC0080E09091A101933060F0F5
:100700009091C8019B3541F4E091A101F0E0EA53DA
:10071000FE4F90819D3539F01092A1018FE891E054
:10072000CF910C94BC008823B1F0E091A101F0E0DE
:10073000E853FE4F1082C091A1011092A10188ECF4
:1007400091E00E94BC00EC2FF0E0EA53FE4F1082D3
:10075000CF910C941103CF910895259A8CEF8AB90B
:10076000CFE0C7B91092C50087E68093C40080919E
:10077000C0008D7F8093C00086E08093C20088E92E
:100780008093C10085B5836085BD80916E008160D6
:1007900080936E000E945300789488E190E00FB639
:1007A000F894A895809360000FBEC0936000A89550
:1007B0008091C6019091C701843F914011F42D9A18
:1007C00007C08091C6019091C701892B09F42D982B
:1007D0008091000181FFEBCF0E946003E8CFAA1B4C
:1007E000BB1B51E107C0AA1FBB1FA617B70710F01C
:1007F000A61BB70B881F991F5A95A9F7809590954E
:10080000BC01CD010895A1E21A2EAA1BBB1BFD015C
:100810000DC0AA1FBB1FEE1FFF1FA217B307E407DF
:10082000F50720F0A21BB30BE40BF50B661F771F37
:10083000881F991F1A9469F7609570958095909517
:100840009B01AC01BD01CF010895052E97FB1EF45D
:1008500000940E943C0457FD07D00E94030407FC4B
:1008600003D04EF40C943C0450954095309521955E
:100870003F4F4F4F5F4F08959095809570956195CC
:100880007F4F8F4F9F4F08950E944F04A59F900D5B
:10089000B49F900DA49F800D911D11240895A29FD7
:1008A000B001B39FC001A39F700D811D1124911D44
:1008B000B29F700D811D1124911D0895F894FFCFF2
:1008C000015370656564206368616E6765642074B8
:1008D0006F20004261642073706565642076616CEE
:1008E00075650A00640073006D730A004D6F7665CC
:1008F000206D6F746F72200020666F722000737419
:100900006570730A00726573746172740053687560
:1009100074746572004E656F6E00466C6174004CB5
:10092000454431004C454432004C45443300496E47
:1009300070757420627566666572206F7665726682
:100940006C6F770A005278206572726F720A0045E8
:0E0950006E74657220225B636D645D220A0086
:00000001FF

1481
scorpio2.lst Normal file

File diff suppressed because it is too large Load Diff

150
stepper.c Normal file
View File

@ -0,0 +1,150 @@
/*
* geany_encoding=koi8-r
* stepper.c
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#include "includes.h"
/*
* 0 0000
* 1 0001
* 2 0010
* 3 0011
* 4 0100
* 5 0101
* 6 0110
* 7 0111
* 8 1000
* 9 1001
*10 1010
*11 1011
*12 1100
*13 1101
*14 1110
*15 1111
*/
// microsteps: DCBA = 1000, 1100, 0100, 0110, 0010, 0011, 0001, 1001 -- for ULN
// what a shit is this > DCBA = 0001, 0010, 0110, 1010, 1001, 1000, 0100, 0000 - bipolar
// 1000, 1010, 0010, 0110, 0100, 0101, 0001, 1001 - half-step
// 1010, 0110, 0101, 1001 - full step
static const uint8_t usteps[8] = {8, 12, 4, 6, 2, 3, 1, 9}; // ULN - unipolar
static volatile char Ustep = 0; // current microstep count
uint8_t stepper_pulse = 0;
void stepper_setup(){
TCCR1B |= _BV(WGM12); // configure timer1 for CTC mode, TOP is OCR1A
OCR1A = 1000; // set the CTC compare value - 2kHz (means 1kHz)
TCCR1B |= _BV(CS11); // start the timer at 16MHz/8 = 2MHz
//TCCR1B |= _BV(CS12) | _BV(CS10); // /1024 == 15625Hz
//OCR1A = 15625;
TIMSK1 |= _BV(OCIE1A); // enable the CTC interrupt
}
/**
* Change TIM1 speed
*/
uint8_t stepper_ch_speed(char *spd){
int16_t newval;
if(readInt(spd, &newval)){
if(newval > -9 && newval < 0x7fff){
uint16_t O = 0xffff / (newval + 10);
TIMSK1 &= ~_BV(OCIE1A); // disable timer interrupt
OCR1A = O;
TCNT1 = 0; // reset counter
TIMSK1 |= _BV(OCIE1A);
usart_send("Speed changed to ");
printUint((uint8_t*)&O, 2);
usart_send("\n");
}else usart_send("Bad speed value\n");
}
return 0;
}
/**
* Check endswitches
* @return 0 if none pressed, 1 if "-", 2 if "+"
*/
static uint8_t check_endsw();
/**
* move stepper number Nmotor by Nsteps steps
* @return 1 if Nmotor or Nsteps are bad values
* 2 if motor already on endswitch in given direction
*/
uint8_t stepper_move(uint8_t Nmotor, int16_t Nsteps){
if(!Nmotor || Nmotor > 6 || !Nsteps) return 1;
// turn all OFF
PORTD |= 0xfc;
PORTC |= 0x0f;
// turn on the motor we need
PORTD &= 2 << Nmotor;
uint8_t c = check_endsw();
if(c){
if(c == 1){if(Nsteps > 0) c = 0;}
else if(Nsteps < 0) c = 0;
}
if(c){
PORTD |= 0xfc;
return 2; // already at end-switch in given direction
}
}
static void stop_motor(uint8_t Nmotor){
// turn off all pulses to place motor in free state & prevent undesirable behaviour
PORTD |= 0xfc;
PORTC |= 0x0f;
}
/**
* process stepper pulses generation @ timer event
*/
void stepper_process(){
stepper_pulse = 0;
// change steps
/*if(TIM2_SR1 & TIM_SR1_UIF){
TIM2_SR1 &= ~TIM_SR1_UIF; // take off flag
tmp = PORT(STP_PORT, ODR) & 0xf0;
PORT(STP_PORT, ODR) = tmp | usteps[Ustep];
if(Dir){
if(++Ustep > 7){
Ustep = 0;
--Nsteps;
}
}else{
if(--Ustep < 0){
Ustep = 7;
--Nsteps;
}
}
if(Nsteps == 0){
stop_motor();
}
}*/
}
/**
* Timer 1 used to generate stepper pulses
*/
ISR(TIMER1_COMPA_vect){
stepper_pulse = 1; // say that we can generate next microstep
}

40
stepper.h Normal file
View File

@ -0,0 +1,40 @@
/*
* geany_encoding=koi8-r
* stepper.h
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#pragma once
#ifndef __STEPPER_H__
#define __STEPPER_H__
#include <stdint.h>
extern uint8_t stepper_pulse;
// setup timer
void stepper_setup();
void stepper_process();
uint8_t stepper_ch_speed(char *spd);
uint8_t stepper_move(uint8_t Nmotor, int16_t Nsteps);
#endif // __STEPPER_H__

BIN
stepper.o Normal file

Binary file not shown.

169
uart.c Normal file
View File

@ -0,0 +1,169 @@
/*
* geany_encoding=koi8-r
* uart.c
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#include "includes.h"
char rx_buffer[RX_BUFFER_SIZE + 1];
volatile uint8_t rx_bufsize = 0;
static char tx_buffer[TX_BUFFER_SIZE];
volatile uint8_t tx_bufsize = 0, tx_idx = 0;
volatile uint8_t usart_flags = U_TX_COMPLETE;
/**
* Send zero-terminated string using USART
* if length of string (excluding 0) > TX_BUFFER_SIZE return 1
* if all OK return 0
*/
int usart_send(char *Str){
while((usart_flags & U_TX_COMPLETE) == 0);
usart_flags &= ~(U_TX_COMPLETE | U_TX_ERROR);
tx_idx = 0;
for(tx_bufsize = 0; tx_bufsize < TX_BUFFER_SIZE; ++tx_bufsize){
if(*Str == 0) break;
tx_buffer[tx_bufsize] = *Str++;
}
if(tx_bufsize == TX_BUFFER_SIZE){ // error: buffer overflow
tx_bufsize = 0;
usart_flags |= U_TX_COMPLETE;
return 1;
}
UCSR0B |= _BV(UDRIE0); // allow TX data buffer empty interrupt
return 0;
}
/**
* print signed long onto terminal
* max len = 10 symbols + 1 for "-" + 1 for '\n' + 1 for 0 = 13
*/
void print_long(int32_t Number){
uint8_t i, L = 0;
uint8_t ch;
char decimal_buff[12];
decimal_buff[11] = 0;
ch = 11;
if(Number < 0){
Number = -Number;
L = 1;
}
do{
i = Number % 10L;
decimal_buff[--ch] = i + '0';
Number /= 10L;
}while(Number && ch > 0);
if(ch > 0 && L) decimal_buff[--ch] = '-';
usart_send(&decimal_buff[ch]);
}
void printUint(uint8_t *val, uint8_t len){
uint32_t Number = 0;
uint8_t i = len;
int8_t ch;
uint8_t decimal_buff[11]; // max len of U32 == 10 + \0
if(len > 4 || len == 3 || len == 0) return;
for(i = 0; i < 11; i++)
decimal_buff[i] = 0;
ch = 9;
switch(len){
case 1:
Number = *((uint8_t*)val);
break;
case 2:
Number = *((uint16_t*)val);
break;
case 4:
Number = *((uint32_t*)val);
break;
}
do{
i = Number % 10L;
decimal_buff[ch--] = i + '0';
Number /= 10L;
}while(Number && ch > -1);
usart_send((char*)&decimal_buff[ch+1]);
}
char *omit_whitespace(char *str){
char c;
for(c = *str; c == ' ' || c == '\t' || c == '\r' || c == '\n'; c = *(++str));
return str;
}
/**
* read 16 bit integer value from buffer until first non-number
* @param buff (i) - input buffer
* @param (o) - output value
* @return 1 if all OK or 0 if there's none numbers in buffer
*/
uint8_t readInt(char *buff, int16_t *val){
uint8_t sign = 0, rb, bad = 1;
int32_t R = 0;
//usart_send("readInt, buff=");
//usart_send(buff);
if(*buff == '-'){
sign = 1;
++buff;
}
do{
rb = *buff++;
if(rb < '0' || rb > '9') break;
bad = 0;
R = R * 10L + rb - '0';
if(R > 0x7fff){ // bad value
bad = 1;
break;
}
}while(1);
//print_long(R);
if(bad) return 0;
if(sign) R = -R;
if(val) *val = (int16_t)R;
return 1;
}
ISR(USART_RX_vect){
char c = UDR0, r = UCSR0A;
if(0 == (r & (_BV(FE0) | _BV(UPE0) | _BV(DOR0)))){ // no errors
rx_buffer[rx_bufsize++] = c;
if(c == '\n') usart_flags |= U_RX_COMPLETE;
else if(rx_bufsize == RX_BUFFER_SIZE)
usart_flags |= U_RX_COMPLETE | U_RX_OVERFL;
}else usart_flags |= U_RX_COMPLETE | U_RX_ERROR;
}
ISR(USART_UDRE_vect){
if(tx_bufsize == 0){
UCSR0B &= ~_BV(UDRIE0);
usart_flags |= U_TX_COMPLETE;
return;
}
UDR0 = tx_buffer[tx_idx++];
if(tx_idx == tx_bufsize){
tx_idx = 0;
tx_bufsize = 0;
UCSR0B &= ~_BV(UDRIE0);
usart_flags |= U_TX_COMPLETE;
}
}

52
uart.h Normal file
View File

@ -0,0 +1,52 @@
/*
* geany_encoding=koi8-r
* uart.h
*
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#pragma once
#ifndef __UART_H__
#define __UART_H__
#include <avr/io.h> // IO ports
#include <stdint.h> // int types
#define U_TX_COMPLETE (_BV(0))
#define U_RX_COMPLETE (_BV(1))
#define U_TX_ERROR (_BV(2))
#define U_RX_ERROR (_BV(3))
#define U_RX_OVERFL (_BV(4))
#define RX_BUFFER_SIZE (32)
#define TX_BUFFER_SIZE (32)
extern volatile uint8_t usart_flags;
extern char rx_buffer[];
extern volatile uint8_t rx_bufsize;
int usart_send(char *Str);
void print_long(int32_t Number);
void printUint(uint8_t *val, uint8_t len);
uint8_t readInt(char *buff, int16_t *val);
char *omit_whitespace(char *str);
#endif // __UART_H__

BIN
uart.o Normal file

Binary file not shown.