Add firmware for atmega8535 based driver of SCORPIO base platform module

This commit is contained in:
eddyem
2018-04-11 18:37:27 +03:00
parent 715da979f1
commit c975836b2c
24 changed files with 1760 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
### https://habrahabr.ru/post/247663/
NAME = scorpio
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
CC = avr-gcc
OPTIMIZE= -Os
DEFS = -DBAUD=9600
DEFS += -DEBUG
LIBS =
# controller
DEVICE = atmega8535
#Тактовая частота 8 МГц
CLOCK = 8000000
# partno (for avrdude)
PARTNO = m8535
CFLAGS = -g -Wall $(OPTIMIZE) $(DEFS)
LDFLAGS = -Wl,-Map,$(NAME).map
# programmer (for avrdude)
PROGRAMMER = avrisp
# serial port device (for avrdude)
SERPORT = /dev/ttyUSB0
SRC=$(wildcard *.c)
HEX = $(NAME).hex
ELF = $(NAME).elf
OBJECTS = $(SRC:%.c=%.o)
# avrdude command from arduino IDE
AVRDUDE = avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -p$(PARTNO) -c$(PROGRAMMER) -P$(SERPORT) -b19200 -D
COMPILE = $(CC) $(CFLAGS) -mmcu=$(DEVICE) -DF_CPU=$(CLOCK)
all: $(HEX) lst
$(ELF): $(OBJECTS)
@echo "ELF"
@$(COMPILE) $(LDFLAGS) -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

View File

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

View File

@@ -0,0 +1,93 @@
/*
* 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"
#ifdef EBUG
#define DBG(x) usart_send(x)
#else
#define DBG(x)
#endif
// #define () do{}while(0)
#if defined (__AVR_ATmega8535__)
// original MCU
#define STPRS_OFF() do{PORTD |= 0xfc; PORTC |= 0x0f;}while(0)
#define DDRAB DDRA
#define PORTAB PORTA
// 8535 have common irq register for all timers
#define TIMSK0 TIMSK
#define TIMSK1 TIMSK
#define UCSR0A UCSRA
#define UCSR0B UCSRB
#define UCSR0C UCSRC
#define UDRIE0 UDRIE
#define FE0 FE
#define UPE0 PE
#define DOR0 DOR
#define UDRIE0 UDRIE
#define UDR0 UDR
#define UBRR0H UBRRH
#define UBRR0L UBRRL
#define U2X0 U2X
#define UCSZ01 UCSZ1
#define UCSZ00 UCSZ0
#define RXEN0 RXEN
#define TXEN0 TXEN
#define RXCIE0 RXCIE
#define LED1_PIN (_BV(0))
#define LED2_PIN (_BV(1))
#define LED3_PIN (_BV(2))
#define FLAT_PIN (_BV(5))
#define NEON_PIN (_BV(6))
#define SHTR_PIN (_BV(7))
#else
// arduino devboard with stepper
#define STPRS_OFF() do{PORTD |= 0xfc; PORTC &= 0xf0;}while(0)
#define DDRAB DDRB
#define PORTAB PORTB
#define FLAT_PIN (_BV(0))
#define NEON_PIN (_BV(1))
#define SHTR_PIN (_BV(2))
#define LED1_PIN (_BV(3))
#define LED2_PIN (_BV(4))
#define LED3_PIN (_BV(5))
#endif
#define PORTAB_PINS (FLAT_PIN | NEON_PIN | SHTR_PIN | LED1_PIN | LED2_PIN | LED3_PIN)
#endif // __INCLUDES_H__

View File

@@ -0,0 +1,118 @@
/*
* 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"
/*
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() {
/** setup all other pins **/
STPRS_OFF(); // turn off steppers before configuring to output
DDRD = 0xfc; // steppers
DDRC = 0x0f; // steppers diagram
// 328p have no port A
PORTAB |= FLAT_PIN | NEON_PIN | SHTR_PIN; // turn all off
DDRAB = PORTAB_PINS;
/** USART config **/
// set baudrate (using macros from util/setbaud.h)
#if !defined (__AVR_ATmega8535__)
UBRR0H = UBRRH_VALUE;
UBRR0L = UBRRL_VALUE;
#if USE_2X
UCSR0A |= _BV(U2X0);
#else
UCSR0A &= ~(_BV(U2X0));
#endif
#else // __AVR_ATmega8535__
UCSRA &= ~(_BV(U2X0));
UBRRH = 0;
UBRRL = 51;
#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 8 and start the timer (2MHz*256 = 0.128ms period)
#if defined (__AVR_ATmega8535__)
//TCCR0 |= _BV(CS01) | _BV(CS00); // /64
TCCR0 |= _BV(CS01);
#else
//TCCR0B |= _BV(CS01) | _BV(CS00);
TCCR0B |= _BV(CS01);
#endif
TIMSK0 |= _BV(TOIE0);
stepper_setup();
sei(); // enable interrupts
wdt_enable(WDTO_2S); // start watchdog
usart_send("Scorpio platform ready\n");
while(1){
wdt_reset();
if(stepper_pulse) stepper_process();
if(usart_flags & U_RX_COMPLETE)
process_string();
}
return 0;
}
uint8_t LEDs[3] = {20,20,20}; // LEDs shining time
ISR(TIMER0_OVF_vect){
static uint8_t shi_counter = 0;/* tick_ctr = 0;
TCNT0 += 6; // 0.125ms period
if(++tick_ctr == 8){
tick_ctr = 0;
if(++Milliseconds == 1000){
Milliseconds = 0;
if(++Seconds == 86400){
Seconds = 0;
++days;
}
}
}*/
if(shi_counter == 0){ // turn all LEDs on
PORTAB |= LED1_PIN | LED2_PIN | LED3_PIN;
}
// now check which LEDs we need to turn off
if(shi_counter == LEDs[0]) PORTAB &= ~LED1_PIN;
if(shi_counter == LEDs[1]) PORTAB &= ~LED2_PIN;
if(shi_counter == LEDs[2]) PORTAB &= ~LED3_PIN;
++shi_counter;
// #if defined (__AVR_ATmega8535__)
// TCNT0 += 128;
// #endif
}

View File

@@ -0,0 +1,169 @@
/*
* 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;
#ifdef EBUG
usart_send("Move motor ");
printUint((uint8_t*)&N, 1);
usart_send(" for ");
print_long((uint32_t)steps);
usart_send("steps\n");
#endif
if(steps) return stepper_move(N, steps);
else{ // steps == 0 - just check endswitches
stepper_get_esw(N);
return 0;
}
}
/**
* Switch relay on/off depending on cmd value
* 1 - on, 0 - off
* @param pin - pin to change
* @param N - second symbol of command ([2 N ...])
*/
uint8_t relay(char *cmd, uint8_t pin, char N){
if(*cmd == '-'){ // just check
char ans[] = "[2 N St=1]\n";
ans[3] = N;
if(PORTAB & pin) ans[8] = '0'; // off
usart_send(ans);
return 1;
}
if(*cmd == '0'){ // turn OFF
PORTAB |= pin;
return 1;
}
if(*cmd == '1'){ // turn ON
PORTAB &= ~pin;
return 1;
}
return 0;
}
//extern void print_time();
extern uint8_t LEDs[3]; // LEDs shining time
void LEDshine(char *cmd, uint8_t N){
int16_t s;
if(!readInt(cmd, &s)) return;
if(s < 0 || s > 255) return;
LEDs[N] = (uint8_t)s;
}
/**
* process commands from user buffer
* @return 1 if all OK
*/
uint8_t process_commands(char *cmd){
cmd = omit_whitespace(cmd + 1);
if(*cmd > '0' && *cmd < '7')
return move_motor(cmd);
char s = *cmd;
cmd = omit_whitespace(cmd + 1);
switch(s){
case '0': // stop motors
DBG("restart");
stop_motors();
break;
case '7':
DBG("Shutter");
relay(cmd, SHTR_PIN, '7');
break;
case '8':
DBG("Neon");
relay(cmd, NEON_PIN, '8');
break;
case '9':
DBG("Flat");
relay(cmd, FLAT_PIN, '9');
break;
case 'a':
return stepper_ch_speed(cmd);
break;
case 'b':
DBG("LED1");
LEDshine(cmd, 0);
break;
case 'c':
DBG("LED2");
LEDshine(cmd, 1);
break;
case 'd':
DBG("LED3");
LEDshine(cmd, 2);
break;
default:
return 0;
}
DBG("\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){
DBG("Input buffer overflow\n");
noerr = 0;
}
if(oldflags & U_RX_ERROR){
DBG("Rx error\n");
noerr = 0;
}
if(rx_bufsize < 3 || rx_buffer[0] != '[' || rx_buffer[rx_bufsize - 2] != ']'){
#ifdef EBUG
usart_send(rx_buffer);
#endif
if(!chk_stpr_cmd(rx_buffer[0])){
DBG("Enter \"[cmd]\"\n");
}
//if(rx_buffer[0] == 't'){ print_time(); return; }
rx_bufsize = 0;
noerr = 0;
}
if(noerr){ // echo back given string
rx_buffer[rx_bufsize] = 0;
char *cmd = omit_whitespace(&rx_buffer[1]);
if(*cmd != '2') return;
uint8_t rbs = rx_bufsize;
rx_bufsize = 0;
usart_send(rx_buffer);
rx_buffer[rbs - 2] = 0;
process_commands(cmd);
}
}

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__

View File

@@ -0,0 +1,501 @@
# 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
DBGÌ131072Í(x)Ö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
DDRABÌ65536Ö0
EBUGÌ65536Ö0
EMPTY_INTERRUPTÌ131072Í(vector)Ö0
FLAT_PINÌ65536Ö0
FUSEMEMÌ65536Ö0
FUSESÌ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
LED1_PINÌ65536Ö0
LED2_PINÌ65536Ö0
LED3_PINÌ65536Ö0
LEDsÌ16384Ö0Ïuint8_t
LEDsÌ32768Ö0Ïuint8_t
LEDshineÌ16Í(char *cmd, uint8_t N)Ö0Ïvoid
LOCKBITSÌ65536Ö0
LOCKBITS_DEFAULTÌ65536Ö0
LOCKMEMÌ65536Ö0
NEON_PINÌ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
PORTABÌ65536Ö0
PORTAB_PINSÌ65536Ö0
RX_BUFFER_SIZEÌ65536Ö0
SHTR_PINÌ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
STPRS_OFFÌ131072Í()Ö0
Steps_leftÌ16384Ö0Ïuint16_t
Steps_leftÌ32768Ö0Ïuint16_t
TIMER0_OVF_vectÌ16Í(void)Ö0Ïvoid
TIMER0_OVF_vectÌ1024Í(void)Ö0ÏÓ void
TIMER1_COMPA_vectÌ16Í(void)Ö0Ïvoid
TIMER1_COMPA_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
UstepÌ16384Ö0Ïint8_t
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
_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
__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
__INCLUDES_H__Ì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
__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
__STEPPER_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
bit_is_clearÌ131072Í(sfr,bit)Ö0
bit_is_setÌ131072Í(sfr,bit)Ö0
check_endswÌ16Í()Ö0Ïuint8_t
cliÌ131072Í()Ö0
cur_motorÌ16384Ö0Ïuint8_t
directionÌ16384Ö0Ïuint8_t
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
linuxÌ65536Ö0
loop_until_bit_is_clearÌ131072Í(sfr,bit)Ö0
loop_until_bit_is_setÌ131072Í(sfr,bit)Ö0
mainÌ16Í()Ö0Ïint
move_motorÌ16Í(char *cmd)Ö0Ïuint8_t
omit_whitespaceÌ16Í(char *str)Ö0Ïchar *
omit_whitespaceÌ1024Í(char *str)Ö0Ïchar *
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
process_commandsÌ16Í(char *cmd)Ö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
relayÌ16Í(char *cmd, uint8_t pin, char N)Ö0Ïuint8_t
retiÌ131072Í()Ö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
stepper_ch_speedÌ16Í(char *spd)Ö0Ïuint8_t
stepper_ch_speedÌ1024Í(char *spd)Ö0Ïuint8_t
stepper_get_eswÌ16Í(uint8_t Nmotor)Ö0Ïvoid
stepper_get_eswÌ1024Í(uint8_t Nmotor)Ö0Ïvoid
stepper_moveÌ16Í(uint8_t Nmotor, int16_t Nsteps)Ö0Ïuint8_t
stepper_moveÌ1024Í(uint8_t Nmotor, int16_t Nsteps)Ö0Ïuint8_t
stepper_processÌ16Í()Ö0Ïvoid
stepper_processÌ1024Í()Ö0Ïvoid
stepper_pulseÌ16384Ö0Ïvolatile uint8_t
stepper_pulseÌ32768Ö0Ïvolatile uint8_t
stepper_setupÌ16Í()Ö0Ïvoid
stepper_setupÌ1024Í()Ö0Ïvoid
stop_motorsÌ16Í()Ö0Ïvoid
stop_motorsÌ1024Í()Ö0Ïvoid
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
ustepsÌ16384Ö0Ïconst uint8_t
wdt_disableÌ131072Í()Ö0
wdt_enableÌ131072Í(value)Ö0
wdt_resetÌ131072Í()Ö0

View File

@@ -0,0 +1,192 @@
:1000000014C02EC02DC02CC02BC02AC041C328C094
:1000100027C04DC325C084C1B6C122C021C020C0A5
:100020001FC01EC01DC01CC01BC011241FBECFE5B9
:10003000D2E0DEBFCDBF11E0A0E6B0E0E0EEFAE036
:1000400002C005900D92AC36B107D9F721E0ACE6BD
:10005000B1E001C01D92A73BB207E1F7A1D43EC5B4
:10006000CFCF2091600020FFFCCF209160002A7F3D
:100070002093600010926C0110926D01DC01809160
:100080006D01803278F48D91882361F0E0916D01EB
:10009000F0E0E159FE4F808380916D018F5F809386
:1000A0006D01EDCF80916D01803251F410926D01A0
:1000B0008091600081608093600081E090E008950D
:1000C000559A80E090E008958F929F92AF92BF92F0
:1000D000DF92EF92FF920F931F93CF93DF93CDB7F1
:1000E000DEB72C970FB6F894DEBF0FBECDBF1C86CF
:1000F00097FF0AC090958095709561957F4F8F4FBF
:100100009F4FDD24D39401C0D12C0BE03AE0832E25
:10011000912CA12CB12C1FEF100FEE24E394F12CA5
:10012000EC0EFD1EE10EF11CA5019401A5D4605D4D
:10013000F7016083B901CA01611571058105910557
:1001400021F0012F1111E7CF0EC0112361F0DD2046
:1001500051F01EEF100FE1E0F0E0EC0FFD1FE10F9A
:10016000F11D8DE2808381E090E08C0F9D1F810F57
:10017000911D77DF2C960FB6F894DEBF0FBECDBF72
:10018000DF91CF911F910F91FF90EF90DF90BF9083
:10019000AF909F908F9008958F929F92AF92BF9251
:1001A000CF92DF92FF920F931F93CF93DF93CDB740
:1001B000DEB72B970FB6F894DEBF0FBECDBFDC01C4
:1001C000633009F448C08FEF860F843008F043C0D5
:1001D000FE013196CE010C968F0111928E179F076A
:1001E000E1F7623039F0643051F0613069F46C91BC
:1001F00070E002C06D917C9180E090E008C06D914C
:100200007D918D919C9103C060E070E0CB016E0107
:100210002BE0C20ED11C29E0F22E3AE0832E912C65
:10022000A12CB12CFA94A501940104D4605DF601CF
:1002300062936F01B901CA016115710581059105CC
:1002400019F0FFEFFF12EECF8F2DFF0C990B0196E7
:10025000800F911F06DF2B960FB6F894DEBF0FBEFE
:10026000CDBFDF91CF911F910F91FF90DF90CF9085
:10027000BF90AF909F908F900895FC012081203215
:1002800011F40196FACF37EF320F3230D0F32D3020
:10029000C1F308950F931F93CF93DF93EB01FC01FC
:1002A00020812D3219F4019611E001C010E0FC010B
:1002B00020E030E0A90181E0019190ED900F9A30AB
:1002C000B8F4AAE0B0E0F4D3DC01CB01800F911DBB
:1002D000A11DB11D9C01AD012053310941095109F6
:1002E00080E0211590E83907410551052CF310C035
:1002F00081110EC0112339F050954095309521950C
:100300003F4F4F4F5F4F209729F03983288302C01A
:1003100080E001C081E0DF91CF911F910F9108959E
:100320001F920F920FB60F9211248F939F93EF930A
:10033000FF939CB18BB18C71C1F4E0916E0181E0AF
:100340008E0F80936E01F0E0EC56FE4F90839A3052
:1003500021F48091600082600BC080916E01803238
:1003600049F480916000826103C0809160008A60DE
:1003700080936000FF91EF919F918F910F900FBE3E
:100380000F901F9018951F920F920FB60F92112485
:100390008F939F93EF93FF9380916D018823A9F032
:1003A000E0916C0181E08E0F80936C01F0E0E159E7
:1003B000FE4F80818CB990916C0180916D019813F2
:1003C0000AC010926C0110926D01559880916000E6
:1003D000816080936000FF91EF919F918F910F90CA
:1003E0000FBE0F901F90189583B384FF04C085FF44
:1003F00004C080E0089581E0089582E008958EB5FC
:1004000088608EBD80ED97E09BBD8ABD8EB5826011
:100410008EBD89B7806189BF85B3806385BB089530
:10042000CF93DF9300D000D0CDB7DEB7BE016D5FB4
:100430007F4F30DF882351F16B817C81683F8FEFE4
:1004400078070CF16F3F8FE77807E9F0665F7F4F21
:100450008FEF9FEFDBD27A83698389B78F7E89BF65
:1004600089819A819BBD8ABD1DBC1CBC89B78061F6
:1004700089BF86EA90E0F5DD62E0CE0101968CDE70
:1004800089E691E002C088EB90E0EBDD80E00F9020
:100490000F900F900F90DF91CF910895CF93DF933E
:1004A000CDB7DEB72C970FB6F894DEBF0FBECDBF29
:1004B0009FEF980F973010F592B39C6F92BB92B359
:1004C00022E030E0082E01C0220F0A94EAF72095BE
:1004D000292322BB9CE0E9ECF0E0DE0111960190BB
:1004E0000D929A95E1F7805D8C837EDF811101C0CA
:1004F00083E0805D8987CE010196B3DD2C960FB62F
:10050000F894DEBF0FBECDBFDF91CF9108958091EB
:100510009001C4DF82B38C6F82BB85B38F6085BBD3
:1005200089B78F7E89BF10928F011092B601109209
:10053000B501109292011092900108951F93CF93EC
:10054000DF93182FEB018FEF810F863008F040C04A
:100550002097F1F18091B5019091B601892BC1F5F9
:1005600089B78F7E89BF82B38C6F82BB85B38F6062
:1005700085BB22B382E090E0012E01C0880F0A946F
:10058000EAF78095822382BB2FDF109390018823A6
:1005900079F0813021F41C161D0664F018C0D7FFD5
:1005A00016C0D195C195D10981E08093910104C015
:1005B000D7FDF7CF10929101D093B601C093B5014A
:1005C0001DBC1CBC89B7806189BF81E002C09FDF70
:1005D00080E0DF91CF911F91089510928F0185B334
:1005E00090919201E0916100F0916200E90FF11D9C
:1005F00097FDFA95807F9081892B85BBF5DE209150
:100600009101909192012223B1F0915097FD03C086
:10061000909392010DC097E0909392012091B501C3
:100620003091B601215031093093B6012093B501C4
:100630008130A9F46CCF9F5F98301CF490939201A5
:100640000CC0109292012091B5013091B601215059
:1006500031093093B6012093B501823059F380916E
:10066000B5019091B601892B29F308959FE9980F60
:10067000983060F428E08202C0011124825A92402E
:10068000909362008093610081E0089580E0089576
:100690001F920F920FB60F9211248F9381E08093D7
:1006A0008F018F910F900FBE0F901F9018951F9282
:1006B0000F920FB60F9211248F939F938091930105
:1006C000811103C08BB387608BBB909163008091D5
:1006D0009301981301C0D898909164008091930180
:1006E000981301C0D9989091650080919301981357
:1006F00001C0DA98809193018F5F809393019F915D
:100700008F910F900FBE0F901F901895CF93DF938E
:1007100000D01F92CDB7DEB7FC01908180ED890F2C
:100720008B839153963030F5CF010196A6DDBE0143
:100730006F5F7F4FAFDD8823E9F08DEE90E091DCB5
:1007400061E0CE01039628DD89EF90E08ADC6981C3
:100750007A81072E000C880B990BB6DC8FEF90E0A6
:1007600080DC69817A818B816115710511F0E6DE8B
:1007700002C094DE80E00F900F900F90DF91CF9138
:100780000895CF93DF93CDB7DEB72C970FB6F894CB
:10079000DEBF0FBECDBFFC0180818D3299F48CE0AD
:1007A000E6E0F1E0DE01119601900D928A95E1F705
:1007B0004C838BB3682311F080E38987CE010196C7
:1007C00050DC0BC0803319F48BB3682B05C0813328
:1007D00031F48BB3609568236BBB81E001C080E08E
:1007E0002C960FB6F894DEBF0FBECDBFDF91CF9130
:1007F00008951F93CF93DF9300D0CDB7DEB7162FA8
:10080000BE016F5F7F4F46DD882359F089819A8151
:100810008F3F910509F028F4E12FF0E0ED59FF4FEB
:1008200080830F900F90DF91CF911F9108950F93C8
:100830001F93CF93019621DDFC01C0812FEC2C0F7B
:10084000263020F4CF911F910F9160CF019615DDD6
:100850008C01C93359F154F4C733D1F0FCF4C033DF
:10086000D9F582E191E0FDDB52DE31C0C23621F1E3
:1008700034F4C13689F5CF911F910F91D1CDC33694
:1008800001F1C43649F586E391E0EBDB62E01DC07F
:100890008AE191E0E6DB47E360E805C082E291E0AF
:1008A000E0DB48E360E4C8016CDF11C087E291E05F
:1008B000D8DB49E360E2F7CF8CE291E0D2DB60E085
:1008C00004C081E391E0CDDB61E0C80192DF89E6FD
:1008D00091E0C7DB81E001C080E0CF911F910F91D3
:1008E00008950F931F93CF938091600081FF54C0B0
:1008F000C091600080916000857E80936000C4FF9D
:1009000005C08BE391E0ADDB80E001C081E0C3FF77
:1009100004C082E591E0A5DB80E090916E01933008
:1009200060F0909194019B3541F4E0916E01F0E00C
:10093000EE56FE4F90819D3571F084E991E091DB98
:100940008091940193DE811103C08CE591E089DBF5
:1009500010926E0121C08823F9F0E0916E01F0E061
:10096000EC56FE4F108285E991E087DC8C01FC019A
:100970008081823389F4C0916E0110926E0184E906
:1009800091E06FDBEC2FF0E0EE56FE4F1082C801D5
:10099000CF911F910F914BCFCF911F910F91089540
:1009A00082B38C6F82BB85B38F6085BB8CEF81BBBC
:1009B000CFE0C4BB8BB3806E8BBB87EE8ABB5998EC
:1009C0008FE780BD81E089B986E080BD88E98AB97A
:1009D00083B7826083BF89B7816089BF10DD789457
:1009E00088E190E00FB6F894A89581BD0FBEC1BD17
:1009F00085ED90E036DBA89580918F018111EDDDCA
:100A00008091600081FFF7CF6CDFF5CFAA1BBB1B85
:100A100051E107C0AA1FBB1FA617B70710F0A61BFE
:100A2000B70B881F991F5A95A9F780959095BC011F
:100A3000CD010895A1E21A2EAA1BBB1BFD010DC01A
:100A4000AA1FBB1FEE1FFF1FA217B307E407F5077E
:100A500020F0A21BB30BE40BF50B661F771F881F5A
:100A6000991F1A9469F760957095809590959B01F0
:100A7000AC01BD01CF010895052E97FB16F400943B
:100A80000FD057FD05D0D6DF07FC02D046F408C0D2
:100A900050954095309521953F4F4F4F5F4F0895AA
:100AA00090958095709561957F4F8F4F9F4F0895DA
:100AB00009D0A59F900DB49F900DA49F800D911D0E
:100AC00011240895A29FB001B39FC001A39F01D03C
:100AD000B29F700D811D1124911D0895F894FFCFD0
:100AE000016600141414080C04060203010902062E
:100AF000040C08090103080901030206040C080A92
:100B000002060405010907030B090D0C0E060D0969
:100B10000B0307060E0C07060E0C0D090B03070549
:100B20000D090B0A0E065370656564206368616EDB
:100B300067656420746F200042616420737065658E
:100B4000642076616C75650A005B32203020537436
:100B50003D305D0A0053636F7270696F20706C6185
:100B600074666F726D2072656164790A004D6F76EC
:100B700065206D6F746F72200020666F72200073A5
:100B8000746570730A005B32204E2053743D315DF2
:100B90000A007265737461727400536875747465C9
:100BA00072004E656F6E00466C6174004C454431B6
:100BB000004C454432004C45443300496E70757416
:100BC00020627566666572206F766572666C6F77F7
:100BD0000A005278206572726F720A00456E746561
:0C0BE0007220225B636D645D220A00003D
:00000001FF

View File

@@ -0,0 +1,233 @@
/*
* 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"
/*
* Half-step mode:
* D |----|----| | | | | |----|
* D | | |----|----|----|----|----| |
* C | |----|----|----| | | | |
* C |----| | | |----|----|----|----|
* B | | | |----|----|----| | |
* B |----|----|----| | | |----|----|
* A | | | | | |----|----|----|
* A |----|----|----|----|----| | | |
*
* In full-step mode pulse rises sequentally: D->C->B->A
* 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
*/
// winding1: [13], winding2: [24]
// microsteps: [1234] = 1000, 1100, 0100, 0110, 0010, 0011, 0001, 1001 -- for ULN
// [1324] = 1000, 1010, 0010, 0110, 0100, 0101, 0001, 1001 - 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, active 1
//static const uint8_t usteps[8] = {7, 3, 11, 9, 13, 12, 14, 6}; // unipolar, active is 0
static const uint8_t usteps_matrix[8][8] = {
{0b1000, 0b1100, 0b0100, 0b0110, 0b0010, 0b0011, 0b0001, 0b1001}, // [1234]
{0b0010, 0b0110, 0b0100, 0b1100, 0b1000, 0b1001, 0b0001, 0b0011}, // [3214]
{0b1000, 0b1001, 0b0001, 0b0011, 0b0010, 0b0110, 0b0100, 0b1100}, // [1432]
{0b1000, 0b1010, 0b0010, 0b0110, 0b0100, 0b0101, 0b0001, 0b1001}, // [1324]
// inversion: cat | sed -e 's/0b/x/g' -e 's/0/y/g' -e 's/1/0/g' -e 's/y/1/g' -e s'/x/0b/g'
{0b0111, 0b0011, 0b1011, 0b1001, 0b1101, 0b1100, 0b1110, 0b0110}, // [1234]
{0b1101, 0b1001, 0b1011, 0b0011, 0b0111, 0b0110, 0b1110, 0b1100}, // [3214]
{0b0111, 0b0110, 0b1110, 0b1100, 0b1101, 0b1001, 0b1011, 0b0011}, // [1432]
{0b0111, 0b0101, 0b1101, 0b1001, 0b1011, 0b1010, 0b1110, 0b0110}, // [1324]
};
uint8_t const *usteps = usteps_matrix[0];
static int8_t Ustep = 0; // current microstep count
uint16_t Steps_left; // steps left to proceed (absolute value)
static uint8_t direction = 0; // ==1 if rotate CCW
static uint8_t cur_motor = 0; // current motor number
volatile uint8_t stepper_pulse = 0; // interrupt flag, used in main.c
void stepper_setup(){
TCCR1B |= _BV(WGM12); // configure timer1 for CTC mode, TOP is OCR1A
OCR1A = 2000; // set the CTC compare value - 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
PORTC |= _BV(4) | _BV(5); // enable pullup
}
/**
* Change TIM1 speed
* Period = 4 * 65535/(spd + 10) microseconds
*/
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);
#ifdef EBUG
usart_send("Speed changed to ");
printUint((uint8_t*)&O, 2);
usart_send("\n");
#endif
}else DBG("Bad speed value\n");
}
return 0;
}
/**
* Check endswitches
* @return 0 if none pressed, 1 if "-", 2 if "+"
*/
static uint8_t check_endsw(){
// PC4 - "-", PC5 - "+"
uint8_t pc = PINC;
if(0 == (pc & _BV(4))) return 1;
if(0 == (pc & _BV(5))) return 2;
return 0;
}
/**
* move stepper number Nmotor by Nsteps steps
* @return 1 if all OK, 0 if error occured
*/
uint8_t stepper_move(uint8_t Nmotor, int16_t Nsteps){
if(!Nmotor || Nmotor > 6 || !Nsteps || Steps_left) return 0;
TIMSK1 &= ~_BV(OCIE1A); // disable timer interrupt
// turn all OFF
STPRS_OFF();
// turn on the motor we need
PORTD &= ~(2 << Nmotor);
uint8_t c = check_endsw();
cur_motor = Nmotor;
if(c){
if(c == 1){if(Nsteps > 0) c = 0;}
else if(Nsteps < 0) c = 0;
}
if(c){
stop_motors();
return 0; // already at end-switch in given direction
}
if(Nsteps < 0){ // CCW
Nsteps = -Nsteps;
direction = 1;
}else direction = 0; // CW
Steps_left = Nsteps;
TCNT1 = 0; // reset counter
TIMSK1 |= _BV(OCIE1A);
return 1;
}
void stop_motors(){
stepper_get_esw(cur_motor);
// turn off all pulses to place motor in free state & prevent undesirable behaviour
STPRS_OFF();
TIMSK1 &= ~_BV(OCIE1A); // disable timer interrupt
stepper_pulse = 0;
Steps_left = 0;
Ustep = 0;
cur_motor = 0;
}
/**
* process stepper pulses generation @ timer event
*/
void stepper_process(){
stepper_pulse = 0;
uint8_t port = PORTC & 0xf0; // save old port state & clear clocking
PORTC = port | usteps[Ustep];
uint8_t sw = check_endsw(); // 1 - "-", 2 - "+", 0 - none
if(direction){ // CCW
if(--Ustep < 0){
Ustep = 7;
--Steps_left;
}
if(sw == 1){
stop_motors();
return;
}
}else{ // CW
if(++Ustep > 7){
Ustep = 0;
--Steps_left;
}
if(sw == 2){
stop_motors();
return;
}
}
if(Steps_left == 0) stop_motors();
}
/**
* get end-switches state for all motors or only Nth
* @param Nmotor - number of given motor
*/
void stepper_get_esw(uint8_t Nmotor){
if(Nmotor == 0 || Nmotor > 7) return; // no running motor
PORTD |= 0xfc;
PORTD &= ~(2 << Nmotor); // [2 1 St=2]
char str[] = "[2 0 St=0]\n"; // 3 - motor number, 5 - endswitch (3 if none)
str[3] = Nmotor + '0';
uint8_t sw = check_endsw();
if(sw == 0) sw = 3;
str[8] = sw + '0';
usart_send(str);
}
/**
* User can change current stepper phases table
* N - position in table from 'a' (0) to 'h' (7)
* return 1 if all OK
*/
uint8_t chk_stpr_cmd(char N){
if(N < 'a' || N > 'h') return 0;
usteps = usteps_matrix[N-'a'];
return 1;
}
/**
* Timer 1 used to generate stepper pulses
*/
ISR(TIMER1_COMPA_vect){
stepper_pulse = 1; // say that we can generate next microstep
}

View File

@@ -0,0 +1,44 @@
/*
* 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 volatile uint8_t stepper_pulse;
extern uint16_t Steps_left;
// 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);
void stop_motors();
void stepper_get_esw(uint8_t Nmotor);
uint8_t chk_stpr_cmd(char N);
#endif // __STEPPER_H__

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;
}
}

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__