mirror of
https://github.com/eddyem/STM8_samples.git
synced 2025-12-06 02:35:21 +03:00
copy
This commit is contained in:
commit
7919850a6d
34
Noice_generator/Makefile
Normal file
34
Noice_generator/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
|
||||
CCFLAGS=-DSTM8S105 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -mstm8 --out-fmt-ihx -lstm8
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s105
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h ports_definition.h Makefile
|
||||
|
||||
all: $(NAME).ihx
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).ihx
|
||||
stm8flash $(FLASHFLAGS) -w $(NAME).ihx
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
.PHONY: all
|
||||
1
Noice_generator/README
Normal file
1
Noice_generator/README
Normal file
@ -0,0 +1 @@
|
||||
This is a table-based generator of simplest waveforms
|
||||
181
Noice_generator/interrupts.c
Normal file
181
Noice_generator/interrupts.c
Normal file
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
#include "noicegen.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){
|
||||
|
||||
}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){
|
||||
|
||||
}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){
|
||||
|
||||
}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){
|
||||
|
||||
}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
static U8 bank_i = 0;
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){ // generate pulses for stepper CLK
|
||||
if(TIM2_SR1 & TIM_SR1_UIF){
|
||||
change_CCR(current_bank[bank_i]);
|
||||
if(++bank_i == 16) bank_i = 0;
|
||||
TIM2_SR1 &= ~TIM_SR1_UIF;
|
||||
}
|
||||
}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){
|
||||
|
||||
}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){
|
||||
U8 rb;
|
||||
if(UART2_SR & UART_SR_RXNE){ // data received
|
||||
rb = UART2_DR; // read received byte & clear RXNE flag
|
||||
while(!(UART2_SR & UART_SR_TXE));
|
||||
UART_send_byte(rb); // echo received symbol
|
||||
UART_rx[UART_rx_cur_i++] = rb; // put received byte into cycled buffer
|
||||
if(UART_rx_cur_i == UART_rx_start_i){ // Oops: buffer overflow! Just forget old data
|
||||
UART_rx_start_i++;
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
}
|
||||
check_UART_pointer(UART_rx_cur_i);
|
||||
}
|
||||
}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){
|
||||
if(TIM4_SR & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM4_SR = 0; // clear all interrupt flags
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
144
Noice_generator/interrupts.h
Normal file
144
Noice_generator/interrupts.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
291
Noice_generator/main.c
Normal file
291
Noice_generator/main.c
Normal file
@ -0,0 +1,291 @@
|
||||
/*
|
||||
* blinky.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "ports_definition.h"
|
||||
#include "interrupts.h"
|
||||
#include "main.h"
|
||||
#include "noicegen.h"
|
||||
|
||||
/*
|
||||
* 0 0000
|
||||
* 1 0001
|
||||
* 2 0010
|
||||
* 3 0011
|
||||
* 4 0100
|
||||
* 5 0101
|
||||
* 6 0110
|
||||
* 7 0111
|
||||
* 8 1000
|
||||
* 9 1001
|
||||
* a 1010
|
||||
* b 1011
|
||||
* c 1100
|
||||
* d 1101
|
||||
* e 1110
|
||||
* f 1111
|
||||
*/
|
||||
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
U16 paused_val = 500; // interval between LED flashing
|
||||
|
||||
U8 UART_rx[UART_BUF_LEN]; // cycle buffer for received data
|
||||
U8 UART_rx_start_i = 0; // started index of received data (from which reading starts)
|
||||
U8 UART_rx_cur_i = 0; // index of current first byte in rx array (to which data will be written)
|
||||
U8 UART_is_our = 0; // ==1 if we get UART
|
||||
// ATTENTION! to change global variable in PROGRAM memory, it should be CONST!!!
|
||||
const U8 UART_devNUM = THIS_DEVICE_NUM; // device number, master sais it
|
||||
|
||||
/**
|
||||
* Send one byte through UART
|
||||
* @param byte - data to send
|
||||
*/
|
||||
void UART_send_byte(U8 byte){
|
||||
UART2_DR = byte;
|
||||
while(!(UART2_SR & UART_SR_TC));
|
||||
}
|
||||
|
||||
void uart_write(char *str){
|
||||
while(*str){
|
||||
UART2_DR = *str++;
|
||||
while(!(UART2_SR & UART_SR_TC));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read one byte from Rx buffer
|
||||
* @param byte - where to store readed data
|
||||
* @return 1 in case of non-empty buffer
|
||||
*/
|
||||
U8 UART_read_byte(U8 *byte){
|
||||
if(UART_rx_start_i == UART_rx_cur_i) // buffer is empty
|
||||
return 0;
|
||||
*byte = UART_rx[UART_rx_start_i++];
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void printUint(U8 *val, U8 len){
|
||||
unsigned long Number = 0;
|
||||
U8 i = len;
|
||||
char ch;
|
||||
U8 decimal_buff[12]; // max len of U32 == 10 + \n + \0
|
||||
if(len > 4 || len == 3 || len == 0) return;
|
||||
for(i = 0; i < 12; i++)
|
||||
decimal_buff[i] = 0;
|
||||
decimal_buff[10] = '\n';
|
||||
ch = 9;
|
||||
switch(len){
|
||||
case 1:
|
||||
Number = *((U8*)val);
|
||||
break;
|
||||
case 2:
|
||||
Number = *((U16*)val);
|
||||
break;
|
||||
case 4:
|
||||
Number = *((unsigned long*)val);
|
||||
break;
|
||||
}
|
||||
do{
|
||||
i = Number % 10L;
|
||||
decimal_buff[ch--] = i + '0';
|
||||
Number /= 10L;
|
||||
}while(Number && ch > -1);
|
||||
uart_write((char*)&decimal_buff[ch+1]);
|
||||
}
|
||||
|
||||
U8 readInt(int *val){
|
||||
unsigned long T = Global_time;
|
||||
unsigned long R = 0;
|
||||
int readed;
|
||||
U8 sign = 0, rb, ret = 0, bad = 0;
|
||||
do{
|
||||
if(!UART_read_byte(&rb)) continue;
|
||||
if(rb == '-' && R == 0){ // negative number
|
||||
sign = 1;
|
||||
continue;
|
||||
}
|
||||
if(rb < '0' || rb > '9') break; // number ends with any non-digit symbol that will be omitted
|
||||
ret = 1; // there's at least one digit
|
||||
R = R * 10L + rb - '0';
|
||||
if(R > 0x7fff){ // bad value
|
||||
R = 0;
|
||||
bad = 0;
|
||||
}
|
||||
}while(Global_time - T < 10000); // wait no longer than 10s
|
||||
if(bad || !ret) return 0;
|
||||
readed = (int) R;
|
||||
if(sign) readed *= -1;
|
||||
*val = readed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void error_msg(char *msg){
|
||||
uart_write("\nERROR: ");
|
||||
uart_write(msg);
|
||||
UART_send_byte('\n');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change variable stored in program memory
|
||||
* !!! You can change only const values (non-constants are initializes on program start)
|
||||
* @param addr - variable address
|
||||
* @param new value
|
||||
* @return 0 in case of error
|
||||
*
|
||||
U8 change_progmem_value(U8 *addr, U8 val){
|
||||
// unlock memory
|
||||
FLASH_PUKR = EEPROM_KEY2;
|
||||
FLASH_PUKR = EEPROM_KEY1;
|
||||
// check bit PUL=1 in FLASH_IAPSR
|
||||
if(!FLASH_IAPSR & 0x02)
|
||||
return 0;
|
||||
*addr = val;
|
||||
// clear PUL to lock write
|
||||
FLASH_IAPSR &= ~0x02;
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
U8 change_eeprom_value(U8 *addr, U8 val){
|
||||
// unlock memory
|
||||
FLASH_DUKR = EEPROM_KEY1;
|
||||
FLASH_DUKR = EEPROM_KEY2;
|
||||
// check bit DUL=1 in FLASH_IAPSR
|
||||
if(!FLASH_IAPSR & 0x08)
|
||||
return 0;
|
||||
*addr = val;
|
||||
// clear DUL to lock write
|
||||
FLASH_IAPSR &= ~0x08;
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int main() {
|
||||
unsigned long T = 0L;
|
||||
int Ival;
|
||||
U8 rb;
|
||||
|
||||
CFG_GCR |= 1; // disable SWIM
|
||||
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
|
||||
// Timer 4 (8 bit) used as system tick timer
|
||||
// prescaler == 128 (2^7), Tfreq = 125kHz
|
||||
// period = 1ms, so ARR = 125
|
||||
TIM4_PSCR = 7;
|
||||
TIM4_ARR = 125;
|
||||
// interrupts: update
|
||||
TIM4_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM4_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
|
||||
// Configure pins
|
||||
// PC2 - PP output (on-board LED)
|
||||
PORT(LED_PORT, DDR) |= LED_PIN;
|
||||
PORT(LED_PORT, CR1) |= LED_PIN;
|
||||
// PD5 - UART2_TX -- pseudo open-drain output; don't forget an pullup resistor!
|
||||
PORT(UART_PORT, DDR) |= UART_TX_PIN;
|
||||
PORT(UART_PORT, ODR) &= ~UART_TX_PIN; // turn off N push-down
|
||||
//PORT(UART_PORT, CR1) |= UART_TX_PIN;
|
||||
PC_DDR |= GPIO_PIN1; // setup timer's output
|
||||
PC_ODR &= ~GPIO_PIN1;
|
||||
|
||||
// Configure UART
|
||||
// 9 bit, no parity, 1 stop (UART_CR3 = 0 - reset value)
|
||||
// 57600 on 16MHz: BRR1=0x11, BRR2=0x06
|
||||
UART2_BRR1 = 0x11; UART2_BRR2 = 0x06;
|
||||
UART2_CR2 = UART_CR2_TEN | UART_CR2_REN | UART_CR2_RIEN; // Allow RX/TX, generate ints on rx
|
||||
|
||||
configure_timers();
|
||||
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
|
||||
// Loop
|
||||
do{
|
||||
if((Global_time - T > paused_val) || (T > Global_time)){
|
||||
T = Global_time;
|
||||
PORT(LED_PORT, ODR) ^= LED_PIN; // blink on-board LED
|
||||
}
|
||||
if(UART_read_byte(&rb)){ // buffer isn't empty
|
||||
switch(rb){
|
||||
case 'h': // help
|
||||
case 'H':
|
||||
uart_write("\nPROTO:\n"
|
||||
"+/-\tLED period\n"
|
||||
"P/p\tStart/stop playing\n"
|
||||
"F\tSet frequency\n"
|
||||
"t\tsawtooth\n"
|
||||
"s\tsine\n"
|
||||
"e\texp\n"
|
||||
"l\tlog\n"
|
||||
"r\trand\n"
|
||||
);
|
||||
break;
|
||||
break;
|
||||
case '+':
|
||||
paused_val += 100;
|
||||
if(paused_val > 10000)
|
||||
paused_val = 500; // but not more than 10s
|
||||
break;
|
||||
case '-':
|
||||
paused_val -= 100;
|
||||
if(paused_val < 100) // but not less than 0.1s
|
||||
paused_val = 500;
|
||||
break;
|
||||
case 'F':
|
||||
if(readInt(&Ival) && Ival > 64){
|
||||
change_period(((U16)Ival) >> 4); // F*4 for 16 array values
|
||||
//change_period((U16)Ival); // F*4 for 16 array values
|
||||
}else error_msg("bad period");
|
||||
break;
|
||||
case 'P':
|
||||
play_snd();
|
||||
break;
|
||||
case 'p':
|
||||
stop_snd();
|
||||
break;
|
||||
case 't':
|
||||
change_snd_bank(B_SAWTOOTH);
|
||||
break;
|
||||
case 's':
|
||||
change_snd_bank(B_SINE);
|
||||
break;
|
||||
case 'e':
|
||||
change_snd_bank(B_EXP);
|
||||
break;
|
||||
case 'l':
|
||||
change_snd_bank(B_LOG);
|
||||
break;
|
||||
case 'r':
|
||||
change_snd_bank(B_RAND);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}while(1);
|
||||
}
|
||||
|
||||
|
||||
42
Noice_generator/main.h
Normal file
42
Noice_generator/main.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* blinky.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
|
||||
#define UART_BUF_LEN 8 // max 7 bytes transmited in on operation
|
||||
#define MIN_STEP_LENGTH 9 // max speed, microseconds for one microstep
|
||||
#define THIS_DEVICE_NUM 1 // hardware number (0..255) can be changed by writting into EEPROM
|
||||
|
||||
extern U8 UART_rx[];
|
||||
extern U8 UART_rx_start_i;
|
||||
extern U8 UART_rx_cur_i;
|
||||
|
||||
void UART_send_byte(U8 byte);
|
||||
void uart_write(char *str);
|
||||
void printUint(U8 *val, U8 len);
|
||||
void error_msg(char *msg);
|
||||
|
||||
#define check_UART_pointer(x) if(x == UART_BUF_LEN) x = 0;
|
||||
|
||||
#endif // __MAIN_H__
|
||||
70
Noice_generator/noicegen.c
Normal file
70
Noice_generator/noicegen.c
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* noicegen.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "noicegen.h"
|
||||
//#include "main.h"
|
||||
|
||||
/**** sound banks ****/
|
||||
// x_pi = [0:15]/15*pi; x_2pi = [0:15]/15*2*pi;
|
||||
// sawtooth: V = sawtooth(x_pi)+1; waveforms(V, "sawtooth")
|
||||
static const U8 sawtooth[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
// sine: V = sin(x_2pi)/2+0.5; waveforms(V, "sine")
|
||||
static const U8 sine[16] = {8, 11, 14, 16, 16, 15, 13, 10, 6, 3, 1, 0, 0, 2, 5, 8};
|
||||
// exp: waveforms(exp([0:15]/4), "exp")
|
||||
static const U8 exp[16] = {0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 6, 7, 10, 12, 16};
|
||||
// log: waveforms(1-exp([0:15]/4), "log")
|
||||
static const U8 log[16] = {16, 16, 16, 16, 15, 15, 15, 14, 14, 13, 12, 10, 9, 6, 4, 0};
|
||||
//pseudorand: waveforms(rand(1,16), "pseudorand")
|
||||
static const U8 pseudorand[16] = {1, 3, 11, 11, 9, 5, 0, 9, 6, 8, 14, 12, 6, 13, 16, 14};
|
||||
static U8 *banks[5] = {sawtooth, sine, exp, log, pseudorand};
|
||||
// currend sound bank
|
||||
unsigned char *current_bank = sawtooth;
|
||||
|
||||
void configure_timers(){
|
||||
/**** TIMERS TIM1 - 1MHz, TIM2 - 1MHz ****/
|
||||
TIM1_PSCRH = 0; // this timer have 16 bit prescaler
|
||||
TIM1_PSCRL = 3; // LSB should be written last as it updates prescaler
|
||||
TIM2_PSCR = 4;
|
||||
// Timer1 is PWM sound level generator
|
||||
// Timer2 runs with F*16 to change voltage level (F - frequency of sound)
|
||||
TIM1_ARRH = 0;
|
||||
TIM1_ARRL = 16;
|
||||
TIM1_CCR1H = 0; TIM1_CCR1L = 8; // default: 50%
|
||||
// channel 1 generates PWM pulses
|
||||
TIM1_CCMR1 = 0x60; // OC1M = 110b - PWM mode 1 ( 1 -> 0)
|
||||
//TIM1_CCMR1 = 0x70; // OC1M = 111b - PWM mode 2 ( 0 -> 1)
|
||||
TIM1_CCER1 = 1; // Channel 1 is on. Active is high
|
||||
//TIM1_CCER1 = 3; // Channel 1 is on. Active is low
|
||||
// default period: near 32ms
|
||||
TIM2_ARRH = 127; TIM2_ARRL = 0;
|
||||
// interrupts: update for timer 2, none for timer 1
|
||||
TIM1_IER = 0;
|
||||
TIM2_IER = TIM_IER_UIE;
|
||||
// enable PWM output for timer1
|
||||
TIM1_BKR |= 0x80; // MOE
|
||||
}
|
||||
/**
|
||||
* Changes current sound "Bank" to i-th in banks
|
||||
*/
|
||||
|
||||
void change_snd_bank(U8 i){
|
||||
current_bank = banks[i];
|
||||
}
|
||||
48
Noice_generator/noicegen.h
Normal file
48
Noice_generator/noicegen.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* noicegen.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __NOICEGEN_H__
|
||||
#define __NOICEGEN_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
#define TIM_EN (TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN)
|
||||
|
||||
// soundbank
|
||||
enum {
|
||||
B_SAWTOOTH, B_SINE, B_EXP, B_LOG, B_RAND
|
||||
};
|
||||
|
||||
extern U8 *current_bank;
|
||||
void configure_timers();
|
||||
void change_snd_bank(U8 i);
|
||||
|
||||
// change period (in us)
|
||||
#define change_period(F) do{TIM2_ARRH = F >> 8; TIM2_ARRL = F;}while(0)
|
||||
// change CCR value. U = Vcc *
|
||||
#define change_CCR(C) do{TIM1_CCR1H = 0; TIM1_CCR1L = C;}while(0)
|
||||
#define play_snd() do{TIM1_CR1 = TIM_EN; TIM2_CR1 = TIM_EN;}while(0)
|
||||
//#define stop_snd() do{TIM1_CR1 = 0; TIM2_CR1 = 0; PC_ODR &= ~GPIO_PIN1; }while(0)
|
||||
#define stop_snd() do{TIM1_CR1 |= TIM_CR1_OPM; TIM2_CR1 = 0;}while(0)
|
||||
|
||||
|
||||
#endif // __NOICEGEN_H__
|
||||
43
Noice_generator/ports_definition.h
Normal file
43
Noice_generator/ports_definition.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* ports_definition.h - definition of ports pins & so on
|
||||
*
|
||||
* Copyright 2014 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 __PORTS_DEFINITION_H__
|
||||
#define __PORTS_DEFINITION_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// macro for using in port constructions like PORT(LED_PORT, ODR) = xx
|
||||
#define CONCAT(a,b) a##_##b
|
||||
#define PORT(a,b) CONCAT(a,b)
|
||||
|
||||
// on-board LED
|
||||
#define LED_PORT PC
|
||||
#define LED_PIN GPIO_PIN2
|
||||
|
||||
// UART2_TX
|
||||
#define UART_PORT PD
|
||||
#define UART_TX_PIN GPIO_PIN5
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // __PORTS_DEFINITION_H__
|
||||
12
Noice_generator/waveforms.m
Normal file
12
Noice_generator/waveforms.m
Normal file
@ -0,0 +1,12 @@
|
||||
function waveforms(FN, nm)
|
||||
% Prints on stdout 16 values for waveform bank
|
||||
% FN - array with 16 values of Vout (Vmin..Vmax), will be normalized
|
||||
% nm - name of array
|
||||
MIN = min(FN); MAX = max(FN);
|
||||
FN = (FN - MIN) / (MAX - MIN);
|
||||
VAL = round(FN * 16);
|
||||
printf("static const U8 %s[16] = {", nm)
|
||||
for i = 1:15; printf("%d, ", VAL(i)); endfor;
|
||||
printf("%d};\n", VAL(16));
|
||||
plot(VAL, 'o');
|
||||
endfunction
|
||||
39
blinky/Makefile
Normal file
39
blinky/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
HEX2BIN=hex2bin
|
||||
|
||||
CCFLAGS=-DSTM8S003 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -mstm8 --out-fmt-ihx
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s003
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h Makefile
|
||||
|
||||
all: $(NAME).bin
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
@echo $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).bin
|
||||
stm8flash $(FLASHFLAGS) -wf $(NAME).bin
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
$(NAME).bin: $(NAME).ihx
|
||||
$(HEX2BIN) -p 00 $<
|
||||
|
||||
.PHONY: all
|
||||
235
blinky/blinky.c
Normal file
235
blinky/blinky.c
Normal file
@ -0,0 +1,235 @@
|
||||
/*
|
||||
* blinky.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "interrupts.h"
|
||||
#include "blinky.h"
|
||||
/*
|
||||
* 0 0000
|
||||
* 1 0001
|
||||
* 2 0010
|
||||
* 3 0011
|
||||
* 4 0100
|
||||
* 5 0101
|
||||
* 6 0110
|
||||
* 7 0111
|
||||
* 8 1000
|
||||
* 9 1001
|
||||
* a 1010
|
||||
* b 1011
|
||||
* c 1100
|
||||
* d 1101
|
||||
* e 1110
|
||||
* f 1111
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* Internal timer (HSI) ********************
|
||||
* on startup: HSI = 2MHz (16/8)
|
||||
* HSI divisor: CLK_CKDIVR: bits 4,3: f_{HSI}/2^x; bits2..0: f_{CPU}=f/2^x (page 93)
|
||||
* CLK_PCKENR1/2 - enable periph clocking (page 94,95) reset value: all enabled
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* Timer1 ********************
|
||||
* prescaler: TIM1_PSCRH/L, f = f_{in}/(TIM1_PSCR + 1)
|
||||
* other registers:
|
||||
* TIM1_CR1 (page 185): | ARPE | CMS[1:0] | DIR | OPM | URS | UDIS | CEN |
|
||||
* ARPE - Auto-reload preload enable (for TIM1_ARR)
|
||||
* CMS[1:0]: Center-aligned mode selection (0 - simple counter up/down)
|
||||
* DIR: Direction (0 - up, 1 - down)
|
||||
* OPM: One-pulse mode (1 - opm enabled)
|
||||
* URS: Update request source (When enabled by the UDIS bit, 1 - interrupt only on counter overflow/underflow)
|
||||
* UDIS: Update disable (1 - disable update int)
|
||||
* CEN: Counter enable (1 - enable)
|
||||
* TIM1_CR2 (page 187): | - | MMS [2:0] | - | COMS | - | CCPS |
|
||||
* MMS[2:0]: Master mode selection (for ADC or other timers)
|
||||
* COMS: Capture/compare control update selection
|
||||
* CCPC: Capture/compare preloaded control
|
||||
* TIM1_IER (page 191): | BIE | TIE | COMIE | CC4IE | CC3IE | CC2IE | CC1IE | UIE |
|
||||
* B - break; T - trigger; COM - commutation; CC - comp/capt; U - update <--
|
||||
* TIM1_SR1 (page 192): similar (but instead of IE -> IF)
|
||||
* interrupt flags
|
||||
* TIM1_CNTRH, TIM1_CNTRL - counter value (automatical)
|
||||
* TIM1_PSCRH, TIM1_PSCRL - prescaler value
|
||||
* TIM1_ARRH, TIM1_ARRL - auto-reload value (while zero, timer is stopped) (page 206)
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* External interrupts (page 69) ********************
|
||||
* EXTI_CR1: | PDIS[1:0] | PCIS[1:0] | PBIS[1:0] | PAIS[1:0] |
|
||||
* per-port sensivity bits:
|
||||
* 00: Falling edge and low level
|
||||
* 01: Rising edge only
|
||||
* 10: Falling edge only
|
||||
* 11: Rising and falling edge
|
||||
* EXTI_CR2: | -reserved[7:3]- | TLIS | PEIS[1:0] |
|
||||
* TLIS: Top level interrupt sensitivity (0: Falling edge, 1 - Rising)
|
||||
* PEIS[1:0]: Port E external interrupt sensitivity bits
|
||||
* after config run enableInterrupts()
|
||||
* ports:
|
||||
* 5 lines on Port A: PA[6:2]
|
||||
* 8 lines on Port B: PB[7:0]
|
||||
* 8 lines on Port C: PC[7:0]
|
||||
* 7 lines on Port D: PD[6:0]
|
||||
* 8 lines on Port E: PE[7:0]
|
||||
* PD7 is the Top Level Interrupt source (TLI), except for 20-pin packages
|
||||
* on which the Top Level Interrupt source (TLI) can be available on the
|
||||
* PC3 pin using an alternate function remapping option bit
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* GPIO (page 111) ********************
|
||||
* Px_ODR - Output data register bits
|
||||
* Px_IDR - Pin input values
|
||||
* Px_DDR - Data direction bits (1 - output)
|
||||
* Px_CR1 - DDR=0: 0 - floating, 1 - pull-up input; DDR=1: 0 - pseudo-open-drain, 1 - push-pull output [not for "T"]
|
||||
* Px_CR2 - DDR=0: 0/1 - EXTI disabled/enabled; DDR=1: 0/1 - 2/10MHz
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* UART ********************
|
||||
* baud rate: regs UART_BRR1/2 !!!VERY STUPID!!!
|
||||
* f_{UART} = f_{master} / UART_DIV
|
||||
* if UART_DIV = 0xABCD then
|
||||
* UART_BRR1 = UART_DIV[11:4] = 0xBC;
|
||||
* UART_BRR2 = UART_DIV[15:12|3:0] = 0xAD
|
||||
* registers
|
||||
* UART_SR: | TXE | TC | RXNE | IDLE | OR/LHE | NF | FE | PE |
|
||||
* TXE: Transmit data register empty
|
||||
* TC: Transmission complete
|
||||
* RXNE: Read data register not empty
|
||||
* IDLE: IDLE line detected
|
||||
* OR: Overrun error / LHE: LIN Header Error (LIN slave mode)
|
||||
* NF: Noise flag
|
||||
* FE: Framing error
|
||||
* PE: Parity error
|
||||
* UART_DR: data register (when readed returns coming byte, when writed fills output shift register)
|
||||
* UART_BRR1 / UART_BRR2 - see upper
|
||||
* UART_CR1: | R8 | T8 | UARTD | M | WAKE | PCEN | PS | PIEN |
|
||||
* R8, T8 - ninth bit (in 9-bit mode)
|
||||
* UARTD: UART Disable (for low power consumption)
|
||||
* M: word length (0 - 8bits, 1 - 9bits)
|
||||
* WAKE: Wakeup method
|
||||
* PCEN: Parity control enable
|
||||
* PS: Parity selection (0 - even)
|
||||
* PIEN: Parity interrupt enable
|
||||
* UART_CR2: | TIEN | TCEN | RIEN | ILIEN | TEN | REN | RWU | SBK |
|
||||
* TIEN: Transmitter interrupt enable
|
||||
* TCIEN: Transmission complete interrupt enable
|
||||
* RIEN: Receiver interrupt enable
|
||||
* ILIEN: IDLE Line interrupt enable
|
||||
* TEN: Transmitter enable <----------------------------------------
|
||||
* REN: Receiver enable <----------------------------------------
|
||||
* RWU: Receiver wakeup
|
||||
* SBK: Send break
|
||||
* UART_CR3: | - | LINEN | STOP[1:0] | CLCEN | CPOL | CPHA | LBCL |
|
||||
* LINEN: LIN mode enable
|
||||
* STOP: STOP bits
|
||||
* CLKEN: Clock enable (CLC pin)
|
||||
* CPOL: Clock polarity
|
||||
* CPHA: Clock phase
|
||||
* LBCL: Last bit clock pulse
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* ADC (page 413) ********************
|
||||
* ADC_DBxRH / ADC_DRH: 9:2 data bits in left-aligned or 9:8 bits in right-aligned mode
|
||||
* ADC_DBxRL / ADC_DRL: 1:0 data bits in left-aligned or 7:0 bits in right-aligned mode
|
||||
* ADC_CSR: | EOC | AWD | EOCIE | AWDIE | CH[3:0] |
|
||||
* EOC: End of conversion
|
||||
* AWD: Analog Watchdog flag
|
||||
* EOCIE: Interrupt enable for EOC
|
||||
* AWDIE: Analog watchdog interrupt enable
|
||||
* CH[3:0]: Channel selection bits (0..15)
|
||||
* ADC_CR1: | - | SPSEL[2:0] | - | - | CONT | ADON |
|
||||
* SPSEL[2:0]: Prescaler selection
|
||||
* CONT: Continuous conversion (0 for single)
|
||||
* ADON: A/D Converter on/off <----------------------------------------
|
||||
* ADC_CR2: | - | EXTTRIG | EXTSEL[1:0] | ALIGN | - | SCAN | - |
|
||||
* EXTTRIG: External trigger enable
|
||||
* EXTSEL[1:0]: External event selection
|
||||
* ALIGN: Data alignment (1 - right alignment, first read ADC_DRL)
|
||||
* SCAN: Scan mode enable
|
||||
* ADC_CR3: | DBUF | OVR | reserved[5:0] |
|
||||
* DBUF: Data buffer enable (on buffered mode data stored not in ADC_DBhl but in ADC_DBxRhl)
|
||||
* OVR: Overrun flag
|
||||
* ADC_TDRH/L - trigger shmidt disable (1 - disable)
|
||||
*/
|
||||
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
char onboard_blink = 1; // == 1 to blink on-board LED
|
||||
int ADC_value = 500; // value of last ADC measurement
|
||||
|
||||
int main() {
|
||||
unsigned long T = 0L;
|
||||
unsigned char LedCntr = 0;
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
// Configure pins
|
||||
PD_DDR = GPIO_PIN3; // PD3 - output, other are inputs
|
||||
PD_CR1 = GPIO_PIN3|GPIO_PIN5; // PD3 is PPout, PD5 is input with pull-up, PD2 is floating input (for ADC)
|
||||
PD_CR2 = GPIO_PIN5; // enable interrupts for PD5
|
||||
PD_ODR = GPIO_PIN3; // turn on LED on PD3
|
||||
// pin interrupts for PD2&PD5
|
||||
EXTI_CR1 = 0x80; // PDIS = 10 - falling edge
|
||||
// 5 LEDs on PC3..PC7
|
||||
PC_DDR = 0xf8;
|
||||
PC_CR1 = 0xf8; // PPout
|
||||
// Configure Timer1
|
||||
// prescaler = f_{in}/f_{tim1} - 1
|
||||
// set Timer1 to 1MHz: 1/1 - 1 = 15
|
||||
TIM1_PSCRH = 0;
|
||||
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
|
||||
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
|
||||
TIM1_ARRH = 0x03;
|
||||
TIM1_ARRL = 0xE8;
|
||||
// interrupts: update
|
||||
TIM1_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
// configure ADC
|
||||
// select PD2[AIN3] & enable interrupt for EOC
|
||||
ADC_CSR = 0x23;
|
||||
ADC_TDRL = 0x08; // disable Schmitt triger for AIN3
|
||||
// right alignment
|
||||
ADC_CR2 = 0x08; // don't forget: first read ADC_DRL!
|
||||
// f_{ADC} = f/18 & continuous non-buffered conversion & wake it up
|
||||
ADC_CR1 = 0x73;
|
||||
ADC_CR1 = 0x73; // turn on ADC (this needs second write operation)
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
// Loop
|
||||
do {
|
||||
// ADC_value sets half-period in ms
|
||||
if((Global_time - T > (long)ADC_value) || (T > Global_time)){
|
||||
T = Global_time;
|
||||
if(onboard_blink) PD_ODR ^= GPIO_PIN3; // blink on-board LED
|
||||
PC_ODR = (LedCntr++) << 3;
|
||||
if(LedCntr == 0x20) LedCntr = 0;
|
||||
}
|
||||
//if(!(PD_IDR & 0x20) && T < 650000L) T+= 5000L;
|
||||
//else if(!(PD_IDR & 0x04) & T > 5000L) T -= 5000L; // PD2
|
||||
} while(1);
|
||||
}
|
||||
|
||||
30
blinky/blinky.h
Normal file
30
blinky/blinky.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* blinky.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __BLINKY_H__
|
||||
#define __BLINKY_H__
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
extern char onboard_blink; // == 1 to blink on-board LED
|
||||
extern int ADC_value; // value of last ADC measurement
|
||||
|
||||
#endif // __BLINKY_H__
|
||||
153
blinky/interrupts.c
Normal file
153
blinky/interrupts.c
Normal file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "blinky.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
if((PD_IDR & GPIO_PIN5) == 0){ // PD5 - switch on-board blinking
|
||||
onboard_blink = !onboard_blink;
|
||||
};
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
if(TIM1_SR1 & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM1_SR1 = 0; // clear all interrupt flags
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
ADC_value = ADC_DRL; // in right-alignment mode we should first read LSB
|
||||
ADC_value |= ADC_DRH << 8;
|
||||
ADC_CSR &= 0x3f; // clear EOC & AWD flags
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
144
blinky/interrupts.h
Normal file
144
blinky/interrupts.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
BIN
blinky/testproj.bin
Normal file
BIN
blinky/testproj.bin
Normal file
Binary file not shown.
39
led/Makefile
Normal file
39
led/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
HEX2BIN=hex2bin
|
||||
|
||||
CCFLAGS=-DSTM8S003 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -lstm8 -mstm8 --out-fmt-ihx
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s003
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h Makefile
|
||||
|
||||
all: $(NAME).bin
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
@echo $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).bin
|
||||
stm8flash $(FLASHFLAGS) -wf $(NAME).bin
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
$(NAME).bin: $(NAME).ihx
|
||||
$(HEX2BIN) -p 00 $<
|
||||
|
||||
.PHONY: all
|
||||
150
led/interrupts.c
Normal file
150
led/interrupts.c
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "interrupts.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
if(TIM1_SR1 & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM1_SR1 = 0; // clear all interrupt flags
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
ADC_value = ADC_DRL; // in right-alignment mode we should first read LSB
|
||||
ADC_value |= ADC_DRH << 8;
|
||||
ADC_CSR &= 0x3f; // clear EOC & AWD flags
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
147
led/interrupts.h
Normal file
147
led/interrupts.h
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
extern int ADC_value; // value of last ADC measurement
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
243
led/led.c
Normal file
243
led/led.c
Normal file
@ -0,0 +1,243 @@
|
||||
/*
|
||||
* led.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "led.h"
|
||||
|
||||
/*
|
||||
* bits no 7 6 5 4 3 2 1 0
|
||||
* dec value 128 64 32 16 8 4 2 1
|
||||
*/
|
||||
|
||||
/********** one variant **********/
|
||||
/*
|
||||
* One digit: TABLE:
|
||||
* ***A*** 0 1 2 3 4 5 6 7 8 9 A B C D E F - h
|
||||
* * * (A) PB4 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1
|
||||
* F B (F) PB5 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0
|
||||
* * * (B) PC5 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1
|
||||
* ***G*** (G) PC6 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
|
||||
* * * (C) PC7 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0
|
||||
* E C (E) PD1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0
|
||||
* * * ** (D) PD2 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1
|
||||
* ***D*** *DP* (DP)PD3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
* **
|
||||
*/
|
||||
/*
|
||||
// PB, mask: 0x30, PB4: 0x10, PB5: 0x20
|
||||
#define PB_BLANK 0x30
|
||||
static U8 PB_bits[18] = {0,0x30,0x20,0x20,0x10,0,0,0x20,0,0,0,0x10,0,0x30,0,0,0x30,0x10};
|
||||
// PC, mask: 0xe0, PC5: 0x20, PC6: 0x40, PC7: 0x80
|
||||
#defin PC_BLANK 0xe0
|
||||
static U8 PC_bits[18] = {0x40,0x40,0x80,0,0,0x20,0x20,0x40,0,0,0,0x20,0xe0,0,0xa0,0xa0,0xa0,0x20};
|
||||
// PD, mask: 0x0e, PD1: 0x02, PD2: 0x04, PD3: 0x08
|
||||
#define PD_BLANK 0x0e
|
||||
static U8 PD_bits[18] = {0x08,0x0e,0x08,0x0a,0x0e,0x0a,0x08,0x0e,0x08,0x0a,0x0c,0x8,0x08,0x08,0x08,0x0c,0x0e,0x0c};
|
||||
*/
|
||||
/*
|
||||
* Number of digit on indicator with common anode
|
||||
* digis 0..3: PC3, PC4, PA3, PD4
|
||||
*/
|
||||
|
||||
|
||||
/********** current variant **********/
|
||||
/*
|
||||
* One digit: TABLE:
|
||||
* ***A*** 0 1 2 3 4 5 6 7 8 9 A B C D E F - h
|
||||
* * * (F) PA1 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0
|
||||
* F B (B) PB4 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1
|
||||
* * * (A) PB5 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1
|
||||
* ***G*** (G) PC3 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
|
||||
* * * (C) PC4 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0
|
||||
* E C (DP)PC5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
* * * ** (D) PC6 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1
|
||||
* ***D*** *DP* (E) PC7 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0
|
||||
* **
|
||||
*/
|
||||
|
||||
/*
|
||||
* Number of digit on indicator with common anode
|
||||
* digis 0..3: PA3, PD6, PD4, PD1
|
||||
*/
|
||||
|
||||
/************* arrays for ports *************/
|
||||
// PA, mask: 0x02, PA1
|
||||
static U8 PA_bits[18] = {0,2,2,2,0,0,0,2,0,0,0,0,0,2,0,0,2,0};
|
||||
#define PA_BLANK 0x02
|
||||
// PB, mask: 0x30, PB4:0x10=16, PB5:0x20=32
|
||||
#define PB_BLANK 0x30
|
||||
static U8 PB_bits[18] = {0,32,0,0,32,16,16,0,0,0,0,48,16,32,16,16,48,48};
|
||||
// PC, mask: 0xF8, PC3:0x08=8, PC4:0x10=16, PC5:0x20=32, PC6:0x40=64, PC7:0x80=128
|
||||
#define PC_BLANK 0xF8
|
||||
static U8 PC_bits[18] = {40,232,48,160,224,160,32,232,32,160,96,32,56,32,48,112,240,96};
|
||||
|
||||
/**
|
||||
* Setup for writing a letter
|
||||
* @param ltr - letter (0..17 for 0..F, - or h | 0x80 for DP, any other value for 'space')
|
||||
*/
|
||||
void write_letter(U8 ltr){
|
||||
U8 L = ltr & 0x7f;
|
||||
PD_ODR = 0; // turn off digits 1..3
|
||||
if(L < 18){ // letter
|
||||
PA_ODR = PA_bits[L];
|
||||
PB_ODR = PB_bits[L];
|
||||
PC_ODR = PC_bits[L];
|
||||
}else{ // space
|
||||
PA_ODR = PA_BLANK;
|
||||
PB_ODR = PB_BLANK;
|
||||
PC_ODR = PC_BLANK;
|
||||
}
|
||||
if(ltr & 0x80){ // DP
|
||||
PC_ODR ^= 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on anode power for digit N (0..3: PA3, PD6, PD4, PD1 -- A0x08, D0x40, D0x10, D0x02)
|
||||
* @param N - number of digit (0..3), if other - no action (display off)
|
||||
* @return
|
||||
*/
|
||||
void light_up_digit(U8 N){
|
||||
switch(N){
|
||||
case 0:
|
||||
PA_ODR |= 0x08;
|
||||
break;
|
||||
case 1:
|
||||
PD_ODR |= 0x40;
|
||||
break;
|
||||
case 2:
|
||||
PD_ODR |= 0x10;
|
||||
break;
|
||||
case 3:
|
||||
PD_ODR |= 0x02;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static U8 display_buffer[4] = {' ',' ',' ',' '}; // blank by default
|
||||
static U8 N_current = 0; // current digit to display
|
||||
|
||||
/**
|
||||
* fills buffer to display
|
||||
* @param str - string to display, contains "0..f" for digits, " " for space, "." for DP
|
||||
* for example: " 1.22" or "h1ab" (something like "0...abc" equivalent to "0.abc"
|
||||
* register independent!
|
||||
* any other letter would be omitted
|
||||
* if NULL - fill buffer with spaces
|
||||
*/
|
||||
void set_display_buf(char *str){
|
||||
U8 B[4];
|
||||
char ch, M = 0, i;
|
||||
N_current = 0; // refresh current digit number
|
||||
// empty buffer
|
||||
for(i = 0; i < 4; i++)
|
||||
display_buffer[i] = ' ';
|
||||
if(!str) return;
|
||||
i = 0;
|
||||
for(;(ch = *str) && (i < 4); str++){
|
||||
M = 0;
|
||||
if(ch > '/' && ch < ':'){ // digit
|
||||
M = '0';
|
||||
}else if(ch > '`' & ch < 'g'){ // a..f
|
||||
M = 'a' - 10;
|
||||
}else if(ch > '@' & ch < 'G'){ // A..F
|
||||
M = 'A' - 10;
|
||||
}else if(ch == '-'){ // minus
|
||||
M = '-' - 16;
|
||||
}else if(ch == 'h'){ // hex
|
||||
M = 'h' - 17;
|
||||
}else if(ch == 'H'){ // hex
|
||||
M = 'H' - 17;
|
||||
}else if(ch == '.'){ // DP, set it to previous char
|
||||
if(i == 0){ // word starts from '.' - make a space with point
|
||||
B[0] = 0xff;
|
||||
}else{ // set point for previous character
|
||||
B[i-1] |= 0x80;
|
||||
}
|
||||
continue;
|
||||
}else if(ch != ' '){ // bad character - continue
|
||||
continue;
|
||||
}
|
||||
B[i] = ch - M;
|
||||
i++;
|
||||
}
|
||||
// now make align to right
|
||||
ch = 3;
|
||||
for(M = i-1; M > -1; M--, ch--){
|
||||
display_buffer[ch] = B[M];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Nth digit of buffer (function ran by timer)
|
||||
* @param N - number of digit in buffer (0..3)
|
||||
*/
|
||||
void show_buf_digit(U8 N){
|
||||
if(N > 3) return;
|
||||
write_letter(display_buffer[N]);
|
||||
light_up_digit(N);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show next digit - function calls from main() by some system time value amount
|
||||
*/
|
||||
void show_next_digit(){
|
||||
show_buf_digit(N_current++);
|
||||
if(N_current > 3) N_current = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert integer value i into string and display it
|
||||
* @param i - value to display, -999 <= i <= 9999, if wrong, displays "---E"
|
||||
*/
|
||||
void display_int(int I){
|
||||
int rem;
|
||||
char N = 3, sign = 0;
|
||||
if(I < -999 || I > 9999){
|
||||
set_display_buf("---E");
|
||||
return;
|
||||
}
|
||||
set_display_buf(NULL); // empty buffer
|
||||
if(I == 0){ // just show zero
|
||||
display_buffer[3] = 0;
|
||||
return;
|
||||
}
|
||||
if(I < 0){
|
||||
sign = 1;
|
||||
I *= -1;
|
||||
}
|
||||
do{
|
||||
rem = I % 10;
|
||||
display_buffer[N] = rem;
|
||||
I /= 10;
|
||||
}while(--N > -1 && I);
|
||||
if(sign && N > -1) display_buffer[N] = 16; // minus sign
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* displays digital point at position i
|
||||
* @param i - position to display DP, concequent calls can light up many DPs
|
||||
*/
|
||||
void display_DP_at_pos(U8 i){
|
||||
if(i > 3) return;
|
||||
display_buffer[i] |= 0x80;
|
||||
}
|
||||
48
led/led.h
Normal file
48
led/led.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* led.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __LED_H__
|
||||
#define __LED_H__
|
||||
#include "stm8l.h"
|
||||
|
||||
void set_display_buf(char *str);
|
||||
void show_buf_digit(U8 N);
|
||||
void show_next_digit();
|
||||
void display_int(int i);
|
||||
void display_DP_at_pos(U8 i);
|
||||
|
||||
/**
|
||||
* Initialize ports
|
||||
* PA3, PB4|5, PC3|4|5|6|7, PD1|2|3|4
|
||||
*
|
||||
#define LED_init() do{ \
|
||||
PA_DDR = 0x08; PB_DDR = 0x30; PC_DDR = 0xf8; PD_DDR = 0x1e; \
|
||||
PA_CR1 = 0x08; PB_CR1 = 0x30; PC_CR1 = 0xf8; PD_CR1 = 0x1e; \
|
||||
}while(0)
|
||||
*/
|
||||
|
||||
// PA1|3, PB4|5, PC3|4|5|6|7, PD1|4|6
|
||||
#define LED_init() do{ \
|
||||
PA_DDR = 0x0a; PB_DDR = 0x30; PC_DDR = 0xf8; PD_DDR = 0x52; \
|
||||
PA_CR1 = 0x0a; PB_CR1 = 0x30; PC_CR1 = 0xf8; PD_CR1 = 0x52; \
|
||||
}while(0)
|
||||
|
||||
#endif // __LED_H__
|
||||
85
led/main.c
Normal file
85
led/main.c
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* main.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "interrupts.h"
|
||||
#include "led.h"
|
||||
|
||||
#define DIGIT_PER 10
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
int ADC_value = 0; // value of last ADC measurement
|
||||
U8 LED_delay = 1; // one digit emitting time
|
||||
|
||||
int main() {
|
||||
unsigned long T_LED = 0L; // time of last digit update
|
||||
unsigned long T_time = 0L; // timer
|
||||
int i = -1200;
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
// Configure pins
|
||||
CFG_GCR |= 1; // disable SWIM
|
||||
LED_init();
|
||||
// Configure Timer1
|
||||
// prescaler = f_{in}/f_{tim1} - 1
|
||||
// set Timer1 to 1MHz: 1/1 - 1 = 15
|
||||
TIM1_PSCRH = 0;
|
||||
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
|
||||
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
|
||||
TIM1_ARRH = 0x03;
|
||||
TIM1_ARRL = 0xE8;
|
||||
// interrupts: update
|
||||
TIM1_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
// configure ADC
|
||||
// select PD2[AIN3] & enable interrupt for EOC
|
||||
ADC_CSR = 0x23;
|
||||
ADC_TDRL = 0x08; // disable Schmitt triger for AIN3
|
||||
// right alignment
|
||||
ADC_CR2 = 0x08; // don't forget: first read ADC_DRL!
|
||||
// f_{ADC} = f/18 & continuous non-buffered conversion & wake it up
|
||||
ADC_CR1 = 0x73;
|
||||
ADC_CR1 = 0x73; // turn on ADC (this needs second write operation)
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
display_int(i++);
|
||||
show_next_digit(); // show zero
|
||||
// Loop
|
||||
do {
|
||||
if(((unsigned int)(Global_time - T_time) > DIGIT_PER) || (T_time > Global_time)){ // set next timer value
|
||||
T_time = Global_time;
|
||||
display_int(i++);
|
||||
if(i > 9999) i = -1200;
|
||||
// check ADC value to light up DPs proportionaly
|
||||
if(ADC_value > 819) display_DP_at_pos(0); // big value == 4 points
|
||||
if(ADC_value > 614) display_DP_at_pos(1); // less == 3 points
|
||||
if(ADC_value > 410) display_DP_at_pos(2); // little == 2 points
|
||||
if(ADC_value > 205) display_DP_at_pos(3); // more little == 1 point
|
||||
// values less than 206 == 0
|
||||
}
|
||||
if((U8)(Global_time - T_LED) > LED_delay){
|
||||
T_LED = Global_time;
|
||||
show_next_digit();
|
||||
}
|
||||
} while(1);
|
||||
}
|
||||
|
||||
BIN
led/testproj.bin
Normal file
BIN
led/testproj.bin
Normal file
Binary file not shown.
39
stepper/Makefile
Normal file
39
stepper/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
HEX2BIN=hex2bin
|
||||
|
||||
CCFLAGS=-DSTM8S105 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -mstm8 --out-fmt-ihx -lstm8
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s105
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h Makefile
|
||||
|
||||
all: $(NAME).bin
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
@echo $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).bin
|
||||
stm8flash $(FLASHFLAGS) -wf $(NAME).bin
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
$(NAME).bin: $(NAME).ihx
|
||||
$(HEX2BIN) -p 00 $<
|
||||
|
||||
.PHONY: all
|
||||
22
stepper/client-term/Makefile
Normal file
22
stepper/client-term/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
PROGRAM = client
|
||||
LDFLAGS =
|
||||
SRCS = client.c
|
||||
CC = gcc
|
||||
DEFINES = -D_XOPEN_SOURCE=501
|
||||
CXX = gcc
|
||||
CFLAGS = -Wall -Werror $(DEFINES)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
all : $(PROGRAM) clean
|
||||
$(PROGRAM) : $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
|
||||
|
||||
# some addition dependencies
|
||||
# %.o: %.c
|
||||
# $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@
|
||||
#$(SRCS) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
# @touch $@
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o *~
|
||||
depend:
|
||||
$(CXX) -MM $(CXX.SRCS)
|
||||
222
stepper/client-term/client.c
Normal file
222
stepper/client-term/client.c
Normal file
@ -0,0 +1,222 @@
|
||||
/*
|
||||
* client.c - simple terminal client
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 <termios.h> // tcsetattr
|
||||
#include <unistd.h> // tcsetattr, close, read, write
|
||||
#include <sys/ioctl.h> // ioctl
|
||||
#include <stdio.h> // printf, getchar, fopen, perror
|
||||
#include <stdlib.h> // exit
|
||||
#include <sys/stat.h> // read
|
||||
#include <fcntl.h> // read
|
||||
#include <signal.h> // signal
|
||||
#include <time.h> // time
|
||||
#include <string.h> // memcpy
|
||||
#include <stdint.h> // int types
|
||||
#include <sys/time.h> // gettimeofday
|
||||
|
||||
double t0; // start time
|
||||
|
||||
FILE *fout = NULL; // file for messages duplicating
|
||||
char *comdev = "/dev/ttyUSB0";
|
||||
int BAUD_RATE = B57600;
|
||||
struct termio oldtty, tty; // TTY flags
|
||||
struct termios oldt, newt; // terminal flags
|
||||
int comfd; // TTY fd
|
||||
|
||||
/**
|
||||
* function for different purposes that need to know time intervals
|
||||
* @return double value: time in seconds
|
||||
*/
|
||||
double dtime(){
|
||||
double t;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
t = tv.tv_sec + ((double)tv.tv_usec)/1e6;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit & return terminal to old state
|
||||
* @param ex_stat - status (return code)
|
||||
*/
|
||||
void quit(int ex_stat){
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state
|
||||
ioctl(comfd, TCSANOW, &oldtty ); // return TTY to previous state
|
||||
close(comfd);
|
||||
if(fout) fclose(fout);
|
||||
printf("Exit! (%d)\n", ex_stat);
|
||||
exit(ex_stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open & setup TTY, terminal
|
||||
*/
|
||||
void tty_init(){
|
||||
// terminal without echo
|
||||
tcgetattr(STDIN_FILENO, &oldt);
|
||||
newt = oldt;
|
||||
newt.c_lflag &= ~(ICANON | ECHO);
|
||||
if(tcsetattr(STDIN_FILENO, TCSANOW, &newt) < 0) quit(-2);
|
||||
printf("\nOpen port...\n");
|
||||
if ((comfd = open(comdev,O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0){
|
||||
fprintf(stderr,"Can't use port %s\n",comdev);
|
||||
quit(1);
|
||||
}
|
||||
printf(" OK\nGet current settings...\n");
|
||||
if(ioctl(comfd,TCGETA,&oldtty) < 0) exit(-1); // Get settings
|
||||
tty = oldtty;
|
||||
tty.c_lflag = 0; // ~(ICANON | ECHO | ECHOE | ISIG)
|
||||
tty.c_oflag = 0;
|
||||
tty.c_cflag = BAUD_RATE|CS8|CREAD|CLOCAL; // 9.6k, 8N1, RW, ignore line ctrl
|
||||
tty.c_cc[VMIN] = 0; // non-canonical mode
|
||||
tty.c_cc[VTIME] = 5;
|
||||
if(ioctl(comfd,TCSETA,&tty) < 0) exit(-1); // set new mode
|
||||
printf(" OK\n");
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read character from console without echo
|
||||
* @return char readed
|
||||
*/
|
||||
int read_console(){
|
||||
int rb;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(STDIN_FILENO, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000;
|
||||
retval = select(1, &rfds, NULL, NULL, &tv);
|
||||
if(!retval) rb = 0;
|
||||
else {
|
||||
if(FD_ISSET(STDIN_FILENO, &rfds)) rb = getchar();
|
||||
else rb = 0;
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
|
||||
/**
|
||||
* getchar() without echo
|
||||
* wait until at least one character pressed
|
||||
* @return character readed
|
||||
*/
|
||||
int mygetchar(){ // аналог getchar() без необходимости жать Enter
|
||||
int ret;
|
||||
do ret = read_console();
|
||||
while(ret == 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from TTY
|
||||
* @param buff (o) - buffer for data read
|
||||
* @param length - buffer len
|
||||
* @return amount of readed bytes
|
||||
*/
|
||||
size_t read_tty(uint8_t *buff, size_t length){
|
||||
ssize_t L = 0;
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(comfd, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000; // wait for 10ms
|
||||
retval = select(comfd + 1, &rfds, NULL, NULL, &tv);
|
||||
if (!retval) return 0;
|
||||
if(FD_ISSET(comfd, &rfds)){
|
||||
if((L = read(comfd, buff, length)) < 1) return 0;
|
||||
}
|
||||
return (size_t)L;
|
||||
}
|
||||
|
||||
void help(){
|
||||
printf("Use this commands:\n"
|
||||
"h\tShow this help\n"
|
||||
"q\tQuit\n"
|
||||
);
|
||||
}
|
||||
|
||||
#define dup_pr(...) do{printf(__VA_ARGS__); if(fout) fprintf(fout, __VA_ARGS__);}while(0)
|
||||
|
||||
void con_sig(int rb){
|
||||
uint8_t cmd;
|
||||
if(rb < 1) return;
|
||||
if(rb == 'q') quit(0); // q == exit
|
||||
cmd = (uint8_t) rb;
|
||||
write(comfd, &cmd, 1);
|
||||
/*switch(rb){
|
||||
case 'h':
|
||||
help();
|
||||
break;
|
||||
default:
|
||||
cmd = (uint8_t) rb;
|
||||
write(comfd, &cmd, 1);
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Get integer value from buffer
|
||||
* @param buff (i) - buffer with int
|
||||
* @param len - length of data in buffer (could be 2 or 4)
|
||||
* @return
|
||||
*/
|
||||
uint32_t get_int(uint8_t *buff, size_t len){
|
||||
if(len != 2 && len != 4){
|
||||
fprintf(stdout, "Bad data length!\n");
|
||||
return 0xffffffff;
|
||||
}
|
||||
uint32_t data = 0;
|
||||
uint8_t *i8 = (uint8_t*) &data;
|
||||
if(len == 2) memcpy(i8, buff, 2);
|
||||
else memcpy(i8, buff, 4);
|
||||
return data;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int rb;
|
||||
uint8_t buff[128];
|
||||
size_t L;
|
||||
if(argc == 2){
|
||||
fout = fopen(argv[1], "a");
|
||||
if(!fout){
|
||||
perror("Can't open output file");
|
||||
exit(-1);
|
||||
}
|
||||
setbuf(fout, NULL);
|
||||
}
|
||||
tty_init();
|
||||
signal(SIGTERM, quit); // kill (-15)
|
||||
signal(SIGINT, quit); // ctrl+C
|
||||
signal(SIGQUIT, SIG_IGN); // ctrl+\ .
|
||||
signal(SIGTSTP, SIG_IGN); // ctrl+Z
|
||||
setbuf(stdout, NULL);
|
||||
t0 = dtime();
|
||||
while(1){
|
||||
rb = read_console();
|
||||
if(rb > 0) con_sig(rb);
|
||||
L = read_tty(buff, 127);
|
||||
if(L){
|
||||
buff[L] = 0;
|
||||
printf("%s", buff);
|
||||
if(fout) fprintf(fout, "%zd\t%s\n", time(NULL), buff);
|
||||
}
|
||||
}
|
||||
}
|
||||
169
stepper/interrupts.c
Normal file
169
stepper/interrupts.c
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
if(TIM1_SR1 & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM1_SR1 = 0; // clear all interrupt flags
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){ // generate pulses for stepper CLK
|
||||
if(TIM2_SR1 & TIM_SR1_UIF){
|
||||
TIM2_SR1 &= ~TIM_SR1_UIF;
|
||||
if(--Nsteps == 0){
|
||||
stop_motor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){
|
||||
U8 rb;
|
||||
if(UART2_SR & UART_SR_RXNE){ // data received
|
||||
rb = UART2_DR; // read received byte & clear RXNE flag
|
||||
while(!(UART2_SR & UART_SR_TXE));
|
||||
UART2_DR = rb; // echo received symbol
|
||||
UART_rx[UART_rx_cur_i++] = rb; // put received byte into cycled buffer
|
||||
if(UART_rx_cur_i == UART_rx_start_i){ // Oops: buffer overflow! Just forget old data
|
||||
UART_rx_start_i++;
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
}
|
||||
check_UART_pointer(UART_rx_cur_i);
|
||||
}
|
||||
}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
144
stepper/interrupts.h
Normal file
144
stepper/interrupts.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
396
stepper/main.c
Normal file
396
stepper/main.c
Normal file
@ -0,0 +1,396 @@
|
||||
/*
|
||||
* blinky.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "interrupts.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
/*
|
||||
* 0 0000
|
||||
* 1 0001
|
||||
* 2 0010
|
||||
* 3 0011
|
||||
* 4 0100
|
||||
* 5 0101
|
||||
* 6 0110
|
||||
* 7 0111
|
||||
* 8 1000
|
||||
* 9 1001
|
||||
* a 1010
|
||||
* b 1011
|
||||
* c 1100
|
||||
* d 1101
|
||||
* e 1110
|
||||
* f 1111
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* Internal timer (HSI) ********************
|
||||
* on startup: HSI = 2MHz (16/8)
|
||||
* HSI divisor: CLK_CKDIVR: bits 4,3: f_{HSI}/2^x; bits2..0: f_{CPU}=f/2^x (page 93)
|
||||
* CLK_PCKENR1/2 - enable periph clocking (page 94,95) reset value: all enabled
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* Timer1 ********************
|
||||
* prescaler: TIM1_PSCRH/L, f = f_{in}/(TIM1_PSCR + 1)
|
||||
* other registers:
|
||||
* TIM1_CR1 (page 185): | ARPE | CMS[1:0] | DIR | OPM | URS | UDIS | CEN |
|
||||
* ARPE - Auto-reload preload enable (for TIM1_ARR)
|
||||
* CMS[1:0]: Center-aligned mode selection (0 - simple counter up/down)
|
||||
* DIR: Direction (0 - up, 1 - down)
|
||||
* OPM: One-pulse mode (1 - opm enabled)
|
||||
* URS: Update request source (When enabled by the UDIS bit, 1 - interrupt only on counter overflow/underflow)
|
||||
* UDIS: Update disable (1 - disable update int)
|
||||
* CEN: Counter enable (1 - enable)
|
||||
* TIM1_CR2 (page 187): | - | MMS [2:0] | - | COMS | - | CCPS |
|
||||
* MMS[2:0]: Master mode selection (for ADC or other timers)
|
||||
* COMS: Capture/compare control update selection
|
||||
* CCPC: Capture/compare preloaded control
|
||||
* TIM1_IER (page 191): | BIE | TIE | COMIE | CC4IE | CC3IE | CC2IE | CC1IE | UIE |
|
||||
* B - break; T - trigger; COM - commutation; CC - comp/capt; U - update <--
|
||||
* TIM1_SR1 (page 192): similar (but instead of IE -> IF)
|
||||
* interrupt flags
|
||||
* TIM1_CNTRH, TIM1_CNTRL - counter value (automatical)
|
||||
* TIM1_PSCRH, TIM1_PSCRL - prescaler value
|
||||
* TIM1_ARRH, TIM1_ARRL - auto-reload value (while zero, timer is stopped) (page 206)
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* External interrupts (page 69) ********************
|
||||
* EXTI_CR1: | PDIS[1:0] | PCIS[1:0] | PBIS[1:0] | PAIS[1:0] |
|
||||
* per-port sensivity bits:
|
||||
* 00: Falling edge and low level
|
||||
* 01: Rising edge only
|
||||
* 10: Falling edge only
|
||||
* 11: Rising and falling edge
|
||||
* EXTI_CR2: | -reserved[7:3]- | TLIS | PEIS[1:0] |
|
||||
* TLIS: Top level interrupt sensitivity (0: Falling edge, 1 - Rising)
|
||||
* PEIS[1:0]: Port E external interrupt sensitivity bits
|
||||
* after config run enableInterrupts()
|
||||
* ports:
|
||||
* 5 lines on Port A: PA[6:2]
|
||||
* 8 lines on Port B: PB[7:0]
|
||||
* 8 lines on Port C: PC[7:0]
|
||||
* 7 lines on Port D: PD[6:0]
|
||||
* 8 lines on Port E: PE[7:0]
|
||||
* PD7 is the Top Level Interrupt source (TLI), except for 20-pin packages
|
||||
* on which the Top Level Interrupt source (TLI) can be available on the
|
||||
* PC3 pin using an alternate function remapping option bit
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* GPIO (page 111) ********************
|
||||
* Px_ODR - Output data register bits
|
||||
* Px_IDR - Pin input values
|
||||
* Px_DDR - Data direction bits (1 - output)
|
||||
* Px_CR1 - DDR=0: 0 - floating, 1 - pull-up input; DDR=1: 0 - pseudo-open-drain, 1 - push-pull output [not for "T"]
|
||||
* Px_CR2 - DDR=0: 0/1 - EXTI disabled/enabled; DDR=1: 0/1 - 2/10MHz
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* UART ********************
|
||||
* ALGO:
|
||||
* 1. Program the M bit in UART_CR1 to define the word length [M=0, PCEN=0 - 8bit without parity]
|
||||
* 2. Program the number of stop bits in UART_CR3
|
||||
* 3. Select the desired baud rate (UART_BRR1/2) [57600 on 16MHz: BRR1=0x11, BRR2=0x06]
|
||||
* 4. Set the TEN bit in UART_CR2 to enable transmitter mode
|
||||
* 5. Write the data to send in the UART_DR register (this clears the TXE bit)
|
||||
* 6. Once the last data is written to the UART_DR register, wait until TC is set to ‘1’, which indicates that the last data transmission is complete
|
||||
* baud rate: regs UART_BRR1/2 !!!VERY STUPID!!!
|
||||
* f_{UART} = f_{master} / UART_DIV
|
||||
* if UART_DIV = 0xABCD then
|
||||
* UART_BRR1 = UART_DIV[11:4] = 0xBC;
|
||||
* UART_BRR2 = UART_DIV[15:12|3:0] = 0xAD
|
||||
* registers
|
||||
* UART_SR: | TXE | TC | RXNE | IDLE | OR/LHE | NF | FE | PE |
|
||||
* TXE: Transmit data register empty
|
||||
* TC: Transmission complete
|
||||
* RXNE: Read data register not empty
|
||||
* IDLE: IDLE line detected
|
||||
* OR: Overrun error / LHE: LIN Header Error (LIN slave mode)
|
||||
* NF: Noise flag
|
||||
* FE: Framing error
|
||||
* PE: Parity error
|
||||
* UART_DR: data register (when readed returns coming byte, when writed fills output shift register)
|
||||
* UART_BRR1 / UART_BRR2 - see upper
|
||||
* UART_CR1: | R8 | T8 | UARTD | M | WAKE | PCEN | PS | PIEN |
|
||||
* R8, T8 - ninth bit (in 9-bit mode)
|
||||
* UARTD: UART Disable (for low power consumption)
|
||||
* M: word length (0 - 8bits, 1 - 9bits)
|
||||
* WAKE: Wakeup method
|
||||
* PCEN: Parity control enable
|
||||
* PS: Parity selection (0 - even)
|
||||
* PIEN: Parity interrupt enable
|
||||
* UART_CR2: | TIEN | TCEN | RIEN | ILIEN | TEN | REN | RWU | SBK |
|
||||
* TIEN: Transmitter interrupt enable
|
||||
* TCIEN: Transmission complete interrupt enable
|
||||
* RIEN: Receiver interrupt enable
|
||||
* ILIEN: IDLE Line interrupt enable
|
||||
* TEN: Transmitter enable <----------------------------------------
|
||||
* REN: Receiver enable <----------------------------------------
|
||||
* RWU: Receiver wakeup
|
||||
* SBK: Send break
|
||||
* UART_CR3: | - | LINEN | STOP[1:0] | CLCEN | CPOL | CPHA | LBCL |
|
||||
* LINEN: LIN mode enable
|
||||
* STOP: STOP bits
|
||||
* CLKEN: Clock enable (CLC pin)
|
||||
* CPOL: Clock polarity
|
||||
* CPHA: Clock phase
|
||||
* LBCL: Last bit clock pulse
|
||||
*/
|
||||
|
||||
/*
|
||||
********************* ADC (page 413) ********************
|
||||
* ADC_DBxRH / ADC_DRH: 9:2 data bits in left-aligned or 9:8 bits in right-aligned mode
|
||||
* ADC_DBxRL / ADC_DRL: 1:0 data bits in left-aligned or 7:0 bits in right-aligned mode
|
||||
* ADC_CSR: | EOC | AWD | EOCIE | AWDIE | CH[3:0] |
|
||||
* EOC: End of conversion
|
||||
* AWD: Analog Watchdog flag
|
||||
* EOCIE: Interrupt enable for EOC
|
||||
* AWDIE: Analog watchdog interrupt enable
|
||||
* CH[3:0]: Channel selection bits (0..15)
|
||||
* ADC_CR1: | - | SPSEL[2:0] | - | - | CONT | ADON |
|
||||
* SPSEL[2:0]: Prescaler selection
|
||||
* CONT: Continuous conversion (0 for single)
|
||||
* ADON: A/D Converter on/off <----------------------------------------
|
||||
* ADC_CR2: | - | EXTTRIG | EXTSEL[1:0] | ALIGN | - | SCAN | - |
|
||||
* EXTTRIG: External trigger enable
|
||||
* EXTSEL[1:0]: External event selection
|
||||
* ALIGN: Data alignment (1 - right alignment, first read ADC_DRL)
|
||||
* SCAN: Scan mode enable
|
||||
* ADC_CR3: | DBUF | OVR | reserved[5:0] |
|
||||
* DBUF: Data buffer enable (on buffered mode data stored not in ADC_DBhl but in ADC_DBxRhl)
|
||||
* OVR: Overrun flag
|
||||
* ADC_TDRH/L - trigger shmidt disable (1 - disable)
|
||||
*/
|
||||
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
U16 paused_val = 500; // interval between LED flashing
|
||||
|
||||
U8 UART_rx[UART_BUF_LEN]; // cycle buffer for received data
|
||||
U8 UART_rx_start_i = 0; // started index of received data (from which reading starts)
|
||||
U8 UART_rx_cur_i = 0; // index of current first byte in rx array (to which data will be written)
|
||||
|
||||
/**
|
||||
* Send one byte through UART
|
||||
* @param byte - data to send
|
||||
*/
|
||||
void UART_send_byte(U8 byte){
|
||||
while(!(UART2_SR & UART_SR_TXE)); // wait until previous byte transmitted
|
||||
UART2_DR = byte;
|
||||
}
|
||||
|
||||
void uart_write(char *str){
|
||||
while(*str){
|
||||
while(!(UART2_SR & UART_SR_TXE));
|
||||
UART2_CR2 |= UART_CR2_TEN;
|
||||
UART2_DR = *str++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read one byte from Rx buffer
|
||||
* @param byte - where to store readed data
|
||||
* @return 1 in case of non-empty buffer
|
||||
*/
|
||||
U8 UART_read_byte(U8 *byte){
|
||||
if(UART_rx_start_i == UART_rx_cur_i) // buffer is empty
|
||||
return 0;
|
||||
*byte = UART_rx[UART_rx_start_i++];
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void printUint(U8 *val, U8 len){
|
||||
unsigned long Number = 0;
|
||||
U8 i = len;
|
||||
char ch;
|
||||
U8 decimal_buff[12]; // max len of U32 == 10 + \n + \0
|
||||
if(len > 4 || len == 3 || len == 0) return;
|
||||
for(i = 0; i < 12; i++)
|
||||
decimal_buff[i] = 0;
|
||||
decimal_buff[10] = '\n';
|
||||
ch = 9;
|
||||
switch(len){
|
||||
case 1:
|
||||
Number = *((U8*)val);
|
||||
break;
|
||||
case 2:
|
||||
Number = *((U16*)val);
|
||||
break;
|
||||
case 4:
|
||||
Number = *((unsigned long*)val);
|
||||
break;
|
||||
}
|
||||
do{
|
||||
i = Number % 10L;
|
||||
decimal_buff[ch--] = i + '0';
|
||||
Number /= 10L;
|
||||
}while(Number && ch > -1);
|
||||
uart_write((char*)&decimal_buff[ch+1]);
|
||||
}
|
||||
|
||||
U8 readInt(int *val){
|
||||
unsigned long T = Global_time;
|
||||
unsigned long R = 0;
|
||||
int readed;
|
||||
U8 sign = 0, rb, ret = 0, bad = 0;
|
||||
do{
|
||||
if(!UART_read_byte(&rb)) continue;
|
||||
if(rb == '-' && R == 0){ // negative number
|
||||
sign = 1;
|
||||
continue;
|
||||
}
|
||||
if(rb < '0' || rb > '9') break; // number ends with any non-digit symbol that will be omitted
|
||||
ret = 1; // there's at least one digit
|
||||
R = R * 10L + rb - '0';
|
||||
if(R > 0x7fff){ // bad value
|
||||
R = 0;
|
||||
bad = 0;
|
||||
}
|
||||
}while(Global_time - T < 10000); // wait no longer than 10s
|
||||
if(bad || !ret) return 0;
|
||||
readed = (int) R;
|
||||
if(sign) readed *= -1;
|
||||
*val = readed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void error_msg(char *msg){
|
||||
uart_write("\nERROR: ");
|
||||
uart_write(msg);
|
||||
UART_send_byte('\n');
|
||||
}
|
||||
|
||||
int main() {
|
||||
unsigned long T = 0L;
|
||||
int Ival;
|
||||
U8 rb;
|
||||
CFG_GCR |= 1; // disable SWIM
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
|
||||
// Configure timer 1 - systick
|
||||
// prescaler = f_{in}/f_{tim1} - 1
|
||||
// set Timer1 to 1MHz: 1/1 - 1 = 15
|
||||
TIM1_PSCRH = 0;
|
||||
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
|
||||
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
|
||||
TIM1_ARRH = 0x03;
|
||||
TIM1_ARRL = 0xE8;
|
||||
// interrupts: update
|
||||
TIM1_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
|
||||
// Configure pins
|
||||
// PC2 - PP output (on-board LED)
|
||||
PORT(LED_PORT, DDR) |= LED_PIN;
|
||||
PORT(LED_PORT, CR1) |= LED_PIN;
|
||||
// PD5 - UART2_TX
|
||||
PORT(UART_PORT, DDR) |= UART_TX_PIN;
|
||||
PORT(UART_PORT, CR1) |= UART_TX_PIN;
|
||||
|
||||
// Configure UART
|
||||
// 8 bit, no parity, 1 stop (UART_CR1/3 = 0 - reset value)
|
||||
// 57600 on 16MHz: BRR1=0x11, BRR2=0x06
|
||||
UART2_BRR1 = 0x11; UART2_BRR2 = 0x06;
|
||||
UART2_CR2 = UART_CR2_TEN | UART_CR2_REN | UART_CR2_RIEN; // Allow RX/TX, generate ints on rx
|
||||
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
|
||||
set_stepper_speed(1000);
|
||||
setup_stepper_pins();
|
||||
|
||||
// Loop
|
||||
do{
|
||||
if((Global_time - T > paused_val) || (T > Global_time)){
|
||||
T = Global_time;
|
||||
PORT(LED_PORT, ODR) ^= LED_PIN; // blink on-board LED
|
||||
}
|
||||
if(UART_read_byte(&rb)){ // buffer isn't empty
|
||||
switch(rb){
|
||||
case 'h': // help
|
||||
case 'H':
|
||||
uart_write("\nPROTO:\n+/-\tLED period\nS/s\tset/get Mspeed\nm\tget steps\nx\tstop\np\tpause/resume\n0..4\tmove xth motor\na\tadd Nstps\n");
|
||||
break;
|
||||
case '+':
|
||||
paused_val += 100;
|
||||
if(paused_val > 10000)
|
||||
paused_val = 500; // but not more than 10s
|
||||
break;
|
||||
case '-':
|
||||
paused_val -= 100;
|
||||
if(paused_val < 100) // but not less than 0.1s
|
||||
paused_val = 500;
|
||||
break;
|
||||
case 'S': // set stepper speed
|
||||
if(readInt(&Ival) && Ival > MIN_STEP_LENGTH)
|
||||
set_stepper_speed(Ival);
|
||||
else
|
||||
error_msg("bad speed");
|
||||
break;
|
||||
case 's': // get stepper speed
|
||||
printUint((U8*)&Stepper_speed, 2);
|
||||
break;
|
||||
case 'm': // how much steps there is to the end of moving
|
||||
Ival = Nsteps >> Ustepping;
|
||||
printUint((U8*)&Ival, 2);
|
||||
break;
|
||||
case 'x': // stop
|
||||
stop_motor();
|
||||
break;
|
||||
case 'p': // pause/resume
|
||||
pause_resume();
|
||||
break;
|
||||
case 'a': // add N steps
|
||||
if(readInt(&Ival) && Ival){
|
||||
add_steps(Ival);
|
||||
}else{
|
||||
error_msg("bad value");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(rb >= '0' && rb <= '4'){ // motor
|
||||
if(Motor_number != 5){
|
||||
error_msg("moving!");
|
||||
break;
|
||||
}
|
||||
Motor_number = rb - '0';
|
||||
if(readInt(&Ival) && Ival)
|
||||
move_motor(Ival);
|
||||
else{
|
||||
error_msg("bad Nsteps");
|
||||
Motor_number = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}while(1);
|
||||
}
|
||||
|
||||
|
||||
41
stepper/main.h
Normal file
41
stepper/main.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* blinky.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
|
||||
#define UART_BUF_LEN 8 // max 7 bytes transmited in on operation
|
||||
#define MIN_STEP_LENGTH 125 // max speed == 1/(125us*16) = 500 steps per second
|
||||
|
||||
extern U8 UART_rx[];
|
||||
extern U8 UART_rx_start_i;
|
||||
extern U8 UART_rx_cur_i;
|
||||
|
||||
void UART_send_byte(U8 byte);
|
||||
void uart_write(char *str);
|
||||
void printUint(U8 *val, U8 len);
|
||||
void error_msg(char *msg);
|
||||
|
||||
#define check_UART_pointer(x) if(x == UART_BUF_LEN) x = 0;
|
||||
|
||||
#endif // __MAIN_H__
|
||||
50
stepper/ports_definition.h
Normal file
50
stepper/ports_definition.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* ports_definition.h - definition of ports pins & so on
|
||||
*
|
||||
* Copyright 2014 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 __PORTS_DEFINITION_H__
|
||||
#define __PORTS_DEFINITION_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// macro for using in port constructions like PORT(LED_PORT, ODR) = xx
|
||||
#define CONCAT(a, b) a ## _ ## b
|
||||
#define PORT(a, b) CONCAT(a , b)
|
||||
|
||||
// on-board LED
|
||||
#define LED_PORT PC
|
||||
#define LED_PIN GPIO_PIN2
|
||||
|
||||
// UART2_TX
|
||||
#define UART_PORT PD
|
||||
#define UART_TX_PIN GPIO_PIN5
|
||||
|
||||
/***** Stepper motor *****/
|
||||
// Clocking
|
||||
#define STP_CLK_PORT PD
|
||||
#define STP_CLK_PIN GPIO_PIN4
|
||||
// EN -- PB0..4
|
||||
#define STP_EN_PORT PB
|
||||
#define STP_EN_MASK 0x1F // number & mask == enable!
|
||||
// DIR -- PB5
|
||||
#define STP_DIR_PORT PB
|
||||
#define STP_DIR_PIN GPIO_PIN5
|
||||
#endif // __PORTS_DEFINITION_H__
|
||||
82
stepper/schematic/kicad.pro
Normal file
82
stepper/schematic/kicad.pro
Normal file
@ -0,0 +1,82 @@
|
||||
update=Вт 11 фев 2014 17:26:13
|
||||
version=1
|
||||
last_client=eeschema
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[cvpcb/libraries]
|
||||
EquName1=devcms
|
||||
[pcbnew]
|
||||
version=1
|
||||
LastNetListRead=
|
||||
PadDrlX=320
|
||||
PadDimH=550
|
||||
PadDimV=550
|
||||
BoardThickness=620
|
||||
TxtPcbV=600
|
||||
TxtPcbH=600
|
||||
TxtModV=500
|
||||
TxtModH=500
|
||||
TxtModW=100
|
||||
VEgarde=100
|
||||
DrawLar=120
|
||||
EdgeLar=80
|
||||
TxtLar=120
|
||||
MSegLar=120
|
||||
[pcbnew/libraries]
|
||||
LibDir=
|
||||
LibName1=sockets
|
||||
LibName2=connect
|
||||
LibName3=discret
|
||||
LibName4=pin_array
|
||||
LibName5=divers
|
||||
LibName6=libcms
|
||||
LibName7=display
|
||||
LibName8=led
|
||||
LibName9=dip_sockets
|
||||
LibName10=pga_sockets
|
||||
LibName11=valves
|
||||
[general]
|
||||
version=1
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
NetFmtName=
|
||||
RptD_X=0
|
||||
RptD_Y=100
|
||||
RptLab=1
|
||||
LabSize=60
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=special
|
||||
LibName13=microcontrollers
|
||||
LibName14=dsp
|
||||
LibName15=microchip
|
||||
LibName16=analog_switches
|
||||
LibName17=motorola
|
||||
LibName18=texas
|
||||
LibName19=intel
|
||||
LibName20=audio
|
||||
LibName21=interface
|
||||
LibName22=digital-audio
|
||||
LibName23=philips
|
||||
LibName24=display
|
||||
LibName25=cypress
|
||||
LibName26=siliconi
|
||||
LibName27=opto
|
||||
LibName28=atmel
|
||||
LibName29=contrib
|
||||
LibName30=valves
|
||||
LibName31=stm8
|
||||
LibName32=st-microelectronics
|
||||
LibName33=stm8s105k4t6c
|
||||
237
stepper/schematic/stepper-cache.lib
Normal file
237
stepper/schematic/stepper-cache.lib
Normal file
@ -0,0 +1,237 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Ср 12 фев 2014 12:09:00
|
||||
#encoding utf-8
|
||||
#
|
||||
# +3.3V
|
||||
#
|
||||
DEF +3.3V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -40 30 H I C CNN
|
||||
F1 "+3.3V" 0 110 30 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS +3,3V
|
||||
DRAW
|
||||
X +3.3V 1 0 0 0 U 30 30 0 0 W N
|
||||
C 0 60 20 0 1 0 N
|
||||
P 3 0 1 0 0 0 0 40 0 40 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# C
|
||||
#
|
||||
DEF C C 0 10 N Y 1 F N
|
||||
F0 "C" 0 100 40 H V L CNN
|
||||
F1 "C" 6 -85 40 H V L CNN
|
||||
F2 "~" 38 -150 30 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
SM*
|
||||
C?
|
||||
C1-1
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 20 -80 -30 80 -30 N
|
||||
P 2 0 1 20 -80 30 80 30 N
|
||||
X ~ 1 0 200 170 D 40 40 1 1 P
|
||||
X ~ 2 0 -200 170 U 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_14
|
||||
#
|
||||
DEF CONN_14 P 0 40 Y N 1 F N
|
||||
F0 "P" -30 0 60 V V C CNN
|
||||
F1 "CONN_14" 80 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 700 150 -700 0 1 0 N
|
||||
X P1 1 -350 650 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 550 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 450 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 350 250 R 50 50 1 1 P I
|
||||
X P5 5 -350 250 250 R 50 50 1 1 P I
|
||||
X P6 6 -350 150 250 R 50 50 1 1 P I
|
||||
X P7 7 -350 50 250 R 50 50 1 1 P I
|
||||
X P8 8 -350 -50 250 R 50 50 1 1 P I
|
||||
X P9 9 -350 -150 250 R 50 50 1 1 P I
|
||||
X P10 10 -350 -250 250 R 50 50 1 1 P I
|
||||
X P11 11 -350 -350 250 R 50 50 1 1 P I
|
||||
X P12 12 -350 -450 250 R 50 50 1 1 P I
|
||||
X P13 13 -350 -550 250 R 50 50 1 1 P I
|
||||
X P14 14 -350 -650 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_3
|
||||
#
|
||||
DEF CONN_3 K 0 40 Y N 1 F N
|
||||
F0 "K" -50 0 50 V V C CNN
|
||||
F1 "CONN_3" 50 0 40 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 150 100 -150 0 1 0 N
|
||||
X P1 1 -350 100 250 R 60 60 1 1 P I
|
||||
X PM 2 -350 0 250 R 60 60 1 1 P I
|
||||
X P3 3 -350 -100 250 R 60 60 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_4
|
||||
#
|
||||
DEF CONN_4 P 0 40 Y N 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_4" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 200 100 -200 0 1 0 N
|
||||
X P1 1 -350 150 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 50 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 -50 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 -150 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_6
|
||||
#
|
||||
DEF CONN_6 P 0 30 Y N 1 F N
|
||||
F0 "P" -50 0 60 V V C CNN
|
||||
F1 "CONN_6" 50 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 300 100 -300 0 1 0 N
|
||||
X 1 1 -350 250 250 R 60 60 1 1 P I
|
||||
X 2 2 -350 150 250 R 60 60 1 1 P I
|
||||
X 3 3 -350 50 250 R 60 60 1 1 P I
|
||||
X 4 4 -350 -50 250 R 60 60 1 1 P I
|
||||
X 5 5 -350 -150 250 R 60 60 1 1 P I
|
||||
X 6 6 -350 -250 250 R 60 60 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# GND
|
||||
#
|
||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 0 30 H I C CNN
|
||||
F1 "GND" 0 -70 30 H I C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# LED
|
||||
#
|
||||
DEF LED D 0 40 Y N 1 F N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "LED" 0 -100 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LED-3MM
|
||||
LED-5MM
|
||||
LED-10MM
|
||||
LED-0603
|
||||
LED-0805
|
||||
LED-1206
|
||||
LEDV
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 0 50 50 50 -50 N
|
||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||
P 3 0 1 0 65 -40 110 -80 105 -55 N
|
||||
P 3 0 1 0 80 -25 125 -65 120 -40 N
|
||||
X A 1 -200 0 150 R 40 40 1 1 P
|
||||
X K 2 200 0 150 L 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# R
|
||||
#
|
||||
DEF R R 0 0 N Y 1 F N
|
||||
F0 "R" 80 0 40 V V C CNN
|
||||
F1 "R" 7 1 40 V V C CNN
|
||||
F2 "~" -70 0 30 V V C CNN
|
||||
F3 "~" 0 0 30 H V C CNN
|
||||
$FPLIST
|
||||
R?
|
||||
SM0603
|
||||
SM0805
|
||||
R?-*
|
||||
SM1206
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -40 150 40 -150 0 1 12 N
|
||||
X ~ 1 0 250 100 D 60 60 1 1 P
|
||||
X ~ 2 0 -250 100 U 60 60 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_PUSH
|
||||
#
|
||||
DEF SW_PUSH SW 0 40 N N 1 F N
|
||||
F0 "SW" 150 110 50 H V C CNN
|
||||
F1 "SW_PUSH" 0 -80 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -170 50 170 60 0 1 0 N
|
||||
P 4 0 1 0 -40 60 -30 90 30 90 40 60 N
|
||||
X 1 1 -300 0 200 R 60 60 0 1 P I
|
||||
X 2 2 300 0 200 L 60 60 0 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
108
stepper/schematic/stepper.cmp
Normal file
108
stepper/schematic/stepper.cmp
Normal file
@ -0,0 +1,108 @@
|
||||
Cmp-Mod V01 Created by CvPcb (2013-feb-26)-stable date = Ср 12 фев 2014 12:08:54
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0413;
|
||||
Reference = C1;
|
||||
ValeurCmp = 1u;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0426;
|
||||
Reference = C2;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F99;
|
||||
Reference = C3;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DD3;
|
||||
Reference = D1;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ECD;
|
||||
Reference = D2;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB2C32;
|
||||
Reference = K1;
|
||||
ValeurCmp = CONN_3;
|
||||
IdModule = SIL-3;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A6A;
|
||||
Reference = P1;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A49;
|
||||
Reference = P2;
|
||||
ValeurCmp = CONN_4;
|
||||
IdModule = SIL-4;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A79;
|
||||
Reference = P3;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB29A7;
|
||||
Reference = P4;
|
||||
ValeurCmp = CONN_5;
|
||||
IdModule = SIL-5;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DE2;
|
||||
Reference = R1;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ED3;
|
||||
Reference = R2;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0EFD;
|
||||
Reference = R3;
|
||||
ValeurCmp = 10k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F3B;
|
||||
Reference = SW1;
|
||||
ValeurCmp = SW_PUSH;
|
||||
IdModule = SM2010;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB03A2;
|
||||
Reference = U1;
|
||||
ValeurCmp = STM8S105K4T6C;
|
||||
IdModule = TQFP32;
|
||||
EndCmp
|
||||
|
||||
EndListe
|
||||
361
stepper/schematic/stepper.net
Normal file
361
stepper/schematic/stepper.net
Normal file
@ -0,0 +1,361 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source /home/eddy/Docs/SAO/ELECTRONICS/STM8/stepper/schematic/stepper.sch)
|
||||
(date "Ср 12 фев 2014 12:08:20")
|
||||
(tool "eeschema (2013-feb-26)-stable"))
|
||||
(components
|
||||
(comp (ref U1)
|
||||
(value STM8S105K4T6C)
|
||||
(libsource (lib stm8s105k4t6c) (part STM8S105K4T6C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB03A2))
|
||||
(comp (ref C1)
|
||||
(value 1u)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0413))
|
||||
(comp (ref C2)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0426))
|
||||
(comp (ref P2)
|
||||
(value CONN_4)
|
||||
(libsource (lib conn) (part CONN_4))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A49))
|
||||
(comp (ref P1)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A6A))
|
||||
(comp (ref P3)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A79))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DD3))
|
||||
(comp (ref R1)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DE2))
|
||||
(comp (ref D2)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ECD))
|
||||
(comp (ref R2)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ED3))
|
||||
(comp (ref R3)
|
||||
(value 10k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0EFD))
|
||||
(comp (ref SW1)
|
||||
(value SW_PUSH)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F3B))
|
||||
(comp (ref C3)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F99))
|
||||
(comp (ref P4)
|
||||
(value CONN_5)
|
||||
(libsource (lib conn) (part CONN_6))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB29A7))
|
||||
(comp (ref K1)
|
||||
(value CONN_3)
|
||||
(libsource (lib conn) (part CONN_3))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB2C32)))
|
||||
(libparts
|
||||
(libpart (lib device) (part C)
|
||||
(description "Condensateur non polarise")
|
||||
(footprints
|
||||
(fp SM*)
|
||||
(fp C?)
|
||||
(fp C1-1))
|
||||
(fields
|
||||
(field (name Reference) C)
|
||||
(field (name Value) C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part LED)
|
||||
(footprints
|
||||
(fp LED-3MM)
|
||||
(fp LED-5MM)
|
||||
(fp LED-10MM)
|
||||
(fp LED-0603)
|
||||
(fp LED-0805)
|
||||
(fp LED-1206)
|
||||
(fp LEDV))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name A) (type passive))
|
||||
(pin (num 2) (name K) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistance)
|
||||
(footprints
|
||||
(fp R?)
|
||||
(fp SM0603)
|
||||
(fp SM0805)
|
||||
(fp R?-*)
|
||||
(fp SM1206))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part SW_PUSH)
|
||||
(description "Push Button")
|
||||
(fields
|
||||
(field (name Reference) SW)
|
||||
(field (name Value) SW_PUSH)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib conn) (part CONN_14)
|
||||
(description "Symbole general de connexion")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_14))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))
|
||||
(pin (num 5) (name P5) (type passive))
|
||||
(pin (num 6) (name P6) (type passive))
|
||||
(pin (num 7) (name P7) (type passive))
|
||||
(pin (num 8) (name P8) (type passive))
|
||||
(pin (num 9) (name P9) (type passive))
|
||||
(pin (num 10) (name P10) (type passive))
|
||||
(pin (num 11) (name P11) (type passive))
|
||||
(pin (num 12) (name P12) (type passive))
|
||||
(pin (num 13) (name P13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))))
|
||||
(libpart (lib conn) (part CONN_3)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) K)
|
||||
(field (name Value) CONN_3))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name PM) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))))
|
||||
(libpart (lib conn) (part CONN_4)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_4))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))))
|
||||
(libpart (lib conn) (part CONN_6)
|
||||
(description "ymbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_6))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))
|
||||
(pin (num 3) (name 3) (type passive))
|
||||
(pin (num 4) (name 4) (type passive))
|
||||
(pin (num 5) (name 5) (type passive))
|
||||
(pin (num 6) (name 6) (type passive))))
|
||||
(libpart (lib stm8s105k4t6c) (part STM8S105K4T6C)
|
||||
(footprints
|
||||
(fp lqfp32*))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) STM8S105K4T6C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name NRST) (type input))
|
||||
(pin (num 2) (name OSCIN/PA1) (type 3state))
|
||||
(pin (num 3) (name OSCOUT/PA2) (type 3state))
|
||||
(pin (num 4) (name VSS) (type power_in))
|
||||
(pin (num 5) (name VCAP) (type power_out))
|
||||
(pin (num 6) (name "VDD(3.3-5v)") (type power_in))
|
||||
(pin (num 7) (name VDDio) (type power_in))
|
||||
(pin (num 8) (name PF4/AIN12) (type 3state))
|
||||
(pin (num 9) (name VDDA) (type power_in))
|
||||
(pin (num 10) (name VSSA) (type power_in))
|
||||
(pin (num 11) (name PB5/AIN5[I2X_SDA]) (type 3state))
|
||||
(pin (num 12) (name PB4/AIN4[I2C_SCL]) (type 3state))
|
||||
(pin (num 13) (name PB3/AIN3[TIM1_ETR]) (type 3state))
|
||||
(pin (num 14) (name PB2/AIN2[TIM1_CH3N]) (type 3state))
|
||||
(pin (num 15) (name PB1/AIN1_[TIM1_CH2N]) (type 3state))
|
||||
(pin (num 16) (name PB0/AIN0_[TIM1_CH1N]) (type 3state))
|
||||
(pin (num 17) (name PE5/SPI_NSS) (type 3state))
|
||||
(pin (num 18) (name "PC1(HS)/TIM1_CH1") (type 3state))
|
||||
(pin (num 19) (name "PC2(HS)/TIM1_CH2") (type 3state))
|
||||
(pin (num 20) (name "PC3(HS)/TIM1_CH3") (type 3state))
|
||||
(pin (num 21) (name "PC4(HS)/TIM1_CH4") (type 3state))
|
||||
(pin (num 22) (name "PC5(HS)/SPI_SCK") (type 3state))
|
||||
(pin (num 23) (name "PC6(HS)/SPI_MOSI") (type 3state))
|
||||
(pin (num 24) (name "PC7(HS)/SPI_MISO") (type 3state))
|
||||
(pin (num 25) (name "PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO]") (type 3state))
|
||||
(pin (num 26) (name "PD1(HS)/SWIM") (type 3state))
|
||||
(pin (num 27) (name "PD2(HS)/TIM3_CH1[TIM2_CH3]") (type 3state))
|
||||
(pin (num 28) (name "PD3(HS)/TIM2_CH2[ADC_ETR]") (type 3state))
|
||||
(pin (num 29) (name "PD4(HS)/TIM2_CH1[BEEP]") (type 3state))
|
||||
(pin (num 30) (name PD5/UART2_TX) (type 3state))
|
||||
(pin (num 31) (name PD6/UART2_RX) (type 3state))
|
||||
(pin (num 32) (name PD7/TLI[TIM1_CH4]) (type 3state)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri /usr/share/kicad/library/device.lib))
|
||||
(library (logical conn)
|
||||
(uri /usr/share/kicad/library/conn.lib))
|
||||
(library (logical stm8s105k4t6c)
|
||||
(uri stm8s105k4t6c.lib)))
|
||||
(nets
|
||||
(net (code 1) (name +3.3V)
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref U1) (pin 6))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref U1) (pin 9))
|
||||
(node (ref K1) (pin 1)))
|
||||
(net (code 2) (name "")
|
||||
(node (ref D1) (pin 2))
|
||||
(node (ref R1) (pin 1)))
|
||||
(net (code 3) (name "")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref D2) (pin 2)))
|
||||
(net (code 4) (name GND)
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref C3) (pin 2))
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref P2) (pin 4))
|
||||
(node (ref P1) (pin 2))
|
||||
(node (ref U1) (pin 10))
|
||||
(node (ref U1) (pin 4))
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref P4) (pin 6)))
|
||||
(net (code 5) (name /PC2)
|
||||
(node (ref R1) (pin 2))
|
||||
(node (ref U1) (pin 19))
|
||||
(node (ref P3) (pin 14)))
|
||||
(net (code 6) (name "")
|
||||
(node (ref U1) (pin 5))
|
||||
(node (ref C1) (pin 2)))
|
||||
(net (code 7) (name /PC1)
|
||||
(node (ref P1) (pin 14))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 8) (name /OSC1IN)
|
||||
(node (ref U1) (pin 2))
|
||||
(node (ref P1) (pin 4)))
|
||||
(net (code 9) (name /OSC2IN)
|
||||
(node (ref P1) (pin 5))
|
||||
(node (ref U1) (pin 3)))
|
||||
(net (code 10) (name /PF4)
|
||||
(node (ref P1) (pin 6))
|
||||
(node (ref U1) (pin 8)))
|
||||
(net (code 11) (name /PB5)
|
||||
(node (ref U1) (pin 11))
|
||||
(node (ref P1) (pin 7))
|
||||
(node (ref K1) (pin 2)))
|
||||
(net (code 12) (name /PB4)
|
||||
(node (ref U1) (pin 12))
|
||||
(node (ref P4) (pin 5))
|
||||
(node (ref P1) (pin 8)))
|
||||
(net (code 13) (name /PB3)
|
||||
(node (ref U1) (pin 13))
|
||||
(node (ref P1) (pin 9))
|
||||
(node (ref P4) (pin 4)))
|
||||
(net (code 14) (name /PB2)
|
||||
(node (ref P1) (pin 10))
|
||||
(node (ref P4) (pin 3))
|
||||
(node (ref U1) (pin 14)))
|
||||
(net (code 15) (name /PB1)
|
||||
(node (ref P4) (pin 2))
|
||||
(node (ref P1) (pin 11))
|
||||
(node (ref U1) (pin 15)))
|
||||
(net (code 16) (name /PB0)
|
||||
(node (ref P4) (pin 1))
|
||||
(node (ref U1) (pin 16))
|
||||
(node (ref P1) (pin 12)))
|
||||
(net (code 17) (name /PE5)
|
||||
(node (ref U1) (pin 17))
|
||||
(node (ref P1) (pin 13)))
|
||||
(net (code 18) (name /PD7)
|
||||
(node (ref U1) (pin 32))
|
||||
(node (ref P3) (pin 1)))
|
||||
(net (code 19) (name /PD6)
|
||||
(node (ref P3) (pin 2))
|
||||
(node (ref U1) (pin 31)))
|
||||
(net (code 20) (name /PD5)
|
||||
(node (ref U1) (pin 30))
|
||||
(node (ref P3) (pin 3)))
|
||||
(net (code 21) (name /PD4)
|
||||
(node (ref K1) (pin 3))
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref P3) (pin 4)))
|
||||
(net (code 22) (name /PD3)
|
||||
(node (ref U1) (pin 28))
|
||||
(node (ref P3) (pin 5)))
|
||||
(net (code 23) (name /PD2)
|
||||
(node (ref P3) (pin 6))
|
||||
(node (ref U1) (pin 27)))
|
||||
(net (code 24) (name /PD0)
|
||||
(node (ref U1) (pin 25))
|
||||
(node (ref P3) (pin 8)))
|
||||
(net (code 25) (name /PC7)
|
||||
(node (ref U1) (pin 24))
|
||||
(node (ref P3) (pin 9)))
|
||||
(net (code 26) (name /PC6)
|
||||
(node (ref P3) (pin 10))
|
||||
(node (ref U1) (pin 23)))
|
||||
(net (code 27) (name /PC5)
|
||||
(node (ref P3) (pin 11))
|
||||
(node (ref U1) (pin 22)))
|
||||
(net (code 28) (name /PC4)
|
||||
(node (ref U1) (pin 21))
|
||||
(node (ref P3) (pin 12)))
|
||||
(net (code 29) (name /PC3)
|
||||
(node (ref P3) (pin 13))
|
||||
(node (ref U1) (pin 20)))
|
||||
(net (code 30) (name /SWIM/PD1)
|
||||
(node (ref P2) (pin 2))
|
||||
(node (ref U1) (pin 26))
|
||||
(node (ref P3) (pin 7)))
|
||||
(net (code 31) (name /NRST)
|
||||
(node (ref R3) (pin 2))
|
||||
(node (ref P2) (pin 3))
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref P1) (pin 3))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref U1) (pin 1)))))
|
||||
42
stepper/schematic/stepper.pro
Normal file
42
stepper/schematic/stepper.pro
Normal file
@ -0,0 +1,42 @@
|
||||
update=Ср 12 фев 2014 11:53:02
|
||||
last_client=eeschema
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
NetFmtName=
|
||||
RptD_X=0
|
||||
RptD_Y=100
|
||||
RptLab=1
|
||||
LabSize=60
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=special
|
||||
LibName13=microcontrollers
|
||||
LibName14=dsp
|
||||
LibName15=microchip
|
||||
LibName16=analog_switches
|
||||
LibName17=motorola
|
||||
LibName18=texas
|
||||
LibName19=intel
|
||||
LibName20=audio
|
||||
LibName21=interface
|
||||
LibName22=digital-audio
|
||||
LibName23=philips
|
||||
LibName24=display
|
||||
LibName25=cypress
|
||||
LibName26=siliconi
|
||||
LibName27=opto
|
||||
LibName28=atmel
|
||||
LibName29=contrib
|
||||
LibName30=valves
|
||||
LibName31=stm8s105k4t6c
|
||||
612
stepper/schematic/stepper.sch
Normal file
612
stepper/schematic/stepper.sch
Normal file
@ -0,0 +1,612 @@
|
||||
EESchema Schematic File Version 2 date Ср 12 фев 2014 12:09:00
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:special
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:stm8s105k4t6c
|
||||
LIBS:stepper-cache
|
||||
EELAYER 27 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date "12 feb 2014"
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L STM8S105K4T6C U1
|
||||
U 1 1 52FB03A2
|
||||
P 4400 3100
|
||||
F 0 "U1" H 4400 4150 60 0000 C CNN
|
||||
F 1 "STM8S105K4T6C" H 4450 2250 60 0000 C CNN
|
||||
F 2 "~" H 4400 3100 60 0000 C CNN
|
||||
F 3 "~" H 4400 3100 60 0000 C CNN
|
||||
1 4400 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR01
|
||||
U 1 1 52FB03EF
|
||||
P 2750 3200
|
||||
F 0 "#PWR01" H 2750 3200 30 0001 C CNN
|
||||
F 1 "GND" H 2750 3130 30 0001 C CNN
|
||||
F 2 "" H 2750 3200 60 0000 C CNN
|
||||
F 3 "" H 2750 3200 60 0000 C CNN
|
||||
1 2750 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 3200 2750 3150
|
||||
Wire Wire Line
|
||||
2750 3150 3000 3150
|
||||
$Comp
|
||||
L GND #PWR02
|
||||
U 1 1 52FB0400
|
||||
P 2750 2600
|
||||
F 0 "#PWR02" H 2750 2600 30 0001 C CNN
|
||||
F 1 "GND" H 2750 2530 30 0001 C CNN
|
||||
F 2 "" H 2750 2600 60 0000 C CNN
|
||||
F 3 "" H 2750 2600 60 0000 C CNN
|
||||
1 2750 2600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 2600 2750 2550
|
||||
Wire Wire Line
|
||||
2750 2550 3000 2550
|
||||
$Comp
|
||||
L C C1
|
||||
U 1 1 52FB0413
|
||||
P 2250 2700
|
||||
F 0 "C1" H 2300 2800 50 0000 L CNN
|
||||
F 1 "1u" H 2300 2600 50 0000 L CNN
|
||||
F 2 "" H 2250 2700 60 0000 C CNN
|
||||
F 3 "" H 2250 2700 60 0000 C CNN
|
||||
1 2250 2700
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L C C2
|
||||
U 1 1 52FB0426
|
||||
P 2250 2950
|
||||
F 0 "C2" H 2300 3050 50 0000 L CNN
|
||||
F 1 "104" H 2300 2850 50 0000 L CNN
|
||||
F 2 "" H 2250 2950 60 0000 C CNN
|
||||
F 3 "" H 2250 2950 60 0000 C CNN
|
||||
1 2250 2950
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2450 2700 2850 2700
|
||||
Wire Wire Line
|
||||
2850 2700 2850 2650
|
||||
Wire Wire Line
|
||||
2850 2650 3000 2650
|
||||
Wire Wire Line
|
||||
3000 2750 3000 2850
|
||||
Wire Wire Line
|
||||
2450 2950 2450 2850
|
||||
Wire Wire Line
|
||||
2450 2850 3000 2850
|
||||
Wire Wire Line
|
||||
2050 2700 2050 3100
|
||||
$Comp
|
||||
L GND #PWR03
|
||||
U 1 1 52FB0453
|
||||
P 2050 3100
|
||||
F 0 "#PWR03" H 2050 3100 30 0001 C CNN
|
||||
F 1 "GND" H 2050 3030 30 0001 C CNN
|
||||
F 2 "" H 2050 3100 60 0000 C CNN
|
||||
F 3 "" H 2050 3100 60 0000 C CNN
|
||||
1 2050 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 2050 2800
|
||||
Connection ~ 2050 2950
|
||||
Text Label 3000 2250 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 3000 2350 2 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 3000 2450 2 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 3000 2950 2 60 ~ 0
|
||||
PF4
|
||||
Text Label 3000 3250 2 60 ~ 0
|
||||
PB5
|
||||
Text Label 3000 3350 2 60 ~ 0
|
||||
PB4
|
||||
Text Label 3000 3450 2 60 ~ 0
|
||||
PB3
|
||||
Text Label 3000 3550 2 60 ~ 0
|
||||
PB2
|
||||
Text Label 3000 3650 2 60 ~ 0
|
||||
PB1
|
||||
Text Label 3000 3750 2 60 ~ 0
|
||||
PB0
|
||||
Text Label 5800 3750 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 5800 3650 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 5800 3550 0 60 ~ 0
|
||||
PC2
|
||||
Text Label 5800 3450 0 60 ~ 0
|
||||
PC3
|
||||
Text Label 5800 3350 0 60 ~ 0
|
||||
PC4
|
||||
Text Label 5800 3250 0 60 ~ 0
|
||||
PC5
|
||||
Text Label 5800 3150 0 60 ~ 0
|
||||
PC6
|
||||
Text Label 5800 3050 0 60 ~ 0
|
||||
PC7
|
||||
Text Label 5800 2950 0 60 ~ 0
|
||||
PD0
|
||||
Text Label 5800 2850 0 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 5800 2750 0 60 ~ 0
|
||||
PD2
|
||||
Text Label 5800 2650 0 60 ~ 0
|
||||
PD3
|
||||
Text Label 5800 2550 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 5800 2450 0 60 ~ 0
|
||||
PD5
|
||||
Text Label 5800 2350 0 60 ~ 0
|
||||
PD6
|
||||
Text Label 5800 2250 0 60 ~ 0
|
||||
PD7
|
||||
$Comp
|
||||
L CONN_4 P2
|
||||
U 1 1 52FB0A49
|
||||
P 4350 1000
|
||||
F 0 "P2" V 4300 1000 50 0000 C CNN
|
||||
F 1 "CONN_4" V 4400 1000 50 0000 C CNN
|
||||
F 2 "" H 4350 1000 60 0000 C CNN
|
||||
F 3 "" H 4350 1000 60 0000 C CNN
|
||||
1 4350 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P1
|
||||
U 1 1 52FB0A6A
|
||||
P 1250 1500
|
||||
F 0 "P1" V 1220 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 1330 1500 60 0000 C CNN
|
||||
F 2 "" H 1250 1500 60 0000 C CNN
|
||||
F 3 "" H 1250 1500 60 0000 C CNN
|
||||
1 1250 1500
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P3
|
||||
U 1 1 52FB0A79
|
||||
P 7100 1500
|
||||
F 0 "P3" V 7070 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 7180 1500 60 0000 C CNN
|
||||
F 2 "" H 7100 1500 60 0000 C CNN
|
||||
F 3 "" H 7100 1500 60 0000 C CNN
|
||||
1 7100 1500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Text Label 1600 1150 0 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 1600 1250 0 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 1600 1350 0 60 ~ 0
|
||||
PF4
|
||||
Text Label 1600 1450 0 60 ~ 0
|
||||
PB5
|
||||
Text Label 1600 1550 0 60 ~ 0
|
||||
PB4
|
||||
Text Label 1600 1650 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1600 1750 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1600 1850 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1600 1950 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1600 2050 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 1600 2150 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 1600 1050 0 60 ~ 0
|
||||
NRST
|
||||
Text Label 4000 950 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 4000 1050 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 6750 850 2 60 ~ 0
|
||||
PD7
|
||||
Text Label 6750 950 2 60 ~ 0
|
||||
PD6
|
||||
Text Label 6750 1050 2 60 ~ 0
|
||||
PD5
|
||||
Text Label 6750 1150 2 60 ~ 0
|
||||
PD4
|
||||
Text Label 6750 1250 2 60 ~ 0
|
||||
PD3
|
||||
Text Label 6750 1350 2 60 ~ 0
|
||||
PD2
|
||||
Text Label 6750 1450 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 6750 1550 2 60 ~ 0
|
||||
PD0
|
||||
Text Label 6750 1650 2 60 ~ 0
|
||||
PC7
|
||||
Text Label 6750 1750 2 60 ~ 0
|
||||
PC6
|
||||
Text Label 6750 1850 2 60 ~ 0
|
||||
PC5
|
||||
Text Label 6750 1950 2 60 ~ 0
|
||||
PC4
|
||||
Text Label 6750 2050 2 60 ~ 0
|
||||
PC3
|
||||
Text Label 6750 2150 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR04
|
||||
U 1 1 52FB0DC4
|
||||
P 950 2800
|
||||
F 0 "#PWR04" H 950 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 950 2910 30 0000 C CNN
|
||||
F 2 "" H 950 2800 60 0000 C CNN
|
||||
F 3 "" H 950 2800 60 0000 C CNN
|
||||
1 950 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D1
|
||||
U 1 1 52FB0DD3
|
||||
P 950 3100
|
||||
F 0 "D1" H 950 3200 50 0000 C CNN
|
||||
F 1 "LED" H 950 3000 50 0000 C CNN
|
||||
F 2 "" H 950 3100 60 0000 C CNN
|
||||
F 3 "" H 950 3100 60 0000 C CNN
|
||||
1 950 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 52FB0DE2
|
||||
P 950 3600
|
||||
F 0 "R1" V 1030 3600 50 0000 C CNN
|
||||
F 1 "1k" V 950 3600 50 0000 C CNN
|
||||
F 2 "" H 950 3600 60 0000 C CNN
|
||||
F 3 "" H 950 3600 60 0000 C CNN
|
||||
1 950 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
950 2800 950 2900
|
||||
Wire Wire Line
|
||||
950 3300 950 3350
|
||||
Wire Wire Line
|
||||
950 3850 950 3950
|
||||
$Comp
|
||||
L +3.3V #PWR05
|
||||
U 1 1 52FB0EC7
|
||||
P 1300 2800
|
||||
F 0 "#PWR05" H 1300 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1300 2910 30 0000 C CNN
|
||||
F 2 "" H 1300 2800 60 0000 C CNN
|
||||
F 3 "" H 1300 2800 60 0000 C CNN
|
||||
1 1300 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D2
|
||||
U 1 1 52FB0ECD
|
||||
P 1300 3100
|
||||
F 0 "D2" H 1300 3200 50 0000 C CNN
|
||||
F 1 "LED" H 1300 3000 50 0000 C CNN
|
||||
F 2 "" H 1300 3100 60 0000 C CNN
|
||||
F 3 "" H 1300 3100 60 0000 C CNN
|
||||
1 1300 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 52FB0ED3
|
||||
P 1300 3600
|
||||
F 0 "R2" V 1380 3600 50 0000 C CNN
|
||||
F 1 "1k" V 1300 3600 50 0000 C CNN
|
||||
F 2 "" H 1300 3600 60 0000 C CNN
|
||||
F 3 "" H 1300 3600 60 0000 C CNN
|
||||
1 1300 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR06
|
||||
U 1 1 52FB0ED9
|
||||
P 1300 3950
|
||||
F 0 "#PWR06" H 1300 3950 30 0001 C CNN
|
||||
F 1 "GND" H 1300 3880 30 0001 C CNN
|
||||
F 2 "" H 1300 3950 60 0000 C CNN
|
||||
F 3 "" H 1300 3950 60 0000 C CNN
|
||||
1 1300 3950
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 2800 1300 2900
|
||||
Wire Wire Line
|
||||
1300 3300 1300 3350
|
||||
Wire Wire Line
|
||||
1300 3850 1300 3950
|
||||
Text Label 950 3950 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR07
|
||||
U 1 1 52FB0EF1
|
||||
P 6500 2550
|
||||
F 0 "#PWR07" H 6500 2510 30 0001 C CNN
|
||||
F 1 "+3.3V" H 6500 2660 30 0000 C CNN
|
||||
F 2 "" H 6500 2550 60 0000 C CNN
|
||||
F 3 "" H 6500 2550 60 0000 C CNN
|
||||
1 6500 2550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 52FB0EFD
|
||||
P 6500 2900
|
||||
F 0 "R3" V 6580 2900 50 0000 C CNN
|
||||
F 1 "10k" V 6500 2900 50 0000 C CNN
|
||||
F 2 "" H 6500 2900 60 0000 C CNN
|
||||
F 3 "" H 6500 2900 60 0000 C CNN
|
||||
1 6500 2900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR08
|
||||
U 1 1 52FB0F03
|
||||
P 6500 4050
|
||||
F 0 "#PWR08" H 6500 4050 30 0001 C CNN
|
||||
F 1 "GND" H 6500 3980 30 0001 C CNN
|
||||
F 2 "" H 6500 4050 60 0000 C CNN
|
||||
F 3 "" H 6500 4050 60 0000 C CNN
|
||||
1 6500 4050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 2550 6500 2650
|
||||
Wire Wire Line
|
||||
6500 3850 6500 4050
|
||||
$Comp
|
||||
L SW_PUSH SW1
|
||||
U 1 1 52FB0F3B
|
||||
P 6500 3550
|
||||
F 0 "SW1" H 6650 3660 50 0000 C CNN
|
||||
F 1 "SW_PUSH" H 6500 3470 50 0000 C CNN
|
||||
F 2 "" H 6500 3550 60 0000 C CNN
|
||||
F 3 "" H 6500 3550 60 0000 C CNN
|
||||
1 6500 3550
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 3250 6500 3150
|
||||
$Comp
|
||||
L C C3
|
||||
U 1 1 52FB0F99
|
||||
P 6900 3550
|
||||
F 0 "C3" H 6950 3650 50 0000 L CNN
|
||||
F 1 "104" H 6950 3450 50 0000 L CNN
|
||||
F 2 "" H 6900 3550 60 0000 C CNN
|
||||
F 3 "" H 6900 3550 60 0000 C CNN
|
||||
1 6900 3550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6900 3200 6900 3350
|
||||
Wire Wire Line
|
||||
6900 3750 6900 3900
|
||||
Wire Wire Line
|
||||
6900 3900 6500 3900
|
||||
Connection ~ 6500 3900
|
||||
Wire Wire Line
|
||||
6500 3200 6900 3200
|
||||
Connection ~ 6500 3200
|
||||
Text Label 6500 3200 2 60 ~ 0
|
||||
NRST
|
||||
$Comp
|
||||
L +3.3V #PWR09
|
||||
U 1 1 52FB2273
|
||||
P 2150 850
|
||||
F 0 "#PWR09" H 2150 810 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2150 960 30 0000 C CNN
|
||||
F 2 "" H 2150 850 60 0000 C CNN
|
||||
F 3 "" H 2150 850 60 0000 C CNN
|
||||
1 2150 850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 850 2150 850
|
||||
$Comp
|
||||
L GND #PWR010
|
||||
U 1 1 52FB2296
|
||||
P 2150 1000
|
||||
F 0 "#PWR010" H 2150 1000 30 0001 C CNN
|
||||
F 1 "GND" H 2150 930 30 0001 C CNN
|
||||
F 2 "" H 2150 1000 60 0000 C CNN
|
||||
F 3 "" H 2150 1000 60 0000 C CNN
|
||||
1 2150 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 950 2150 950
|
||||
Wire Wire Line
|
||||
2150 950 2150 1000
|
||||
Wire Wire Line
|
||||
2600 3050 3000 3050
|
||||
Wire Wire Line
|
||||
2750 3050 2750 2850
|
||||
Connection ~ 2750 2850
|
||||
$Comp
|
||||
L +3.3V #PWR011
|
||||
U 1 1 52FB26FA
|
||||
P 2600 3000
|
||||
F 0 "#PWR011" H 2600 2960 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2600 3110 30 0000 C CNN
|
||||
F 2 "" H 2600 3000 60 0000 C CNN
|
||||
F 3 "" H 2600 3000 60 0000 C CNN
|
||||
1 2600 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2600 3000 2600 3050
|
||||
Connection ~ 2750 3050
|
||||
$Comp
|
||||
L +3.3V #PWR012
|
||||
U 1 1 52FB286D
|
||||
P 4000 750
|
||||
F 0 "#PWR012" H 4000 710 30 0001 C CNN
|
||||
F 1 "+3.3V" H 4000 860 30 0000 C CNN
|
||||
F 2 "" H 4000 750 60 0000 C CNN
|
||||
F 3 "" H 4000 750 60 0000 C CNN
|
||||
1 4000 750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR013
|
||||
U 1 1 52FB287C
|
||||
P 4000 1300
|
||||
F 0 "#PWR013" H 4000 1300 30 0001 C CNN
|
||||
F 1 "GND" H 4000 1230 30 0001 C CNN
|
||||
F 2 "" H 4000 1300 60 0000 C CNN
|
||||
F 3 "" H 4000 1300 60 0000 C CNN
|
||||
1 4000 1300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4000 1300 4000 1150
|
||||
Wire Wire Line
|
||||
4000 850 4000 750
|
||||
$Comp
|
||||
L CONN_6 P4
|
||||
U 1 1 52FB29A7
|
||||
P 1050 5300
|
||||
F 0 "P4" V 1000 5300 50 0000 C CNN
|
||||
F 1 "CONN_5" V 1100 5300 50 0000 C CNN
|
||||
F 2 "" H 1050 5300 60 0000 C CNN
|
||||
F 3 "" H 1050 5300 60 0000 C CNN
|
||||
1 1050 5300
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Text Notes 800 5750 0 60 ~ 0
|
||||
Motor N enable
|
||||
Text Label 1400 5550 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1400 5450 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1400 5350 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1400 5250 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1400 5150 0 60 ~ 0
|
||||
PB4
|
||||
$Comp
|
||||
L GND #PWR014
|
||||
U 1 1 52FB2B4C
|
||||
P 1800 5150
|
||||
F 0 "#PWR014" H 1800 5150 30 0001 C CNN
|
||||
F 1 "GND" H 1800 5080 30 0001 C CNN
|
||||
F 2 "" H 1800 5150 60 0000 C CNN
|
||||
F 3 "" H 1800 5150 60 0000 C CNN
|
||||
1 1800 5150
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1400 5050 1800 5050
|
||||
Wire Wire Line
|
||||
1800 5050 1800 5150
|
||||
$Comp
|
||||
L CONN_3 K1
|
||||
U 1 1 52FB2C32
|
||||
P 1050 6100
|
||||
F 0 "K1" V 1000 6100 50 0000 C CNN
|
||||
F 1 "CONN_3" V 1100 6100 40 0000 C CNN
|
||||
F 2 "" H 1050 6100 60 0000 C CNN
|
||||
F 3 "" H 1050 6100 60 0000 C CNN
|
||||
1 1050 6100
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Text Notes 700 6400 0 60 ~ 0
|
||||
All motors DIR/CLK
|
||||
Text Label 1400 6000 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 1400 6100 0 60 ~ 0
|
||||
PB5
|
||||
$Comp
|
||||
L +3.3V #PWR015
|
||||
U 1 1 52FB2C41
|
||||
P 1850 6200
|
||||
F 0 "#PWR015" H 1850 6160 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1850 6310 30 0000 C CNN
|
||||
F 2 "" H 1850 6200 60 0000 C CNN
|
||||
F 3 "" H 1850 6200 60 0000 C CNN
|
||||
1 1850 6200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1400 6200 1850 6200
|
||||
Text Notes 750 6000 0 60 ~ 0
|
||||
CLK
|
||||
Text Notes 750 6100 0 60 ~ 0
|
||||
DIR
|
||||
Text Notes 750 6250 0 60 ~ 0
|
||||
VDD
|
||||
Text Notes 700 5050 0 60 ~ 0
|
||||
GND
|
||||
Text Notes 700 5150 0 60 ~ 0
|
||||
EN4
|
||||
Text Notes 700 5250 0 60 ~ 0
|
||||
EN3
|
||||
Text Notes 700 5350 0 60 ~ 0
|
||||
EN2
|
||||
Text Notes 700 5450 0 60 ~ 0
|
||||
EN1
|
||||
Text Notes 700 5550 0 60 ~ 0
|
||||
EN0
|
||||
Wire Notes Line
|
||||
600 500 600 4200
|
||||
Wire Notes Line
|
||||
600 4200 7500 4200
|
||||
Wire Notes Line
|
||||
7500 4200 7500 500
|
||||
Wire Notes Line
|
||||
7500 500 600 500
|
||||
Text Notes 3550 4450 0 118 ~ 0
|
||||
STM8 board
|
||||
$EndSCHEMATC
|
||||
9
stepper/schematic/stm8s105k4t6c.bck
Normal file
9
stepper/schematic/stm8s105k4t6c.bck
Normal file
@ -0,0 +1,9 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:09:58
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
13
stepper/schematic/stm8s105k4t6c.dcm
Normal file
13
stepper/schematic/stm8s105k4t6c.dcm
Normal file
@ -0,0 +1,13 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:26:38
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
$CMP STM8S105K4T6C
|
||||
K stm8
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
99
stepper/schematic/stm8s105k4t6c.lib
Normal file
99
stepper/schematic/stm8s105k4t6c.lib
Normal file
@ -0,0 +1,99 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Вт 11 фев 2014 17:26:38
|
||||
#encoding utf-8
|
||||
#
|
||||
# STM8S003K3T
|
||||
#
|
||||
DEF STM8S003K3T IC 0 40 Y Y 1 F N
|
||||
F0 "IC" -800 1150 60 H V C CNN
|
||||
F1 "STM8S003K3T" 550 -1100 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LQFP32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -850 1100 850 -1050 0 1 10 f
|
||||
X NRST 1 -1000 1000 149 R 40 40 1 1 I
|
||||
X OSCI/PA1 2 1000 1000 149 L 40 40 1 1 B
|
||||
X OSCOUT/PA2 3 1000 900 149 L 40 40 1 1 B
|
||||
X VSS 4 0 -1200 149 U 40 40 1 1 W
|
||||
X Vcap 5 -1000 -950 149 R 40 40 1 1 I
|
||||
X VDD 6 0 1250 149 D 40 40 1 1 W
|
||||
X [SPI_NSS]TIM2_CH3/PA3 7 1000 800 149 L 40 40 1 1 B
|
||||
X PF4 8 -1000 -350 149 R 40 40 1 1 B
|
||||
X PB7 9 1000 -50 149 L 40 40 1 1 B
|
||||
X PB6 10 1000 50 149 L 40 40 1 1 B
|
||||
X TIM1_CH3/PC3 20 1000 -400 149 L 40 40 1 1 B
|
||||
X PD5/UART1_TX 30 -1000 150 149 R 40 40 1 1 B
|
||||
X I2C_SDA/PB5 11 1000 150 149 L 40 40 1 1 B
|
||||
X CLK_CCO/TIM1_CH4/PC4 21 1000 -500 149 L 40 40 1 1 B
|
||||
X PD6/UART1_RX 31 -1000 50 149 R 40 40 1 1 B
|
||||
X I2C_SCL/PB4 12 1000 250 149 L 40 40 1 1 B
|
||||
X SPI_SCK/PC5 22 1000 -600 149 L 40 40 1 1 B
|
||||
X PD7/TLI[TIM1_CH4] 32 -1000 -50 148 R 40 40 1 1 B
|
||||
X TIM1_ETR/AIN3/PB3 13 1000 350 149 L 40 40 1 1 B
|
||||
X PI_MOSI/PC6 23 1000 -700 149 L 40 40 1 1 B
|
||||
X TIM1_CH3N/AIN2/PB2 14 1000 450 149 L 40 40 1 1 B
|
||||
X PI_MISO/PC7 24 1000 -800 149 L 40 40 1 1 B
|
||||
X TIM1_CH2N/AIN1/PB1 15 1000 550 149 L 40 40 1 1 B
|
||||
X PD0/TIM1_BKIN[CLK_CCO] 25 -1000 650 148 R 40 40 1 1 B
|
||||
X TIM1_CH1N/AIN0/PB0 16 1000 650 149 L 40 40 1 1 B
|
||||
X PD1/SWIM 26 -1000 550 149 R 40 40 1 1 B
|
||||
X PE5/SPI_NSS 17 -1000 -200 148 R 40 40 1 1 B
|
||||
X PD2[TIM2_CH3] 27 -1000 450 149 R 40 40 1 1 B
|
||||
X UART1_CK/TIM1_CH1/PC1 18 1000 -200 149 L 40 40 1 1 B
|
||||
X PD3/ADC_ETR/TIM2_CH2 28 -1000 350 149 R 40 40 1 1 B
|
||||
X TIM1_CH2/PC2 19 1000 -300 149 L 40 40 1 1 B
|
||||
X PD4/BEEP/TIM2_CH1 29 -1000 250 149 R 40 40 1 1 B
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
204
stepper/schematic/template-cache.lib
Normal file
204
stepper/schematic/template-cache.lib
Normal file
@ -0,0 +1,204 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Ср 12 фев 2014 11:37:03
|
||||
#encoding utf-8
|
||||
#
|
||||
# +3.3V
|
||||
#
|
||||
DEF +3.3V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -40 30 H I C CNN
|
||||
F1 "+3.3V" 0 110 30 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS +3,3V
|
||||
DRAW
|
||||
X +3.3V 1 0 0 0 U 30 30 0 0 W N
|
||||
C 0 60 20 0 1 0 N
|
||||
P 3 0 1 0 0 0 0 40 0 40 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# C
|
||||
#
|
||||
DEF C C 0 10 N Y 1 F N
|
||||
F0 "C" 0 100 40 H V L CNN
|
||||
F1 "C" 6 -85 40 H V L CNN
|
||||
F2 "~" 38 -150 30 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
SM*
|
||||
C?
|
||||
C1-1
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 20 -80 -30 80 -30 N
|
||||
P 2 0 1 20 -80 30 80 30 N
|
||||
X ~ 1 0 200 170 D 40 40 1 1 P
|
||||
X ~ 2 0 -200 170 U 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_14
|
||||
#
|
||||
DEF CONN_14 P 0 40 Y N 1 F N
|
||||
F0 "P" -30 0 60 V V C CNN
|
||||
F1 "CONN_14" 80 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 700 150 -700 0 1 0 N
|
||||
X P1 1 -350 650 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 550 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 450 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 350 250 R 50 50 1 1 P I
|
||||
X P5 5 -350 250 250 R 50 50 1 1 P I
|
||||
X P6 6 -350 150 250 R 50 50 1 1 P I
|
||||
X P7 7 -350 50 250 R 50 50 1 1 P I
|
||||
X P8 8 -350 -50 250 R 50 50 1 1 P I
|
||||
X P9 9 -350 -150 250 R 50 50 1 1 P I
|
||||
X P10 10 -350 -250 250 R 50 50 1 1 P I
|
||||
X P11 11 -350 -350 250 R 50 50 1 1 P I
|
||||
X P12 12 -350 -450 250 R 50 50 1 1 P I
|
||||
X P13 13 -350 -550 250 R 50 50 1 1 P I
|
||||
X P14 14 -350 -650 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_4
|
||||
#
|
||||
DEF CONN_4 P 0 40 Y N 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_4" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 200 100 -200 0 1 0 N
|
||||
X P1 1 -350 150 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 50 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 -50 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 -150 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# GND
|
||||
#
|
||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 0 30 H I C CNN
|
||||
F1 "GND" 0 -70 30 H I C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# LED
|
||||
#
|
||||
DEF LED D 0 40 Y N 1 F N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "LED" 0 -100 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LED-3MM
|
||||
LED-5MM
|
||||
LED-10MM
|
||||
LED-0603
|
||||
LED-0805
|
||||
LED-1206
|
||||
LEDV
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 0 50 50 50 -50 N
|
||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||
P 3 0 1 0 65 -40 110 -80 105 -55 N
|
||||
P 3 0 1 0 80 -25 125 -65 120 -40 N
|
||||
X A 1 -200 0 150 R 40 40 1 1 P
|
||||
X K 2 200 0 150 L 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# R
|
||||
#
|
||||
DEF R R 0 0 N Y 1 F N
|
||||
F0 "R" 80 0 40 V V C CNN
|
||||
F1 "R" 7 1 40 V V C CNN
|
||||
F2 "~" -70 0 30 V V C CNN
|
||||
F3 "~" 0 0 30 H V C CNN
|
||||
$FPLIST
|
||||
R?
|
||||
SM0603
|
||||
SM0805
|
||||
R?-*
|
||||
SM1206
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -40 150 40 -150 0 1 12 N
|
||||
X ~ 1 0 250 100 D 60 60 1 1 P
|
||||
X ~ 2 0 -250 100 U 60 60 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_PUSH
|
||||
#
|
||||
DEF SW_PUSH SW 0 40 N N 1 F N
|
||||
F0 "SW" 150 110 50 H V C CNN
|
||||
F1 "SW_PUSH" 0 -80 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -170 50 170 60 0 1 0 N
|
||||
P 4 0 1 0 -40 60 -30 90 30 90 40 60 N
|
||||
X 1 1 -300 0 200 R 60 60 0 1 P I
|
||||
X 2 2 300 0 200 L 60 60 0 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
94
stepper/schematic/template.cmp
Normal file
94
stepper/schematic/template.cmp
Normal file
@ -0,0 +1,94 @@
|
||||
Cmp-Mod V01 Created by CvPcb (2013-feb-26)-stable date = Ср 12 фев 2014 11:23:52
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0413;
|
||||
Reference = C1;
|
||||
ValeurCmp = 1u;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0426;
|
||||
Reference = C2;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F99;
|
||||
Reference = C3;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DD3;
|
||||
Reference = D1;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ECD;
|
||||
Reference = D2;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A6A;
|
||||
Reference = P1;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A49;
|
||||
Reference = P2;
|
||||
ValeurCmp = CONN_4;
|
||||
IdModule = SIL-4;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A79;
|
||||
Reference = P3;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DE2;
|
||||
Reference = R1;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ED3;
|
||||
Reference = R2;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0EFD;
|
||||
Reference = R3;
|
||||
ValeurCmp = 10k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F3B;
|
||||
Reference = SW1;
|
||||
ValeurCmp = SW_PUSH;
|
||||
IdModule = SM2010;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB03A2;
|
||||
Reference = U1;
|
||||
ValeurCmp = STM8S105K4T6C;
|
||||
IdModule = TQFP32;
|
||||
EndCmp
|
||||
|
||||
EndListe
|
||||
321
stepper/schematic/template.net
Normal file
321
stepper/schematic/template.net
Normal file
@ -0,0 +1,321 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source /home/eddy/Docs/SAO/ELECTRONICS/STM8/stepper/schematic/kicad.sch)
|
||||
(date "Ср 12 фев 2014 11:38:18")
|
||||
(tool "eeschema (2013-feb-26)-stable"))
|
||||
(components
|
||||
(comp (ref U1)
|
||||
(value STM8S105K4T6C)
|
||||
(libsource (lib stm8s105k4t6c) (part STM8S105K4T6C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB03A2))
|
||||
(comp (ref C1)
|
||||
(value 1u)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0413))
|
||||
(comp (ref C2)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0426))
|
||||
(comp (ref P2)
|
||||
(value CONN_4)
|
||||
(libsource (lib conn) (part CONN_4))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A49))
|
||||
(comp (ref P1)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A6A))
|
||||
(comp (ref P3)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A79))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DD3))
|
||||
(comp (ref R1)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DE2))
|
||||
(comp (ref D2)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ECD))
|
||||
(comp (ref R2)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ED3))
|
||||
(comp (ref R3)
|
||||
(value 10k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0EFD))
|
||||
(comp (ref SW1)
|
||||
(value SW_PUSH)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F3B))
|
||||
(comp (ref C3)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F99)))
|
||||
(libparts
|
||||
(libpart (lib device) (part C)
|
||||
(description "Condensateur non polarise")
|
||||
(footprints
|
||||
(fp SM*)
|
||||
(fp C?)
|
||||
(fp C1-1))
|
||||
(fields
|
||||
(field (name Reference) C)
|
||||
(field (name Value) C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part LED)
|
||||
(footprints
|
||||
(fp LED-3MM)
|
||||
(fp LED-5MM)
|
||||
(fp LED-10MM)
|
||||
(fp LED-0603)
|
||||
(fp LED-0805)
|
||||
(fp LED-1206)
|
||||
(fp LEDV))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name A) (type passive))
|
||||
(pin (num 2) (name K) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistance)
|
||||
(footprints
|
||||
(fp R?)
|
||||
(fp SM0603)
|
||||
(fp SM0805)
|
||||
(fp R?-*)
|
||||
(fp SM1206))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part SW_PUSH)
|
||||
(description "Push Button")
|
||||
(fields
|
||||
(field (name Reference) SW)
|
||||
(field (name Value) SW_PUSH)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib conn) (part CONN_14)
|
||||
(description "Symbole general de connexion")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_14))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))
|
||||
(pin (num 5) (name P5) (type passive))
|
||||
(pin (num 6) (name P6) (type passive))
|
||||
(pin (num 7) (name P7) (type passive))
|
||||
(pin (num 8) (name P8) (type passive))
|
||||
(pin (num 9) (name P9) (type passive))
|
||||
(pin (num 10) (name P10) (type passive))
|
||||
(pin (num 11) (name P11) (type passive))
|
||||
(pin (num 12) (name P12) (type passive))
|
||||
(pin (num 13) (name P13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))))
|
||||
(libpart (lib conn) (part CONN_4)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_4))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))))
|
||||
(libpart (lib stm8s105k4t6c) (part STM8S105K4T6C)
|
||||
(footprints
|
||||
(fp lqfp32*))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) STM8S105K4T6C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name NRST) (type input))
|
||||
(pin (num 2) (name OSCIN/PA1) (type 3state))
|
||||
(pin (num 3) (name OSCOUT/PA2) (type 3state))
|
||||
(pin (num 4) (name VSS) (type power_in))
|
||||
(pin (num 5) (name VCAP) (type power_out))
|
||||
(pin (num 6) (name "VDD(3.3-5v)") (type power_in))
|
||||
(pin (num 7) (name VDDio) (type power_in))
|
||||
(pin (num 8) (name PF4/AIN12) (type 3state))
|
||||
(pin (num 9) (name VDDA) (type power_in))
|
||||
(pin (num 10) (name VSSA) (type power_in))
|
||||
(pin (num 11) (name PB5/AIN5[I2X_SDA]) (type 3state))
|
||||
(pin (num 12) (name PB4/AIN4[I2C_SCL]) (type 3state))
|
||||
(pin (num 13) (name PB3/AIN3[TIM1_ETR]) (type 3state))
|
||||
(pin (num 14) (name PB2/AIN2[TIM1_CH3N]) (type 3state))
|
||||
(pin (num 15) (name PB1/AIN1_[TIM1_CH2N]) (type 3state))
|
||||
(pin (num 16) (name PB0/AIN0_[TIM1_CH1N]) (type 3state))
|
||||
(pin (num 17) (name PE5/SPI_NSS) (type 3state))
|
||||
(pin (num 18) (name "PC1(HS)/TIM1_CH1") (type 3state))
|
||||
(pin (num 19) (name "PC2(HS)/TIM1_CH2") (type 3state))
|
||||
(pin (num 20) (name "PC3(HS)/TIM1_CH3") (type 3state))
|
||||
(pin (num 21) (name "PC4(HS)/TIM1_CH4") (type 3state))
|
||||
(pin (num 22) (name "PC5(HS)/SPI_SCK") (type 3state))
|
||||
(pin (num 23) (name "PC6(HS)/SPI_MOSI") (type 3state))
|
||||
(pin (num 24) (name "PC7(HS)/SPI_MISO") (type 3state))
|
||||
(pin (num 25) (name "PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO]") (type 3state))
|
||||
(pin (num 26) (name "PD1(HS)/SWIM") (type 3state))
|
||||
(pin (num 27) (name "PD2(HS)/TIM3_CH1[TIM2_CH3]") (type 3state))
|
||||
(pin (num 28) (name "PD3(HS)/TIM2_CH2[ADC_ETR]") (type 3state))
|
||||
(pin (num 29) (name "PD4(HS)/TIM2_CH1[BEEP]") (type 3state))
|
||||
(pin (num 30) (name PD5/UART2_TX) (type 3state))
|
||||
(pin (num 31) (name PD6/UART2_RX) (type 3state))
|
||||
(pin (num 32) (name PD7/TLI[TIM1_CH4]) (type 3state)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri /usr/share/kicad/library/device.lib))
|
||||
(library (logical conn)
|
||||
(uri /usr/share/kicad/library/conn.lib))
|
||||
(library (logical stm8s105k4t6c)
|
||||
(uri stm8s105k4t6c.lib)))
|
||||
(nets
|
||||
(net (code 1) (name +3.3V)
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref U1) (pin 9))
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref U1) (pin 6))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref D1) (pin 1)))
|
||||
(net (code 2) (name "")
|
||||
(node (ref D1) (pin 2))
|
||||
(node (ref R1) (pin 1)))
|
||||
(net (code 3) (name /PD4)
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref P3) (pin 4)))
|
||||
(net (code 4) (name /PD3)
|
||||
(node (ref P3) (pin 5))
|
||||
(node (ref U1) (pin 28)))
|
||||
(net (code 5) (name /PD2)
|
||||
(node (ref U1) (pin 27))
|
||||
(node (ref P3) (pin 6)))
|
||||
(net (code 6) (name /SWIM/PD1)
|
||||
(node (ref U1) (pin 26))
|
||||
(node (ref P3) (pin 7))
|
||||
(node (ref P2) (pin 2)))
|
||||
(net (code 7) (name /PD0)
|
||||
(node (ref P3) (pin 8))
|
||||
(node (ref U1) (pin 25)))
|
||||
(net (code 8) (name /PC7)
|
||||
(node (ref P3) (pin 9))
|
||||
(node (ref U1) (pin 24)))
|
||||
(net (code 9) (name /PC6)
|
||||
(node (ref U1) (pin 23))
|
||||
(node (ref P3) (pin 10)))
|
||||
(net (code 10) (name /PC5)
|
||||
(node (ref P3) (pin 11))
|
||||
(node (ref U1) (pin 22)))
|
||||
(net (code 11) (name /PC4)
|
||||
(node (ref P3) (pin 12))
|
||||
(node (ref U1) (pin 21)))
|
||||
(net (code 12) (name /PC3)
|
||||
(node (ref U1) (pin 20))
|
||||
(node (ref P3) (pin 13)))
|
||||
(net (code 13) (name /PC2)
|
||||
(node (ref P3) (pin 14))
|
||||
(node (ref U1) (pin 19))
|
||||
(node (ref R1) (pin 2)))
|
||||
(net (code 14) (name GND)
|
||||
(node (ref P2) (pin 4))
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref U1) (pin 10))
|
||||
(node (ref U1) (pin 4))
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref C3) (pin 2))
|
||||
(node (ref P1) (pin 2)))
|
||||
(net (code 15) (name "")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref D2) (pin 2)))
|
||||
(net (code 16) (name /PD5)
|
||||
(node (ref P3) (pin 3))
|
||||
(node (ref U1) (pin 30)))
|
||||
(net (code 17) (name "")
|
||||
(node (ref C1) (pin 2))
|
||||
(node (ref U1) (pin 5)))
|
||||
(net (code 18) (name /OSC2IN)
|
||||
(node (ref P1) (pin 5))
|
||||
(node (ref U1) (pin 3)))
|
||||
(net (code 19) (name /NRST)
|
||||
(node (ref U1) (pin 1))
|
||||
(node (ref R3) (pin 2))
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref P1) (pin 3))
|
||||
(node (ref P2) (pin 3)))
|
||||
(net (code 20) (name /OSC1IN)
|
||||
(node (ref U1) (pin 2))
|
||||
(node (ref P1) (pin 4)))
|
||||
(net (code 21) (name /PF4)
|
||||
(node (ref P1) (pin 6))
|
||||
(node (ref U1) (pin 8)))
|
||||
(net (code 22) (name /PB5)
|
||||
(node (ref P1) (pin 7))
|
||||
(node (ref U1) (pin 11)))
|
||||
(net (code 23) (name /PB4)
|
||||
(node (ref P1) (pin 8))
|
||||
(node (ref U1) (pin 12)))
|
||||
(net (code 24) (name /PB3)
|
||||
(node (ref U1) (pin 13))
|
||||
(node (ref P1) (pin 9)))
|
||||
(net (code 25) (name /PB2)
|
||||
(node (ref P1) (pin 10))
|
||||
(node (ref U1) (pin 14)))
|
||||
(net (code 26) (name /PB1)
|
||||
(node (ref P1) (pin 11))
|
||||
(node (ref U1) (pin 15)))
|
||||
(net (code 27) (name /PB0)
|
||||
(node (ref P1) (pin 12))
|
||||
(node (ref U1) (pin 16)))
|
||||
(net (code 28) (name /PE5)
|
||||
(node (ref P1) (pin 13))
|
||||
(node (ref U1) (pin 17)))
|
||||
(net (code 29) (name /PC1)
|
||||
(node (ref P1) (pin 14))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 30) (name /PD7)
|
||||
(node (ref U1) (pin 32))
|
||||
(node (ref P3) (pin 1)))
|
||||
(net (code 31) (name /PD6)
|
||||
(node (ref U1) (pin 31))
|
||||
(node (ref P3) (pin 2)))))
|
||||
518
stepper/schematic/template.sch
Normal file
518
stepper/schematic/template.sch
Normal file
@ -0,0 +1,518 @@
|
||||
EESchema Schematic File Version 2 date Ср 12 фев 2014 11:37:03
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:special
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:stm8
|
||||
LIBS:st-microelectronics
|
||||
LIBS:stm8s105k4t6c
|
||||
LIBS:kicad-cache
|
||||
EELAYER 27 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date "12 feb 2014"
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L STM8S105K4T6C U1
|
||||
U 1 1 52FB03A2
|
||||
P 4400 3100
|
||||
F 0 "U1" H 4400 4150 60 0000 C CNN
|
||||
F 1 "STM8S105K4T6C" H 4450 2250 60 0000 C CNN
|
||||
F 2 "~" H 4400 3100 60 0000 C CNN
|
||||
F 3 "~" H 4400 3100 60 0000 C CNN
|
||||
1 4400 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR01
|
||||
U 1 1 52FB03EF
|
||||
P 2750 3200
|
||||
F 0 "#PWR01" H 2750 3200 30 0001 C CNN
|
||||
F 1 "GND" H 2750 3130 30 0001 C CNN
|
||||
F 2 "" H 2750 3200 60 0000 C CNN
|
||||
F 3 "" H 2750 3200 60 0000 C CNN
|
||||
1 2750 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 3200 2750 3150
|
||||
Wire Wire Line
|
||||
2750 3150 3000 3150
|
||||
$Comp
|
||||
L GND #PWR02
|
||||
U 1 1 52FB0400
|
||||
P 2750 2600
|
||||
F 0 "#PWR02" H 2750 2600 30 0001 C CNN
|
||||
F 1 "GND" H 2750 2530 30 0001 C CNN
|
||||
F 2 "" H 2750 2600 60 0000 C CNN
|
||||
F 3 "" H 2750 2600 60 0000 C CNN
|
||||
1 2750 2600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 2600 2750 2550
|
||||
Wire Wire Line
|
||||
2750 2550 3000 2550
|
||||
$Comp
|
||||
L C C1
|
||||
U 1 1 52FB0413
|
||||
P 2250 2700
|
||||
F 0 "C1" H 2300 2800 50 0000 L CNN
|
||||
F 1 "1u" H 2300 2600 50 0000 L CNN
|
||||
F 2 "" H 2250 2700 60 0000 C CNN
|
||||
F 3 "" H 2250 2700 60 0000 C CNN
|
||||
1 2250 2700
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L C C2
|
||||
U 1 1 52FB0426
|
||||
P 2250 2950
|
||||
F 0 "C2" H 2300 3050 50 0000 L CNN
|
||||
F 1 "104" H 2300 2850 50 0000 L CNN
|
||||
F 2 "" H 2250 2950 60 0000 C CNN
|
||||
F 3 "" H 2250 2950 60 0000 C CNN
|
||||
1 2250 2950
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2450 2700 2850 2700
|
||||
Wire Wire Line
|
||||
2850 2700 2850 2650
|
||||
Wire Wire Line
|
||||
2850 2650 3000 2650
|
||||
Wire Wire Line
|
||||
3000 2750 3000 2850
|
||||
Wire Wire Line
|
||||
2450 2950 2450 2850
|
||||
Wire Wire Line
|
||||
2450 2850 3000 2850
|
||||
Wire Wire Line
|
||||
2050 2700 2050 3100
|
||||
$Comp
|
||||
L GND #PWR03
|
||||
U 1 1 52FB0453
|
||||
P 2050 3100
|
||||
F 0 "#PWR03" H 2050 3100 30 0001 C CNN
|
||||
F 1 "GND" H 2050 3030 30 0001 C CNN
|
||||
F 2 "" H 2050 3100 60 0000 C CNN
|
||||
F 3 "" H 2050 3100 60 0000 C CNN
|
||||
1 2050 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 2050 2800
|
||||
Connection ~ 2050 2950
|
||||
Text Label 3000 2250 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 3000 2350 2 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 3000 2450 2 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 3000 2950 2 60 ~ 0
|
||||
PF4
|
||||
Text Label 3000 3250 2 60 ~ 0
|
||||
PB5
|
||||
Text Label 3000 3350 2 60 ~ 0
|
||||
PB4
|
||||
Text Label 3000 3450 2 60 ~ 0
|
||||
PB3
|
||||
Text Label 3000 3550 2 60 ~ 0
|
||||
PB2
|
||||
Text Label 3000 3650 2 60 ~ 0
|
||||
PB1
|
||||
Text Label 3000 3750 2 60 ~ 0
|
||||
PB0
|
||||
Text Label 5800 3750 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 5800 3650 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 5800 3550 0 60 ~ 0
|
||||
PC2
|
||||
Text Label 5800 3450 0 60 ~ 0
|
||||
PC3
|
||||
Text Label 5800 3350 0 60 ~ 0
|
||||
PC4
|
||||
Text Label 5800 3250 0 60 ~ 0
|
||||
PC5
|
||||
Text Label 5800 3150 0 60 ~ 0
|
||||
PC6
|
||||
Text Label 5800 3050 0 60 ~ 0
|
||||
PC7
|
||||
Text Label 5800 2950 0 60 ~ 0
|
||||
PD0
|
||||
Text Label 5800 2850 0 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 5800 2750 0 60 ~ 0
|
||||
PD2
|
||||
Text Label 5800 2650 0 60 ~ 0
|
||||
PD3
|
||||
Text Label 5800 2550 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 5800 2450 0 60 ~ 0
|
||||
PD5
|
||||
Text Label 5800 2350 0 60 ~ 0
|
||||
PD6
|
||||
Text Label 5800 2250 0 60 ~ 0
|
||||
PD7
|
||||
$Comp
|
||||
L CONN_4 P2
|
||||
U 1 1 52FB0A49
|
||||
P 4350 1000
|
||||
F 0 "P2" V 4300 1000 50 0000 C CNN
|
||||
F 1 "CONN_4" V 4400 1000 50 0000 C CNN
|
||||
F 2 "" H 4350 1000 60 0000 C CNN
|
||||
F 3 "" H 4350 1000 60 0000 C CNN
|
||||
1 4350 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P1
|
||||
U 1 1 52FB0A6A
|
||||
P 1250 1500
|
||||
F 0 "P1" V 1220 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 1330 1500 60 0000 C CNN
|
||||
F 2 "" H 1250 1500 60 0000 C CNN
|
||||
F 3 "" H 1250 1500 60 0000 C CNN
|
||||
1 1250 1500
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P3
|
||||
U 1 1 52FB0A79
|
||||
P 7100 1500
|
||||
F 0 "P3" V 7070 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 7180 1500 60 0000 C CNN
|
||||
F 2 "" H 7100 1500 60 0000 C CNN
|
||||
F 3 "" H 7100 1500 60 0000 C CNN
|
||||
1 7100 1500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Text Label 1600 1150 0 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 1600 1250 0 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 1600 1350 0 60 ~ 0
|
||||
PF4
|
||||
Text Label 1600 1450 0 60 ~ 0
|
||||
PB5
|
||||
Text Label 1600 1550 0 60 ~ 0
|
||||
PB4
|
||||
Text Label 1600 1650 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1600 1750 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1600 1850 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1600 1950 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1600 2050 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 1600 2150 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 1600 1050 0 60 ~ 0
|
||||
NRST
|
||||
Text Label 4000 950 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 4000 1050 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 6750 850 2 60 ~ 0
|
||||
PD7
|
||||
Text Label 6750 950 2 60 ~ 0
|
||||
PD6
|
||||
Text Label 6750 1050 2 60 ~ 0
|
||||
PD5
|
||||
Text Label 6750 1150 2 60 ~ 0
|
||||
PD4
|
||||
Text Label 6750 1250 2 60 ~ 0
|
||||
PD3
|
||||
Text Label 6750 1350 2 60 ~ 0
|
||||
PD2
|
||||
Text Label 6750 1450 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 6750 1550 2 60 ~ 0
|
||||
PD0
|
||||
Text Label 6750 1650 2 60 ~ 0
|
||||
PC7
|
||||
Text Label 6750 1750 2 60 ~ 0
|
||||
PC6
|
||||
Text Label 6750 1850 2 60 ~ 0
|
||||
PC5
|
||||
Text Label 6750 1950 2 60 ~ 0
|
||||
PC4
|
||||
Text Label 6750 2050 2 60 ~ 0
|
||||
PC3
|
||||
Text Label 6750 2150 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR04
|
||||
U 1 1 52FB0DC4
|
||||
P 950 2800
|
||||
F 0 "#PWR04" H 950 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 950 2910 30 0000 C CNN
|
||||
F 2 "" H 950 2800 60 0000 C CNN
|
||||
F 3 "" H 950 2800 60 0000 C CNN
|
||||
1 950 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D1
|
||||
U 1 1 52FB0DD3
|
||||
P 950 3100
|
||||
F 0 "D1" H 950 3200 50 0000 C CNN
|
||||
F 1 "LED" H 950 3000 50 0000 C CNN
|
||||
F 2 "" H 950 3100 60 0000 C CNN
|
||||
F 3 "" H 950 3100 60 0000 C CNN
|
||||
1 950 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 52FB0DE2
|
||||
P 950 3600
|
||||
F 0 "R1" V 1030 3600 50 0000 C CNN
|
||||
F 1 "1k" V 950 3600 50 0000 C CNN
|
||||
F 2 "" H 950 3600 60 0000 C CNN
|
||||
F 3 "" H 950 3600 60 0000 C CNN
|
||||
1 950 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
950 2800 950 2900
|
||||
Wire Wire Line
|
||||
950 3300 950 3350
|
||||
Wire Wire Line
|
||||
950 3850 950 3950
|
||||
$Comp
|
||||
L +3.3V #PWR05
|
||||
U 1 1 52FB0EC7
|
||||
P 1300 2800
|
||||
F 0 "#PWR05" H 1300 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1300 2910 30 0000 C CNN
|
||||
F 2 "" H 1300 2800 60 0000 C CNN
|
||||
F 3 "" H 1300 2800 60 0000 C CNN
|
||||
1 1300 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D2
|
||||
U 1 1 52FB0ECD
|
||||
P 1300 3100
|
||||
F 0 "D2" H 1300 3200 50 0000 C CNN
|
||||
F 1 "LED" H 1300 3000 50 0000 C CNN
|
||||
F 2 "" H 1300 3100 60 0000 C CNN
|
||||
F 3 "" H 1300 3100 60 0000 C CNN
|
||||
1 1300 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 52FB0ED3
|
||||
P 1300 3600
|
||||
F 0 "R2" V 1380 3600 50 0000 C CNN
|
||||
F 1 "1k" V 1300 3600 50 0000 C CNN
|
||||
F 2 "" H 1300 3600 60 0000 C CNN
|
||||
F 3 "" H 1300 3600 60 0000 C CNN
|
||||
1 1300 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR06
|
||||
U 1 1 52FB0ED9
|
||||
P 1300 3950
|
||||
F 0 "#PWR06" H 1300 3950 30 0001 C CNN
|
||||
F 1 "GND" H 1300 3880 30 0001 C CNN
|
||||
F 2 "" H 1300 3950 60 0000 C CNN
|
||||
F 3 "" H 1300 3950 60 0000 C CNN
|
||||
1 1300 3950
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 2800 1300 2900
|
||||
Wire Wire Line
|
||||
1300 3300 1300 3350
|
||||
Wire Wire Line
|
||||
1300 3850 1300 3950
|
||||
Text Label 950 3950 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR07
|
||||
U 1 1 52FB0EF1
|
||||
P 6500 2550
|
||||
F 0 "#PWR07" H 6500 2510 30 0001 C CNN
|
||||
F 1 "+3.3V" H 6500 2660 30 0000 C CNN
|
||||
F 2 "" H 6500 2550 60 0000 C CNN
|
||||
F 3 "" H 6500 2550 60 0000 C CNN
|
||||
1 6500 2550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 52FB0EFD
|
||||
P 6500 2900
|
||||
F 0 "R3" V 6580 2900 50 0000 C CNN
|
||||
F 1 "10k" V 6500 2900 50 0000 C CNN
|
||||
F 2 "" H 6500 2900 60 0000 C CNN
|
||||
F 3 "" H 6500 2900 60 0000 C CNN
|
||||
1 6500 2900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR08
|
||||
U 1 1 52FB0F03
|
||||
P 6500 4050
|
||||
F 0 "#PWR08" H 6500 4050 30 0001 C CNN
|
||||
F 1 "GND" H 6500 3980 30 0001 C CNN
|
||||
F 2 "" H 6500 4050 60 0000 C CNN
|
||||
F 3 "" H 6500 4050 60 0000 C CNN
|
||||
1 6500 4050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 2550 6500 2650
|
||||
Wire Wire Line
|
||||
6500 3850 6500 4050
|
||||
$Comp
|
||||
L SW_PUSH SW1
|
||||
U 1 1 52FB0F3B
|
||||
P 6500 3550
|
||||
F 0 "SW1" H 6650 3660 50 0000 C CNN
|
||||
F 1 "SW_PUSH" H 6500 3470 50 0000 C CNN
|
||||
F 2 "" H 6500 3550 60 0000 C CNN
|
||||
F 3 "" H 6500 3550 60 0000 C CNN
|
||||
1 6500 3550
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 3250 6500 3150
|
||||
$Comp
|
||||
L C C3
|
||||
U 1 1 52FB0F99
|
||||
P 6900 3550
|
||||
F 0 "C3" H 6950 3650 50 0000 L CNN
|
||||
F 1 "104" H 6950 3450 50 0000 L CNN
|
||||
F 2 "" H 6900 3550 60 0000 C CNN
|
||||
F 3 "" H 6900 3550 60 0000 C CNN
|
||||
1 6900 3550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6900 3200 6900 3350
|
||||
Wire Wire Line
|
||||
6900 3750 6900 3900
|
||||
Wire Wire Line
|
||||
6900 3900 6500 3900
|
||||
Connection ~ 6500 3900
|
||||
Wire Wire Line
|
||||
6500 3200 6900 3200
|
||||
Connection ~ 6500 3200
|
||||
Text Label 6500 3200 2 60 ~ 0
|
||||
NRST
|
||||
$Comp
|
||||
L +3.3V #PWR09
|
||||
U 1 1 52FB2273
|
||||
P 2150 850
|
||||
F 0 "#PWR09" H 2150 810 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2150 960 30 0000 C CNN
|
||||
F 2 "" H 2150 850 60 0000 C CNN
|
||||
F 3 "" H 2150 850 60 0000 C CNN
|
||||
1 2150 850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 850 2150 850
|
||||
$Comp
|
||||
L GND #PWR010
|
||||
U 1 1 52FB2296
|
||||
P 2150 1000
|
||||
F 0 "#PWR010" H 2150 1000 30 0001 C CNN
|
||||
F 1 "GND" H 2150 930 30 0001 C CNN
|
||||
F 2 "" H 2150 1000 60 0000 C CNN
|
||||
F 3 "" H 2150 1000 60 0000 C CNN
|
||||
1 2150 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 950 2150 950
|
||||
Wire Wire Line
|
||||
2150 950 2150 1000
|
||||
Wire Wire Line
|
||||
2600 3050 3000 3050
|
||||
Wire Wire Line
|
||||
2750 3050 2750 2850
|
||||
Connection ~ 2750 2850
|
||||
$Comp
|
||||
L +3.3V #PWR011
|
||||
U 1 1 52FB26FA
|
||||
P 2600 3000
|
||||
F 0 "#PWR011" H 2600 2960 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2600 3110 30 0000 C CNN
|
||||
F 2 "" H 2600 3000 60 0000 C CNN
|
||||
F 3 "" H 2600 3000 60 0000 C CNN
|
||||
1 2600 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2600 3000 2600 3050
|
||||
Connection ~ 2750 3050
|
||||
$Comp
|
||||
L +3.3V #PWR012
|
||||
U 1 1 52FB286D
|
||||
P 4000 750
|
||||
F 0 "#PWR012" H 4000 710 30 0001 C CNN
|
||||
F 1 "+3.3V" H 4000 860 30 0000 C CNN
|
||||
F 2 "" H 4000 750 60 0000 C CNN
|
||||
F 3 "" H 4000 750 60 0000 C CNN
|
||||
1 4000 750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR013
|
||||
U 1 1 52FB287C
|
||||
P 4000 1300
|
||||
F 0 "#PWR013" H 4000 1300 30 0001 C CNN
|
||||
F 1 "GND" H 4000 1230 30 0001 C CNN
|
||||
F 2 "" H 4000 1300 60 0000 C CNN
|
||||
F 3 "" H 4000 1300 60 0000 C CNN
|
||||
1 4000 1300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4000 1300 4000 1150
|
||||
Wire Wire Line
|
||||
4000 850 4000 750
|
||||
$EndSCHEMATC
|
||||
126
stepper/stepper.c
Normal file
126
stepper/stepper.c
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* stepper.c
|
||||
*
|
||||
* Copyright 2014 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 "ports_definition.h"
|
||||
#include "stepper.h"
|
||||
|
||||
U8 Ustepping = 4; // 2^Ustepping = N of microsteps
|
||||
volatile long Nsteps = 0; // Number of steps
|
||||
U8 Motor_number = 5; // Number of motor to move, 5 -- not moving
|
||||
U16 Stepper_speed = 0; // length of one MICROstep in us
|
||||
|
||||
/**
|
||||
* Setup pins of stepper motor (all - PP out)
|
||||
*/
|
||||
void setup_stepper_pins(){
|
||||
// CLK
|
||||
PORT(STP_CLK_PORT, DDR) |= STP_CLK_PIN;
|
||||
PORT(STP_CLK_PORT, CR1) |= STP_CLK_PIN;
|
||||
// EN
|
||||
PORT(STP_EN_PORT, DDR) |= STP_EN_MASK;
|
||||
PORT(STP_EN_PORT, CR1) |= STP_EN_MASK;
|
||||
// DIR
|
||||
PORT(STP_DIR_PORT, DDR) |= STP_DIR_PIN;
|
||||
PORT(STP_DIR_PORT, CR1) |= STP_DIR_PIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set speed of stepper motor
|
||||
* @param Sps - period (in us) of one MICROstep
|
||||
*/
|
||||
void set_stepper_speed(U16 SpS){
|
||||
Stepper_speed = SpS;
|
||||
// Configure timer 2 to generate signals for CLK
|
||||
TIM2_PSCR = 4; // 1MHz
|
||||
//SpS >>= Ustepping; // divide to microsteps
|
||||
TIM2_ARRH = SpS >> 8; // set speed
|
||||
TIM2_ARRL = SpS & 0xff;
|
||||
SpS >>= 1;// divide to 2 - 50% duty cycle
|
||||
TIM2_CCR1H = SpS >> 8;
|
||||
TIM2_CCR1L = SpS & 0xff;
|
||||
// channel 1 generates PWM pulses
|
||||
TIM2_CCMR1 = 0x60; // OC1M = 110b - PWM mode 1 ( 1 -> 0)
|
||||
TIM2_CCER1 = 1; // Channel 1 is on. Active is high
|
||||
//TIM2_IER = TIM_IER_UIE | TIM_IER_CC1IE; // update interrupt enable
|
||||
TIM2_IER = TIM_IER_UIE; // update interrupt enable
|
||||
TIM2_CR1 |= TIM_CR1_APRE | TIM_CR1_URS; // auto reload + interrupt on overflow & RUN
|
||||
}
|
||||
|
||||
void move_motor(int Steps){
|
||||
if(Motor_number > 4) return;
|
||||
if(Steps < 0){
|
||||
PORT(STP_DIR_PORT, ODR) &= ~STP_DIR_PIN; // dir to left
|
||||
Steps *= -1;
|
||||
}
|
||||
Nsteps = (long)Steps << Ustepping;
|
||||
PORT(STP_EN_PORT, ODR) |= 1 << Motor_number; // enable moving
|
||||
TIM2_CR1 |= TIM_CR1_CEN; // turn on timer
|
||||
}
|
||||
|
||||
void stop_motor(){
|
||||
TIM2_CR1 &= ~TIM_CR1_CEN; // Turn off timer
|
||||
PORT(STP_EN_PORT, ODR) &= ~STP_EN_MASK; // disable moving
|
||||
PORT(STP_DIR_PORT, ODR) |= STP_DIR_PIN; // turn off DIR
|
||||
Nsteps = 0;
|
||||
Motor_number = 5; // All OK. Motors are stopped
|
||||
uart_write("stop\n");
|
||||
}
|
||||
|
||||
void pause_resume(){
|
||||
if(Nsteps == 0) return; // motor is stopped
|
||||
if(TIM2_CR1 & TIM_CR1_CEN){ // pause
|
||||
TIM2_CR1 &= ~TIM_CR1_CEN;
|
||||
uart_write("pause\n");
|
||||
}else{ // resume
|
||||
TIM2_CR1 |= TIM_CR1_CEN;
|
||||
uart_write("resume\n");
|
||||
}
|
||||
}
|
||||
|
||||
void add_steps(int Steps){
|
||||
long S;
|
||||
U8 sign = 0;
|
||||
// pause
|
||||
TIM2_CR1 &= ~TIM_CR1_CEN;
|
||||
if(Motor_number == 5){ // motors are stopped - just move last active motor
|
||||
move_motor(Steps);
|
||||
return;
|
||||
}
|
||||
// if(PORT(STP_DIR_PORT, IDR) & STP_DIR_PIN) // left direction
|
||||
// Nsteps *= -1L;
|
||||
if(Steps < 0){
|
||||
sign = 1;
|
||||
Steps *= -1;
|
||||
}
|
||||
S = (long)Steps << Ustepping;
|
||||
if(sign)
|
||||
S *= -1L;
|
||||
Nsteps += S;
|
||||
// now change direction
|
||||
if(Nsteps < 0){
|
||||
uart_write("reverce\n");
|
||||
PORT(STP_DIR_PORT, ODR) ^= STP_DIR_PIN; // go to the opposite side
|
||||
Nsteps *= -1L;
|
||||
}
|
||||
// resume if Nsteps != 0
|
||||
if(Nsteps)
|
||||
TIM2_CR1 |= TIM_CR1_CEN;
|
||||
}
|
||||
41
stepper/stepper.h
Normal file
41
stepper/stepper.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* stepper.h
|
||||
*
|
||||
* Copyright 2014 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
|
||||
extern U8 Ustepping;
|
||||
extern volatile long Nsteps;
|
||||
extern U8 Motor_number;
|
||||
extern U16 Stepper_speed;
|
||||
|
||||
void setup_stepper_pins();
|
||||
void set_stepper_speed(U16 SpS);
|
||||
void move_motor(int Steps);
|
||||
void stop_motor();
|
||||
void pause_resume();
|
||||
void add_steps(int Steps);
|
||||
|
||||
#endif // __STEPPER_H__
|
||||
BIN
stepper/testproj.bin
Normal file
BIN
stepper/testproj.bin
Normal file
Binary file not shown.
39
stepper_independent/Makefile
Normal file
39
stepper_independent/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
HEX2BIN=hex2bin
|
||||
|
||||
CCFLAGS=-DSTM8S105 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -mstm8 --out-fmt-ihx -lstm8
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s105
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h Makefile
|
||||
|
||||
all: $(NAME).bin
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
@echo $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).bin
|
||||
stm8flash $(FLASHFLAGS) -wf $(NAME).bin
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
$(NAME).bin: $(NAME).ihx
|
||||
$(HEX2BIN) -p 00 $<
|
||||
|
||||
.PHONY: all
|
||||
13
stepper_independent/README
Normal file
13
stepper_independent/README
Normal file
@ -0,0 +1,13 @@
|
||||
This is a simple example of INDEPENDENT management of 3 stepper motors.
|
||||
All motors have independent lines DIR and CLK and common line EN.
|
||||
Communication with MCU realized through simple USB<->TTL converter.
|
||||
Just connect lines Rx/Tx of converter to Tx/Rx of evaluation boart,
|
||||
connect together lines GND and +3.3V.
|
||||
Communication speed: 57600, proto: 8N1
|
||||
Comminication with MCU don't need special soft: you can even run screen session
|
||||
or some terminal client like _com_. Another wariant is a simple client - client-term.
|
||||
MCU itself can print to terminal a short help about its protocol, just sent letter 'h'
|
||||
to it.
|
||||
|
||||
!!! ALL "steps" suppose to be single pulses, you should convert them into real !!!
|
||||
!!! steps (dividing by microstepping) in your own soft !!!
|
||||
22
stepper_independent/client-term/Makefile
Normal file
22
stepper_independent/client-term/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
PROGRAM = client
|
||||
LDFLAGS =
|
||||
SRCS = client.c
|
||||
CC = gcc
|
||||
DEFINES = -D_XOPEN_SOURCE=501
|
||||
CXX = gcc
|
||||
CFLAGS = -Wall -Werror $(DEFINES)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
all : $(PROGRAM) clean
|
||||
$(PROGRAM) : $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
|
||||
|
||||
# some addition dependencies
|
||||
# %.o: %.c
|
||||
# $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@
|
||||
#$(SRCS) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
# @touch $@
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o *~
|
||||
depend:
|
||||
$(CXX) -MM $(CXX.SRCS)
|
||||
222
stepper_independent/client-term/client.c
Normal file
222
stepper_independent/client-term/client.c
Normal file
@ -0,0 +1,222 @@
|
||||
/*
|
||||
* client.c - simple terminal client
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 <termios.h> // tcsetattr
|
||||
#include <unistd.h> // tcsetattr, close, read, write
|
||||
#include <sys/ioctl.h> // ioctl
|
||||
#include <stdio.h> // printf, getchar, fopen, perror
|
||||
#include <stdlib.h> // exit
|
||||
#include <sys/stat.h> // read
|
||||
#include <fcntl.h> // read
|
||||
#include <signal.h> // signal
|
||||
#include <time.h> // time
|
||||
#include <string.h> // memcpy
|
||||
#include <stdint.h> // int types
|
||||
#include <sys/time.h> // gettimeofday
|
||||
|
||||
double t0; // start time
|
||||
|
||||
FILE *fout = NULL; // file for messages duplicating
|
||||
char *comdev = "/dev/ttyUSB0";
|
||||
int BAUD_RATE = B57600;
|
||||
struct termio oldtty, tty; // TTY flags
|
||||
struct termios oldt, newt; // terminal flags
|
||||
int comfd; // TTY fd
|
||||
|
||||
/**
|
||||
* function for different purposes that need to know time intervals
|
||||
* @return double value: time in seconds
|
||||
*/
|
||||
double dtime(){
|
||||
double t;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
t = tv.tv_sec + ((double)tv.tv_usec)/1e6;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit & return terminal to old state
|
||||
* @param ex_stat - status (return code)
|
||||
*/
|
||||
void quit(int ex_stat){
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state
|
||||
ioctl(comfd, TCSANOW, &oldtty ); // return TTY to previous state
|
||||
close(comfd);
|
||||
if(fout) fclose(fout);
|
||||
printf("Exit! (%d)\n", ex_stat);
|
||||
exit(ex_stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open & setup TTY, terminal
|
||||
*/
|
||||
void tty_init(){
|
||||
// terminal without echo
|
||||
tcgetattr(STDIN_FILENO, &oldt);
|
||||
newt = oldt;
|
||||
newt.c_lflag &= ~(ICANON | ECHO);
|
||||
if(tcsetattr(STDIN_FILENO, TCSANOW, &newt) < 0) quit(-2);
|
||||
printf("\nOpen port...\n");
|
||||
if ((comfd = open(comdev,O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0){
|
||||
fprintf(stderr,"Can't use port %s\n",comdev);
|
||||
quit(1);
|
||||
}
|
||||
printf(" OK\nGet current settings...\n");
|
||||
if(ioctl(comfd,TCGETA,&oldtty) < 0) exit(-1); // Get settings
|
||||
tty = oldtty;
|
||||
tty.c_lflag = 0; // ~(ICANON | ECHO | ECHOE | ISIG)
|
||||
tty.c_oflag = 0;
|
||||
tty.c_cflag = BAUD_RATE|CS8|CREAD|CLOCAL; // 9.6k, 8N1, RW, ignore line ctrl
|
||||
tty.c_cc[VMIN] = 0; // non-canonical mode
|
||||
tty.c_cc[VTIME] = 5;
|
||||
if(ioctl(comfd,TCSETA,&tty) < 0) exit(-1); // set new mode
|
||||
printf(" OK\n");
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read character from console without echo
|
||||
* @return char readed
|
||||
*/
|
||||
int read_console(){
|
||||
int rb;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(STDIN_FILENO, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000;
|
||||
retval = select(1, &rfds, NULL, NULL, &tv);
|
||||
if(!retval) rb = 0;
|
||||
else {
|
||||
if(FD_ISSET(STDIN_FILENO, &rfds)) rb = getchar();
|
||||
else rb = 0;
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
|
||||
/**
|
||||
* getchar() without echo
|
||||
* wait until at least one character pressed
|
||||
* @return character readed
|
||||
*/
|
||||
int mygetchar(){ // аналог getchar() без необходимости жать Enter
|
||||
int ret;
|
||||
do ret = read_console();
|
||||
while(ret == 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from TTY
|
||||
* @param buff (o) - buffer for data read
|
||||
* @param length - buffer len
|
||||
* @return amount of readed bytes
|
||||
*/
|
||||
size_t read_tty(uint8_t *buff, size_t length){
|
||||
ssize_t L = 0;
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(comfd, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000; // wait for 10ms
|
||||
retval = select(comfd + 1, &rfds, NULL, NULL, &tv);
|
||||
if (!retval) return 0;
|
||||
if(FD_ISSET(comfd, &rfds)){
|
||||
if((L = read(comfd, buff, length)) < 1) return 0;
|
||||
}
|
||||
return (size_t)L;
|
||||
}
|
||||
|
||||
void help(){
|
||||
printf("Use this commands:\n"
|
||||
"h\tShow this help\n"
|
||||
"q\tQuit\n"
|
||||
);
|
||||
}
|
||||
|
||||
#define dup_pr(...) do{printf(__VA_ARGS__); if(fout) fprintf(fout, __VA_ARGS__);}while(0)
|
||||
|
||||
void con_sig(int rb){
|
||||
uint8_t cmd;
|
||||
if(rb < 1) return;
|
||||
if(rb == 'q') quit(0); // q == exit
|
||||
cmd = (uint8_t) rb;
|
||||
write(comfd, &cmd, 1);
|
||||
/*switch(rb){
|
||||
case 'h':
|
||||
help();
|
||||
break;
|
||||
default:
|
||||
cmd = (uint8_t) rb;
|
||||
write(comfd, &cmd, 1);
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Get integer value from buffer
|
||||
* @param buff (i) - buffer with int
|
||||
* @param len - length of data in buffer (could be 2 or 4)
|
||||
* @return
|
||||
*/
|
||||
uint32_t get_int(uint8_t *buff, size_t len){
|
||||
if(len != 2 && len != 4){
|
||||
fprintf(stdout, "Bad data length!\n");
|
||||
return 0xffffffff;
|
||||
}
|
||||
uint32_t data = 0;
|
||||
uint8_t *i8 = (uint8_t*) &data;
|
||||
if(len == 2) memcpy(i8, buff, 2);
|
||||
else memcpy(i8, buff, 4);
|
||||
return data;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int rb;
|
||||
uint8_t buff[128];
|
||||
size_t L;
|
||||
if(argc == 2){
|
||||
fout = fopen(argv[1], "a");
|
||||
if(!fout){
|
||||
perror("Can't open output file");
|
||||
exit(-1);
|
||||
}
|
||||
setbuf(fout, NULL);
|
||||
}
|
||||
tty_init();
|
||||
signal(SIGTERM, quit); // kill (-15)
|
||||
signal(SIGINT, quit); // ctrl+C
|
||||
signal(SIGQUIT, SIG_IGN); // ctrl+\ .
|
||||
signal(SIGTSTP, SIG_IGN); // ctrl+Z
|
||||
setbuf(stdout, NULL);
|
||||
t0 = dtime();
|
||||
while(1){
|
||||
rb = read_console();
|
||||
if(rb > 0) con_sig(rb);
|
||||
L = read_tty(buff, 127);
|
||||
if(L){
|
||||
buff[L] = 0;
|
||||
printf("%s", buff);
|
||||
if(fout) fprintf(fout, "%zd\t%s\n", time(NULL), buff);
|
||||
}
|
||||
}
|
||||
}
|
||||
181
stepper_independent/interrupts.c
Normal file
181
stepper_independent/interrupts.c
Normal file
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
#define TREG(N, R) TIM##N##_##R
|
||||
|
||||
#define STPR_INTR(X) \
|
||||
if(TREG(X, SR1) & TIM_SR1_UIF){ \
|
||||
TREG(X, SR1) &= ~TIM_SR1_UIF; \
|
||||
if(Nsteps[X-1]){ \
|
||||
if(--Nsteps[X-1] == 0){ \
|
||||
stop_motor(X-1); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
STPR_INTR(1);
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){ // generate pulses for stepper CLK
|
||||
STPR_INTR(2);
|
||||
}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){
|
||||
STPR_INTR(3);
|
||||
}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){
|
||||
U8 rb;
|
||||
if(UART2_SR & UART_SR_RXNE){ // data received
|
||||
rb = UART2_DR; // read received byte & clear RXNE flag
|
||||
while(!(UART2_SR & UART_SR_TXE));
|
||||
UART2_DR = rb; // echo received symbol
|
||||
UART_rx[UART_rx_cur_i++] = rb; // put received byte into cycled buffer
|
||||
if(UART_rx_cur_i == UART_rx_start_i){ // Oops: buffer overflow! Just forget old data
|
||||
UART_rx_start_i++;
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
}
|
||||
check_UART_pointer(UART_rx_cur_i);
|
||||
}
|
||||
}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){
|
||||
if(TIM4_SR & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM4_SR = 0; // clear all interrupt flags
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
144
stepper_independent/interrupts.h
Normal file
144
stepper_independent/interrupts.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
260
stepper_independent/main.c
Normal file
260
stepper_independent/main.c
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
* blinky.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "interrupts.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
/*
|
||||
* 0 0000
|
||||
* 1 0001
|
||||
* 2 0010
|
||||
* 3 0011
|
||||
* 4 0100
|
||||
* 5 0101
|
||||
* 6 0110
|
||||
* 7 0111
|
||||
* 8 1000
|
||||
* 9 1001
|
||||
* a 1010
|
||||
* b 1011
|
||||
* c 1100
|
||||
* d 1101
|
||||
* e 1110
|
||||
* f 1111
|
||||
*/
|
||||
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
U16 paused_val = 500; // interval between LED flashing
|
||||
|
||||
U8 UART_rx[UART_BUF_LEN]; // cycle buffer for received data
|
||||
U8 UART_rx_start_i = 0; // started index of received data (from which reading starts)
|
||||
U8 UART_rx_cur_i = 0; // index of current first byte in rx array (to which data will be written)
|
||||
|
||||
/**
|
||||
* Send one byte through UART
|
||||
* @param byte - data to send
|
||||
*/
|
||||
void UART_send_byte(U8 byte){
|
||||
while(!(UART2_SR & UART_SR_TXE)); // wait until previous byte transmitted
|
||||
UART2_DR = byte;
|
||||
}
|
||||
|
||||
void uart_write(char *str){
|
||||
while(*str){
|
||||
while(!(UART2_SR & UART_SR_TXE));
|
||||
//UART2_CR2 |= UART_CR2_TEN;
|
||||
UART2_DR = *str++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read one byte from Rx buffer
|
||||
* @param byte - where to store readed data
|
||||
* @return 1 in case of non-empty buffer
|
||||
*/
|
||||
U8 UART_read_byte(U8 *byte){
|
||||
if(UART_rx_start_i == UART_rx_cur_i) // buffer is empty
|
||||
return 0;
|
||||
*byte = UART_rx[UART_rx_start_i++];
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void printUint(U8 *val, U8 len){
|
||||
unsigned long Number = 0;
|
||||
U8 i = len;
|
||||
char ch;
|
||||
U8 decimal_buff[12]; // max len of U32 == 10 + \n + \0
|
||||
if(len > 4 || len == 3 || len == 0) return;
|
||||
for(i = 0; i < 12; i++)
|
||||
decimal_buff[i] = 0;
|
||||
decimal_buff[10] = '\n';
|
||||
ch = 9;
|
||||
switch(len){
|
||||
case 1:
|
||||
Number = *((U8*)val);
|
||||
break;
|
||||
case 2:
|
||||
Number = *((U16*)val);
|
||||
break;
|
||||
case 4:
|
||||
Number = *((unsigned long*)val);
|
||||
break;
|
||||
}
|
||||
do{
|
||||
i = Number % 10L;
|
||||
decimal_buff[ch--] = i + '0';
|
||||
Number /= 10L;
|
||||
}while(Number && ch > -1);
|
||||
uart_write((char*)&decimal_buff[ch+1]);
|
||||
}
|
||||
|
||||
U8 readInt(int *val){
|
||||
unsigned long T = Global_time;
|
||||
unsigned long R = 0;
|
||||
int readed;
|
||||
U8 sign = 0, rb, ret = 0, bad = 0;
|
||||
do{
|
||||
if(!UART_read_byte(&rb)) continue;
|
||||
if(rb == '-' && R == 0){ // negative number
|
||||
sign = 1;
|
||||
continue;
|
||||
}
|
||||
if(rb < '0' || rb > '9') break; // number ends with any non-digit symbol that will be omitted
|
||||
ret = 1; // there's at least one digit
|
||||
R = R * 10L + rb - '0';
|
||||
if(R > 0x7fff){ // bad value
|
||||
R = 0;
|
||||
bad = 0;
|
||||
}
|
||||
}while(Global_time - T < 10000); // wait no longer than 10s
|
||||
if(bad || !ret) return 0;
|
||||
readed = (int) R;
|
||||
if(sign) readed *= -1;
|
||||
*val = readed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void error_msg(char *msg){
|
||||
uart_write("\nERROR: ");
|
||||
uart_write(msg);
|
||||
UART_send_byte('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* read motor number
|
||||
* @param N - readed Number
|
||||
* @return 0 in case of error
|
||||
*/
|
||||
U8 get_motor_number(U8 *N){
|
||||
int Ival;
|
||||
if(readInt(&Ival) && Ival > -1 && Ival < 4){
|
||||
*N = (U8) Ival;
|
||||
UART_send_byte('*'); // OK
|
||||
return 1;
|
||||
}else{
|
||||
error_msg("bad motor");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
unsigned long T = 0L;
|
||||
int Ival;
|
||||
U8 rb, Num;
|
||||
CFG_GCR |= 1; // disable SWIM
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
|
||||
// Timer 4 (8 bit) used as system tick timer
|
||||
// prescaler == 128 (2^7), Tfreq = 125kHz
|
||||
// period = 1ms, so ARR = 125
|
||||
TIM4_PSCR = 7;
|
||||
TIM4_ARR = 125;
|
||||
// interrupts: update
|
||||
TIM4_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM4_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
|
||||
// Configure pins
|
||||
// PC2 - PP output (on-board LED)
|
||||
PORT(LED_PORT, DDR) |= LED_PIN;
|
||||
PORT(LED_PORT, CR1) |= LED_PIN;
|
||||
// PD5 - UART2_TX
|
||||
PORT(UART_PORT, DDR) |= UART_TX_PIN;
|
||||
PORT(UART_PORT, CR1) |= UART_TX_PIN;
|
||||
|
||||
// Configure UART
|
||||
// 8 bit, no parity, 1 stop (UART_CR1/3 = 0 - reset value)
|
||||
// 57600 on 16MHz: BRR1=0x11, BRR2=0x06
|
||||
UART2_BRR1 = 0x11; UART2_BRR2 = 0x06;
|
||||
UART2_CR2 = UART_CR2_TEN | UART_CR2_REN | UART_CR2_RIEN; // Allow RX/TX, generate ints on rx
|
||||
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
|
||||
setup_stepper_pins();
|
||||
|
||||
// Loop
|
||||
do{
|
||||
if((Global_time - T > paused_val) || (T > Global_time)){
|
||||
T = Global_time;
|
||||
PORT(LED_PORT, ODR) ^= LED_PIN; // blink on-board LED
|
||||
}
|
||||
if(UART_read_byte(&rb)){ // buffer isn't empty
|
||||
switch(rb){
|
||||
case 'h': // help
|
||||
case 'H':
|
||||
uart_write("\nPROTO:\n+/-\tLED period\nSx/sx\tset/get Mspeed\nmx\tget steps\nXx\tstop\nPx\tpause/resume\n0..3\tmove xth motor\n");
|
||||
break;
|
||||
case '+':
|
||||
paused_val += 100;
|
||||
if(paused_val > 10000)
|
||||
paused_val = 500; // but not more than 10s
|
||||
break;
|
||||
case '-':
|
||||
paused_val -= 100;
|
||||
if(paused_val < 100) // but not less than 0.1s
|
||||
paused_val = 500;
|
||||
break;
|
||||
case 'S': // set stepper speed
|
||||
if(get_motor_number(&Num)){
|
||||
if(readInt(&Ival) && Ival > MIN_STEP_LENGTH)
|
||||
set_stepper_speed(Num, Ival);
|
||||
else
|
||||
error_msg("bad speed");
|
||||
}
|
||||
break;
|
||||
case 's': // get stepper speed
|
||||
if(get_motor_number(&Num))
|
||||
printUint((U8*)&Stepper_speed[Num], 2);
|
||||
break;
|
||||
case 'm': // how much steps there is to the end of moving
|
||||
if(get_motor_number(&Num))
|
||||
printUint((U8*)&Nsteps[Num], 2);
|
||||
break;
|
||||
case 'X': // stop
|
||||
if(get_motor_number(&Num))
|
||||
stop_motor(Num);
|
||||
break;
|
||||
case 'P': // pause/resume
|
||||
if(get_motor_number(&Num))
|
||||
pause_resume(Num);
|
||||
break;
|
||||
default:
|
||||
if(rb >= '0' && rb <= '2'){ // run motor
|
||||
Num = rb - '0';
|
||||
if(readInt(&Ival) && Ival)
|
||||
move_motor(Num, Ival);
|
||||
else{
|
||||
error_msg("bad Nsteps");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}while(1);
|
||||
}
|
||||
|
||||
|
||||
41
stepper_independent/main.h
Normal file
41
stepper_independent/main.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* blinky.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
|
||||
#define UART_BUF_LEN 8 // max 7 bytes transmited in on operation
|
||||
#define MIN_STEP_LENGTH 125 // max speed == 1/(125us*16) = 500 steps per second
|
||||
|
||||
extern U8 UART_rx[];
|
||||
extern U8 UART_rx_start_i;
|
||||
extern U8 UART_rx_cur_i;
|
||||
|
||||
void UART_send_byte(U8 byte);
|
||||
void uart_write(char *str);
|
||||
void printUint(U8 *val, U8 len);
|
||||
void error_msg(char *msg);
|
||||
|
||||
#define check_UART_pointer(x) if(x == UART_BUF_LEN) x = 0;
|
||||
|
||||
#endif // __MAIN_H__
|
||||
55
stepper_independent/ports_definition.h
Normal file
55
stepper_independent/ports_definition.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* ports_definition.h - definition of ports pins & so on
|
||||
*
|
||||
* Copyright 2014 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 __PORTS_DEFINITION_H__
|
||||
#define __PORTS_DEFINITION_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// macro for using in port constructions like PORT(LED_PORT, ODR) = xx
|
||||
#define CONCAT(a,b) a##_##b
|
||||
#define PORT(a,b) CONCAT(a,b)
|
||||
|
||||
// on-board LED
|
||||
#define LED_PORT PC
|
||||
#define LED_PIN GPIO_PIN2
|
||||
|
||||
// UART2_TX
|
||||
#define UART_PORT PD
|
||||
#define UART_TX_PIN GPIO_PIN5
|
||||
|
||||
/***** Stepper motor *****/
|
||||
// Clocking
|
||||
#define STP0_CLK_PORT PC
|
||||
#define STP0_CLK_PIN GPIO_PIN1
|
||||
#define STP1_CLK_PORT PD
|
||||
#define STP1_CLK_PIN GPIO_PIN4
|
||||
#define STP2_CLK_PORT PD
|
||||
#define STP2_CLK_PIN GPIO_PIN2
|
||||
// Direction
|
||||
#define STP0_DIR_PORT PB
|
||||
#define STP0_DIR_PIN GPIO_PIN0
|
||||
#define STP1_DIR_PORT PB
|
||||
#define STP1_DIR_PIN GPIO_PIN1
|
||||
#define STP2_DIR_PORT PB
|
||||
#define STP2_DIR_PIN GPIO_PIN2
|
||||
#endif // __PORTS_DEFINITION_H__
|
||||
961
stepper_independent/schematic/kicad.kicad_pcb
Normal file
961
stepper_independent/schematic/kicad.kicad_pcb
Normal file
@ -0,0 +1,961 @@
|
||||
(kicad_pcb (version 3) (host pcbnew "(2013-feb-26)-stable")
|
||||
|
||||
(general
|
||||
(links 70)
|
||||
(no_connects 70)
|
||||
(area 0 0 0 0)
|
||||
(thickness 1.6)
|
||||
(drawings 0)
|
||||
(tracks 0)
|
||||
(zones 0)
|
||||
(modules 15)
|
||||
(nets 32)
|
||||
)
|
||||
|
||||
(page A3)
|
||||
(layers
|
||||
(15 F.Cu signal)
|
||||
(0 B.Cu signal)
|
||||
(16 B.Adhes user)
|
||||
(17 F.Adhes user)
|
||||
(18 B.Paste user)
|
||||
(19 F.Paste user)
|
||||
(20 B.SilkS user)
|
||||
(21 F.SilkS user)
|
||||
(22 B.Mask user)
|
||||
(23 F.Mask user)
|
||||
(24 Dwgs.User user)
|
||||
(25 Cmts.User user)
|
||||
(26 Eco1.User user)
|
||||
(27 Eco2.User user)
|
||||
(28 Edge.Cuts user)
|
||||
)
|
||||
|
||||
(setup
|
||||
(last_trace_width 0.254)
|
||||
(trace_clearance 0.254)
|
||||
(zone_clearance 0.508)
|
||||
(zone_45_only no)
|
||||
(trace_min 0.254)
|
||||
(segment_width 0.2)
|
||||
(edge_width 0.15)
|
||||
(via_size 0.889)
|
||||
(via_drill 0.635)
|
||||
(via_min_size 0.889)
|
||||
(via_min_drill 0.508)
|
||||
(uvia_size 0.508)
|
||||
(uvia_drill 0.127)
|
||||
(uvias_allowed no)
|
||||
(uvia_min_size 0.508)
|
||||
(uvia_min_drill 0.127)
|
||||
(pcb_text_width 0.3)
|
||||
(pcb_text_size 1 1)
|
||||
(mod_edge_width 0.15)
|
||||
(mod_text_size 1 1)
|
||||
(mod_text_width 0.15)
|
||||
(pad_size 1 1)
|
||||
(pad_drill 0.6)
|
||||
(pad_to_mask_clearance 0)
|
||||
(aux_axis_origin 0 0)
|
||||
(visible_elements FFFFFFBF)
|
||||
(pcbplotparams
|
||||
(layerselection 3178497)
|
||||
(usegerberextensions true)
|
||||
(excludeedgelayer true)
|
||||
(linewidth 152400)
|
||||
(plotframeref false)
|
||||
(viasonmask false)
|
||||
(mode 1)
|
||||
(useauxorigin false)
|
||||
(hpglpennumber 1)
|
||||
(hpglpenspeed 20)
|
||||
(hpglpendiameter 15)
|
||||
(hpglpenoverlay 2)
|
||||
(psnegative false)
|
||||
(psa4output false)
|
||||
(plotreference true)
|
||||
(plotvalue true)
|
||||
(plotothertext true)
|
||||
(plotinvisibletext false)
|
||||
(padsonsilk false)
|
||||
(subtractmaskfromsilk false)
|
||||
(outputformat 1)
|
||||
(mirror false)
|
||||
(drillshape 1)
|
||||
(scaleselection 1)
|
||||
(outputdirectory ""))
|
||||
)
|
||||
|
||||
(net 0 "")
|
||||
(net 1 +3.3V)
|
||||
(net 2 "/A DIR")
|
||||
(net 3 /NRST)
|
||||
(net 4 /OSC1IN)
|
||||
(net 5 /OSC2IN)
|
||||
(net 6 /PB0)
|
||||
(net 7 /PB1)
|
||||
(net 8 /PB2)
|
||||
(net 9 /PB4)
|
||||
(net 10 /PB5)
|
||||
(net 11 /PC1)
|
||||
(net 12 /PC2)
|
||||
(net 13 /PC3)
|
||||
(net 14 /PC4)
|
||||
(net 15 /PC5)
|
||||
(net 16 /PC6)
|
||||
(net 17 /PC7)
|
||||
(net 18 /PD0)
|
||||
(net 19 /PD2)
|
||||
(net 20 /PD3)
|
||||
(net 21 /PD4)
|
||||
(net 22 /PD5)
|
||||
(net 23 /PD6)
|
||||
(net 24 /PD7)
|
||||
(net 25 /PE5)
|
||||
(net 26 /PF4)
|
||||
(net 27 /SWIM/PD1)
|
||||
(net 28 GND)
|
||||
(net 29 N-0000021)
|
||||
(net 30 N-0000026)
|
||||
(net 31 N-0000042)
|
||||
|
||||
(net_class Default "This is the default net class."
|
||||
(clearance 0.254)
|
||||
(trace_width 0.254)
|
||||
(via_dia 0.889)
|
||||
(via_drill 0.635)
|
||||
(uvia_dia 0.508)
|
||||
(uvia_drill 0.127)
|
||||
(add_net "")
|
||||
(add_net +3.3V)
|
||||
(add_net "/A DIR")
|
||||
(add_net /NRST)
|
||||
(add_net /OSC1IN)
|
||||
(add_net /OSC2IN)
|
||||
(add_net /PB0)
|
||||
(add_net /PB1)
|
||||
(add_net /PB2)
|
||||
(add_net /PB4)
|
||||
(add_net /PB5)
|
||||
(add_net /PC1)
|
||||
(add_net /PC2)
|
||||
(add_net /PC3)
|
||||
(add_net /PC4)
|
||||
(add_net /PC5)
|
||||
(add_net /PC6)
|
||||
(add_net /PC7)
|
||||
(add_net /PD0)
|
||||
(add_net /PD2)
|
||||
(add_net /PD3)
|
||||
(add_net /PD4)
|
||||
(add_net /PD5)
|
||||
(add_net /PD6)
|
||||
(add_net /PD7)
|
||||
(add_net /PE5)
|
||||
(add_net /PF4)
|
||||
(add_net /SWIM/PD1)
|
||||
(add_net GND)
|
||||
(add_net N-0000021)
|
||||
(add_net N-0000026)
|
||||
(add_net N-0000042)
|
||||
)
|
||||
|
||||
(module TQFP32 (layer F.Cu) (tedit 43A670DA) (tstamp 52FB46F3)
|
||||
(at 239.268 53.34)
|
||||
(path /52FB03A2)
|
||||
(fp_text reference U1 (at 0 -1.27) (layer F.SilkS)
|
||||
(effects (font (size 1.27 1.016) (thickness 0.2032)))
|
||||
)
|
||||
(fp_text value STM8S105K4T6C (at 0 1.905) (layer F.SilkS)
|
||||
(effects (font (size 1.27 1.016) (thickness 0.2032)))
|
||||
)
|
||||
(fp_line (start 5.0292 2.7686) (end 3.8862 2.7686) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 5.0292 -2.7686) (end 3.9116 -2.7686) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 5.0292 2.7686) (end 5.0292 -2.7686) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.794 3.9624) (end 2.794 5.0546) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.8194 3.9878) (end -2.8194 5.0546) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.8448 5.0546) (end 2.794 5.08) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.794 -5.0292) (end 2.7178 -5.0546) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.8862 -3.2766) (end -3.8862 3.9116) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.7432 -5.0292) (end 2.7432 -3.9878) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.2512 -3.8862) (end 3.81 -3.8862) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 3.8608 3.937) (end 3.8608 -3.7846) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.8862 3.937) (end 3.7338 3.937) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -5.0292 -2.8448) (end -5.0292 2.794) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -5.0292 2.794) (end -3.8862 2.794) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.87604 -3.302) (end -3.29184 -3.8862) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -5.02412 -2.8448) (end -3.87604 -2.8448) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.794 -3.8862) (end -2.794 -5.03428) (layer F.SilkS) (width 0.1524))
|
||||
(fp_circle (center -2.83972 -2.86004) (end -2.43332 -2.60604) (layer F.SilkS) (width 0.1524))
|
||||
(pad 8 smd rect (at -4.81584 2.77622) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 26 /PF4)
|
||||
)
|
||||
(pad 7 smd rect (at -4.81584 1.97612) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 6 smd rect (at -4.81584 1.17602) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 5 smd rect (at -4.81584 0.37592) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 30 N-0000026)
|
||||
)
|
||||
(pad 4 smd rect (at -4.81584 -0.42418) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 3 smd rect (at -4.81584 -1.22428) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 5 /OSC2IN)
|
||||
)
|
||||
(pad 2 smd rect (at -4.81584 -2.02438) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 4 /OSC1IN)
|
||||
)
|
||||
(pad 1 smd rect (at -4.81584 -2.82448) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 24 smd rect (at 4.7498 -2.8194) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 17 /PC7)
|
||||
)
|
||||
(pad 17 smd rect (at 4.7498 2.794) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 25 /PE5)
|
||||
)
|
||||
(pad 18 smd rect (at 4.7498 1.9812) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 11 /PC1)
|
||||
)
|
||||
(pad 19 smd rect (at 4.7498 1.1684) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 12 /PC2)
|
||||
)
|
||||
(pad 20 smd rect (at 4.7498 0.381) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 13 /PC3)
|
||||
)
|
||||
(pad 21 smd rect (at 4.7498 -0.4318) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 14 /PC4)
|
||||
)
|
||||
(pad 22 smd rect (at 4.7498 -1.2192) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 15 /PC5)
|
||||
)
|
||||
(pad 23 smd rect (at 4.7498 -2.032) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 16 /PC6)
|
||||
)
|
||||
(pad 32 smd rect (at -2.82448 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 24 /PD7)
|
||||
)
|
||||
(pad 31 smd rect (at -2.02692 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 23 /PD6)
|
||||
)
|
||||
(pad 30 smd rect (at -1.22428 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 22 /PD5)
|
||||
)
|
||||
(pad 29 smd rect (at -0.42672 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 21 /PD4)
|
||||
)
|
||||
(pad 28 smd rect (at 0.37592 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 20 /PD3)
|
||||
)
|
||||
(pad 27 smd rect (at 1.17348 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 19 /PD2)
|
||||
)
|
||||
(pad 26 smd rect (at 1.97612 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 27 /SWIM/PD1)
|
||||
)
|
||||
(pad 25 smd rect (at 2.77368 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 18 /PD0)
|
||||
)
|
||||
(pad 9 smd rect (at -2.8194 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 10 smd rect (at -2.032 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 11 smd rect (at -1.2192 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 10 /PB5)
|
||||
)
|
||||
(pad 12 smd rect (at -0.4318 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 9 /PB4)
|
||||
)
|
||||
(pad 13 smd rect (at 0.3556 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 2 "/A DIR")
|
||||
)
|
||||
(pad 14 smd rect (at 1.1684 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 8 /PB2)
|
||||
)
|
||||
(pad 15 smd rect (at 1.9812 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 7 /PB1)
|
||||
)
|
||||
(pad 16 smd rect (at 2.794 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 6 /PB0)
|
||||
)
|
||||
(model smd/tqfp32.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM2010 (layer F.Cu) (tedit 4EFC4DD5) (tstamp 52FB4700)
|
||||
(at 207.518 73.66)
|
||||
(tags "CMS SM")
|
||||
(path /52FB0F3B)
|
||||
(attr smd)
|
||||
(fp_text reference SW1 (at -0.50038 0 90) (layer F.SilkS)
|
||||
(effects (font (size 0.70104 0.70104) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value SW_PUSH (at 0.8001 0 90) (layer F.SilkS)
|
||||
(effects (font (size 0.70104 0.70104) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start 3.50012 -1.6002) (end 3.50012 1.6002) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start -3.50012 -1.6002) (end -3.50012 1.6002) (layer F.SilkS) (width 0.11938))
|
||||
(fp_text user + (at -4.30022 1.80086) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.29972)))
|
||||
)
|
||||
(fp_line (start 1.19634 1.60528) (end 3.48234 1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start 3.48234 -1.60528) (end 1.19634 -1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start -1.19888 -1.60528) (end -3.48488 -1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start -3.48488 1.60528) (end -1.19888 1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(pad 1 smd rect (at -2.4003 0) (size 1.80086 2.70002)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 2 smd rect (at 2.4003 0) (size 1.80086 2.70002)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(model smd\chip_smd_pol_wide.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.35 0.35 0.35))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB470C)
|
||||
(at 214.884 73.406)
|
||||
(path /52FB0413)
|
||||
(attr smd)
|
||||
(fp_text reference C1 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 1u (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 30 N-0000026)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4718)
|
||||
(at 220.98 73.406)
|
||||
(path /52FB0426)
|
||||
(attr smd)
|
||||
(fp_text reference C2 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 104 (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4724)
|
||||
(at 227.076 73.406)
|
||||
(path /52FB0DD3)
|
||||
(attr smd)
|
||||
(fp_text reference D1 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value LED (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 31 N-0000042)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4730)
|
||||
(at 233.172 73.406)
|
||||
(path /52FB0DE2)
|
||||
(attr smd)
|
||||
(fp_text reference R1 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 1k (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 31 N-0000042)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 12 /PC2)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB473C)
|
||||
(at 182.626 76.962)
|
||||
(path /52FB0ECD)
|
||||
(attr smd)
|
||||
(fp_text reference D2 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value LED (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 29 N-0000021)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4748)
|
||||
(at 188.722 76.962)
|
||||
(path /52FB0ED3)
|
||||
(attr smd)
|
||||
(fp_text reference R2 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 1k (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 29 N-0000021)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4754)
|
||||
(at 194.818 76.962)
|
||||
(path /52FB0EFD)
|
||||
(attr smd)
|
||||
(fp_text reference R3 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 10k (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4760)
|
||||
(at 200.914 76.962)
|
||||
(path /52FB0F99)
|
||||
(attr smd)
|
||||
(fp_text reference C3 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 104 (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-5 (layer F.Cu) (tedit 200000) (tstamp 52FB476E)
|
||||
(at 187.452 73.66)
|
||||
(descr "Connecteur 5 pins")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB4AA7)
|
||||
(fp_text reference P4 (at -0.635 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_5 (at 0 -2.54) (layer F.SilkS) hide
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -7.62 1.27) (end -7.62 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 -1.27) (end 5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 -1.27) (end 5.08 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 1.27) (end -7.62 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 23 /PD6)
|
||||
)
|
||||
(pad 4 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 22 /PD5)
|
||||
)
|
||||
(pad 5 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-4 (layer F.Cu) (tedit 200000) (tstamp 52FB477D)
|
||||
(at 198.12 73.66)
|
||||
(descr "Connecteur 4 pibs")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB0A49)
|
||||
(fp_text reference P2 (at 0 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.73482 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_4 (at 0 -2.54) (layer F.SilkS) hide
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -5.08 -1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 -1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 -1.27) (end 5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 -1.27) (end 5.08 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 1.27) (end -5.08 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 27 /SWIM/PD1)
|
||||
)
|
||||
(pad 3 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 4 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-14 (layer F.Cu) (tedit 200000) (tstamp 52FB4793)
|
||||
(at 197.612 70.358)
|
||||
(descr "Connecteur 14 pins")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB0A6A)
|
||||
(fp_text reference P1 (at -10.16 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_14 (at 7.62 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -17.78 -1.27) (end 17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 -1.27) (end 17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 1.27) (end -17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -17.78 1.27) (end -17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 4 thru_hole circle (at -8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 4 /OSC1IN)
|
||||
)
|
||||
(pad 5 thru_hole circle (at -6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 5 /OSC2IN)
|
||||
)
|
||||
(pad 6 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 26 /PF4)
|
||||
)
|
||||
(pad 7 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 10 /PB5)
|
||||
)
|
||||
(pad 8 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 9 /PB4)
|
||||
)
|
||||
(pad 9 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 2 "/A DIR")
|
||||
)
|
||||
(pad 10 thru_hole circle (at 6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 8 /PB2)
|
||||
)
|
||||
(pad 11 thru_hole circle (at 8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 7 /PB1)
|
||||
)
|
||||
(pad 12 thru_hole circle (at 11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 6 /PB0)
|
||||
)
|
||||
(pad 13 thru_hole circle (at 13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 25 /PE5)
|
||||
)
|
||||
(pad 14 thru_hole circle (at 16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 11 /PC1)
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-14 (layer F.Cu) (tedit 200000) (tstamp 52FB47A9)
|
||||
(at 233.68 70.358)
|
||||
(descr "Connecteur 14 pins")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB0A79)
|
||||
(fp_text reference P3 (at -10.16 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_14 (at 7.62 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -17.78 -1.27) (end 17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 -1.27) (end 17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 1.27) (end -17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -17.78 1.27) (end -17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 24 /PD7)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 23 /PD6)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 22 /PD5)
|
||||
)
|
||||
(pad 4 thru_hole circle (at -8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 21 /PD4)
|
||||
)
|
||||
(pad 5 thru_hole circle (at -6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 20 /PD3)
|
||||
)
|
||||
(pad 6 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 19 /PD2)
|
||||
)
|
||||
(pad 7 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 27 /SWIM/PD1)
|
||||
)
|
||||
(pad 8 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 18 /PD0)
|
||||
)
|
||||
(pad 9 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 17 /PC7)
|
||||
)
|
||||
(pad 10 thru_hole circle (at 6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 16 /PC6)
|
||||
)
|
||||
(pad 11 thru_hole circle (at 8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 15 /PC5)
|
||||
)
|
||||
(pad 12 thru_hole circle (at 11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 14 /PC4)
|
||||
)
|
||||
(pad 13 thru_hole circle (at 13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 13 /PC3)
|
||||
)
|
||||
(pad 14 thru_hole circle (at 16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 12 /PC2)
|
||||
)
|
||||
)
|
||||
|
||||
(module DB25FC (layer F.Cu) (tedit 200000) (tstamp 52FB47DC)
|
||||
(at 206.502 66.04)
|
||||
(descr "Connecteur DB25 femelle couche")
|
||||
(tags "CONN DB25")
|
||||
(path /52FB403E)
|
||||
(fp_text reference J1 (at 0 -15.24) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value DB25 (at 0 -6.35) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start 26.67 -11.43) (end 26.67 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 19.05 -6.35) (end 19.05 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 20.955 -11.43) (end 20.955 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.955 -11.43) (end -20.955 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -19.05 -6.35) (end -19.05 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 2.54) (end -26.67 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 26.67 -6.35) (end 19.05 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 -6.35) (end -19.05 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 20.32 -8.255) (end 20.32 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -8.255) (end -20.32 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 20.32 -18.415) (end 20.32 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -18.415) (end -20.32 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 26.67 -11.43) (end 26.67 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 26.67 -12.7) (end -26.67 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 -12.7) (end -26.67 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 -11.43) (end 26.67 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 19.05 2.54) (end 26.67 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -8.255) (end 20.32 -8.255) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -18.415) (end 20.32 -18.415) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 2.54) (end -19.05 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(pad "" thru_hole circle (at 23.495 -1.27) (size 3.81 3.81) (drill 3.048)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad "" thru_hole circle (at -23.495 -1.27) (size 3.81 3.81) (drill 3.048)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 1 thru_hole rect (at -16.51 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -13.716 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 11 /PC1)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -11.049 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 6 /PB0)
|
||||
)
|
||||
(pad 4 thru_hole circle (at -8.255 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 21 /PD4)
|
||||
)
|
||||
(pad 5 thru_hole circle (at -5.461 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 7 /PB1)
|
||||
)
|
||||
(pad 6 thru_hole circle (at -2.667 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 19 /PD2)
|
||||
)
|
||||
(pad 7 thru_hole circle (at 0 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 8 /PB2)
|
||||
)
|
||||
(pad 8 thru_hole circle (at 2.794 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 9 thru_hole circle (at 5.588 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 2 "/A DIR")
|
||||
)
|
||||
(pad 10 thru_hole circle (at 8.382 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 11 thru_hole circle (at 11.049 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 12 thru_hole circle (at 13.843 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 13 thru_hole circle (at 16.637 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 14 thru_hole circle (at -14.9352 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 15 thru_hole circle (at -12.3952 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 16 thru_hole circle (at -9.6012 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 17 thru_hole circle (at -6.858 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 18 thru_hole circle (at -4.1148 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 19 thru_hole circle (at -1.3208 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 20 thru_hole circle (at 1.4224 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 21 thru_hole circle (at 4.1656 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 22 thru_hole circle (at 7.0104 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 23 thru_hole circle (at 9.7028 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 24 thru_hole circle (at 12.446 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 25 thru_hole circle (at 15.24 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(model conn_DBxx/db25_female_pin90deg.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
82
stepper_independent/schematic/kicad.pro
Normal file
82
stepper_independent/schematic/kicad.pro
Normal file
@ -0,0 +1,82 @@
|
||||
update=Вт 11 фев 2014 17:26:13
|
||||
version=1
|
||||
last_client=eeschema
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[cvpcb/libraries]
|
||||
EquName1=devcms
|
||||
[pcbnew]
|
||||
version=1
|
||||
LastNetListRead=
|
||||
PadDrlX=320
|
||||
PadDimH=550
|
||||
PadDimV=550
|
||||
BoardThickness=620
|
||||
TxtPcbV=600
|
||||
TxtPcbH=600
|
||||
TxtModV=500
|
||||
TxtModH=500
|
||||
TxtModW=100
|
||||
VEgarde=100
|
||||
DrawLar=120
|
||||
EdgeLar=80
|
||||
TxtLar=120
|
||||
MSegLar=120
|
||||
[pcbnew/libraries]
|
||||
LibDir=
|
||||
LibName1=sockets
|
||||
LibName2=connect
|
||||
LibName3=discret
|
||||
LibName4=pin_array
|
||||
LibName5=divers
|
||||
LibName6=libcms
|
||||
LibName7=display
|
||||
LibName8=led
|
||||
LibName9=dip_sockets
|
||||
LibName10=pga_sockets
|
||||
LibName11=valves
|
||||
[general]
|
||||
version=1
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
NetFmtName=
|
||||
RptD_X=0
|
||||
RptD_Y=100
|
||||
RptLab=1
|
||||
LabSize=60
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=special
|
||||
LibName13=microcontrollers
|
||||
LibName14=dsp
|
||||
LibName15=microchip
|
||||
LibName16=analog_switches
|
||||
LibName17=motorola
|
||||
LibName18=texas
|
||||
LibName19=intel
|
||||
LibName20=audio
|
||||
LibName21=interface
|
||||
LibName22=digital-audio
|
||||
LibName23=philips
|
||||
LibName24=display
|
||||
LibName25=cypress
|
||||
LibName26=siliconi
|
||||
LibName27=opto
|
||||
LibName28=atmel
|
||||
LibName29=contrib
|
||||
LibName30=valves
|
||||
LibName31=stm8
|
||||
LibName32=st-microelectronics
|
||||
LibName33=stm8s105k4t6c
|
||||
318
stepper_independent/schematic/stepper-cache.lib
Normal file
318
stepper_independent/schematic/stepper-cache.lib
Normal file
@ -0,0 +1,318 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Ср 12 фев 2014 14:02:01
|
||||
#encoding utf-8
|
||||
#
|
||||
# +3.3V
|
||||
#
|
||||
DEF +3.3V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -40 30 H I C CNN
|
||||
F1 "+3.3V" 0 110 30 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS +3,3V
|
||||
DRAW
|
||||
X +3.3V 1 0 0 0 U 30 30 0 0 W N
|
||||
C 0 60 20 0 1 0 N
|
||||
P 3 0 1 0 0 0 0 40 0 40 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# C
|
||||
#
|
||||
DEF C C 0 10 N Y 1 F N
|
||||
F0 "C" 0 100 40 H V L CNN
|
||||
F1 "C" 6 -85 40 H V L CNN
|
||||
F2 "~" 38 -150 30 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
SM*
|
||||
C?
|
||||
C1-1
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 20 -80 -30 80 -30 N
|
||||
P 2 0 1 20 -80 30 80 30 N
|
||||
X ~ 1 0 200 170 D 40 40 1 1 P
|
||||
X ~ 2 0 -200 170 U 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_14
|
||||
#
|
||||
DEF CONN_14 P 0 40 Y N 1 F N
|
||||
F0 "P" -30 0 60 V V C CNN
|
||||
F1 "CONN_14" 80 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 700 150 -700 0 1 0 N
|
||||
X P1 1 -350 650 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 550 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 450 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 350 250 R 50 50 1 1 P I
|
||||
X P5 5 -350 250 250 R 50 50 1 1 P I
|
||||
X P6 6 -350 150 250 R 50 50 1 1 P I
|
||||
X P7 7 -350 50 250 R 50 50 1 1 P I
|
||||
X P8 8 -350 -50 250 R 50 50 1 1 P I
|
||||
X P9 9 -350 -150 250 R 50 50 1 1 P I
|
||||
X P10 10 -350 -250 250 R 50 50 1 1 P I
|
||||
X P11 11 -350 -350 250 R 50 50 1 1 P I
|
||||
X P12 12 -350 -450 250 R 50 50 1 1 P I
|
||||
X P13 13 -350 -550 250 R 50 50 1 1 P I
|
||||
X P14 14 -350 -650 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_4
|
||||
#
|
||||
DEF CONN_4 P 0 40 Y N 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_4" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 200 100 -200 0 1 0 N
|
||||
X P1 1 -350 150 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 50 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 -50 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 -150 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_5
|
||||
#
|
||||
DEF CONN_5 P 0 40 Y Y 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_5" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 250 100 -250 0 1 0 f
|
||||
X ~ 1 -400 200 300 R 60 60 1 1 w I
|
||||
X ~ 2 -400 100 300 R 60 60 1 1 P I
|
||||
X ~ 3 -400 0 300 R 60 60 1 1 P I
|
||||
X ~ 4 -400 -100 300 R 60 60 1 1 P I
|
||||
X ~ 5 -400 -200 300 R 60 60 1 1 w I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# DB25
|
||||
#
|
||||
DEF DB25 J 0 40 Y N 1 F N
|
||||
F0 "J" 50 1350 70 H V C CNN
|
||||
F1 "DB25" -50 -1350 70 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
DB25*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
A -109 1270 41 1799 774 0 1 8 N -150 1270 -100 1310
|
||||
A -108 -1259 42 -1787 -788 0 1 8 N -150 -1260 -100 -1300
|
||||
A 116 -1169 34 -657 -15 0 1 8 N 130 -1200 150 -1170
|
||||
A 117 1170 32 664 1 0 1 8 N 130 1199 149 1170
|
||||
C -70 -1200 30 0 1 0 N
|
||||
C -70 -1000 30 0 1 0 N
|
||||
C -70 -800 30 0 1 0 N
|
||||
C -70 -600 30 0 1 0 N
|
||||
C -70 -400 30 0 1 0 N
|
||||
C -70 -200 30 0 1 0 N
|
||||
C -70 0 30 0 1 0 N
|
||||
C -70 200 30 0 1 0 N
|
||||
C -70 400 30 0 1 0 N
|
||||
C -70 600 30 0 1 0 N
|
||||
C -70 800 30 0 1 0 N
|
||||
C -70 1000 30 0 1 0 N
|
||||
C -70 1200 30 0 1 0 N
|
||||
C 50 -1100 30 0 1 0 N
|
||||
C 50 -900 30 0 1 0 N
|
||||
C 50 -700 30 0 1 0 N
|
||||
C 50 -500 30 0 1 0 N
|
||||
C 50 -300 30 0 1 0 N
|
||||
C 50 -100 30 0 1 0 N
|
||||
C 50 100 30 0 1 0 N
|
||||
C 50 300 30 0 1 0 N
|
||||
C 50 500 30 0 1 0 N
|
||||
C 50 700 30 0 1 0 N
|
||||
C 50 900 30 0 1 0 N
|
||||
C 50 1100 30 0 1 0 N
|
||||
P 2 0 1 8 -150 -1260 -150 1270 N
|
||||
P 2 0 1 0 -150 -1200 -100 -1200 N
|
||||
P 2 0 1 0 -150 -1100 20 -1100 N
|
||||
P 2 0 1 0 -150 -1000 -100 -1000 N
|
||||
P 2 0 1 0 -150 -900 20 -900 N
|
||||
P 2 0 1 0 -150 -800 -100 -800 N
|
||||
P 2 0 1 0 -150 -700 20 -700 N
|
||||
P 2 0 1 0 -150 -600 -100 -600 N
|
||||
P 2 0 1 0 -150 -500 20 -500 N
|
||||
P 2 0 1 0 -150 -400 -100 -400 N
|
||||
P 2 0 1 0 -150 -300 20 -300 N
|
||||
P 2 0 1 0 -150 -200 -100 -200 N
|
||||
P 2 0 1 0 -150 -100 20 -100 N
|
||||
P 2 0 1 0 -150 0 -100 0 N
|
||||
P 2 0 1 0 -150 100 20 100 N
|
||||
P 2 0 1 0 -150 200 -100 200 N
|
||||
P 2 0 1 0 -150 300 20 300 N
|
||||
P 2 0 1 0 -150 400 -100 400 N
|
||||
P 2 0 1 0 -150 500 20 500 N
|
||||
P 2 0 1 0 -150 600 -100 600 N
|
||||
P 2 0 1 0 -150 700 20 700 N
|
||||
P 2 0 1 0 -150 800 -100 800 N
|
||||
P 2 0 1 0 -150 900 20 900 N
|
||||
P 2 0 1 0 -150 1000 -100 1000 N
|
||||
P 2 0 1 0 -150 1100 20 1100 N
|
||||
P 2 0 1 0 -150 1200 -100 1200 N
|
||||
P 2 0 1 8 -100 -1300 130 -1200 N
|
||||
P 2 0 1 8 130 1200 -100 1310 N
|
||||
P 2 0 1 8 150 -1170 150 1170 N
|
||||
X 1 1 -450 -1200 300 R 60 60 1 1 P
|
||||
X 2 2 -450 -1000 300 R 60 60 1 1 P
|
||||
X 3 3 -450 -800 300 R 60 60 1 1 P
|
||||
X 4 4 -450 -600 300 R 60 60 1 1 P
|
||||
X 5 5 -450 -400 300 R 60 60 1 1 P
|
||||
X 6 6 -450 -200 300 R 60 60 1 1 P
|
||||
X 7 7 -450 0 300 R 60 60 1 1 P
|
||||
X 8 8 -450 200 300 R 60 60 1 1 P
|
||||
X 9 9 -450 400 300 R 60 60 1 1 P
|
||||
X 10 10 -450 600 300 R 60 60 1 1 P
|
||||
X P20 20 -450 100 300 R 60 60 1 1 P
|
||||
X 11 11 -450 800 300 R 60 60 1 1 P
|
||||
X P21 21 -450 300 300 R 60 60 1 1 P
|
||||
X 12 12 -450 1000 300 R 60 60 1 1 P
|
||||
X P22 22 -450 500 300 R 60 60 1 1 P
|
||||
X 13 13 -450 1200 300 R 60 60 1 1 P
|
||||
X P23 23 -450 700 300 R 60 60 1 1 P
|
||||
X P14 14 -450 -1100 300 R 60 60 1 1 P
|
||||
X P24 24 -450 900 300 R 60 60 1 1 P
|
||||
X P15 15 -450 -900 300 R 60 60 1 1 P
|
||||
X P25 25 -450 1100 300 R 60 60 1 1 P
|
||||
X P16 16 -450 -700 300 R 60 60 1 1 P
|
||||
X P17 17 -450 -500 300 R 60 60 1 1 P
|
||||
X P18 18 -450 -300 300 R 60 60 1 1 P
|
||||
X P19 19 -450 -100 300 R 60 60 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# GND
|
||||
#
|
||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 0 30 H I C CNN
|
||||
F1 "GND" 0 -70 30 H I C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# LED
|
||||
#
|
||||
DEF LED D 0 40 Y N 1 F N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "LED" 0 -100 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LED-3MM
|
||||
LED-5MM
|
||||
LED-10MM
|
||||
LED-0603
|
||||
LED-0805
|
||||
LED-1206
|
||||
LEDV
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 0 50 50 50 -50 N
|
||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||
P 3 0 1 0 65 -40 110 -80 105 -55 N
|
||||
P 3 0 1 0 80 -25 125 -65 120 -40 N
|
||||
X A 1 -200 0 150 R 40 40 1 1 P
|
||||
X K 2 200 0 150 L 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# R
|
||||
#
|
||||
DEF R R 0 0 N Y 1 F N
|
||||
F0 "R" 80 0 40 V V C CNN
|
||||
F1 "R" 7 1 40 V V C CNN
|
||||
F2 "~" -70 0 30 V V C CNN
|
||||
F3 "~" 0 0 30 H V C CNN
|
||||
$FPLIST
|
||||
R?
|
||||
SM0603
|
||||
SM0805
|
||||
R?-*
|
||||
SM1206
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -40 150 40 -150 0 1 12 N
|
||||
X ~ 1 0 250 100 D 60 60 1 1 P
|
||||
X ~ 2 0 -250 100 U 60 60 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_PUSH
|
||||
#
|
||||
DEF SW_PUSH SW 0 40 N N 1 F N
|
||||
F0 "SW" 150 110 50 H V C CNN
|
||||
F1 "SW_PUSH" 0 -80 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -170 50 170 60 0 1 0 N
|
||||
P 4 0 1 0 -40 60 -30 90 30 90 40 60 N
|
||||
X 1 1 -300 0 200 R 60 60 0 1 P I
|
||||
X 2 2 300 0 200 L 60 60 0 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
108
stepper_independent/schematic/stepper.cmp
Normal file
108
stepper_independent/schematic/stepper.cmp
Normal file
@ -0,0 +1,108 @@
|
||||
Cmp-Mod V01 Created by CvPcb (2013-feb-26)-stable date = Ср 12 фев 2014 14:01:35
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0413;
|
||||
Reference = C1;
|
||||
ValeurCmp = 1u;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0426;
|
||||
Reference = C2;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F99;
|
||||
Reference = C3;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DD3;
|
||||
Reference = D1;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ECD;
|
||||
Reference = D2;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB403E;
|
||||
Reference = J1;
|
||||
ValeurCmp = DB25;
|
||||
IdModule = DB25FC;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A6A;
|
||||
Reference = P1;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A49;
|
||||
Reference = P2;
|
||||
ValeurCmp = CONN_4;
|
||||
IdModule = SIL-4;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A79;
|
||||
Reference = P3;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB4AA7;
|
||||
Reference = P4;
|
||||
ValeurCmp = CONN_5;
|
||||
IdModule = SIL-5;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DE2;
|
||||
Reference = R1;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ED3;
|
||||
Reference = R2;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0EFD;
|
||||
Reference = R3;
|
||||
ValeurCmp = 10k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F3B;
|
||||
Reference = SW1;
|
||||
ValeurCmp = SW_PUSH;
|
||||
IdModule = SM2010;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB03A2;
|
||||
Reference = U1;
|
||||
ValeurCmp = STM8S105K4T6C;
|
||||
IdModule = TQFP32;
|
||||
EndCmp
|
||||
|
||||
EndListe
|
||||
415
stepper_independent/schematic/stepper.net
Normal file
415
stepper_independent/schematic/stepper.net
Normal file
@ -0,0 +1,415 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source /home/eddy/Docs/SAO/ELECTRONICS/STM8/stepper_independent/schematic/stepper.sch)
|
||||
(date "Ср 12 фев 2014 14:00:57")
|
||||
(tool "eeschema (2013-feb-26)-stable"))
|
||||
(components
|
||||
(comp (ref U1)
|
||||
(value STM8S105K4T6C)
|
||||
(libsource (lib stm8s105k4t6c) (part STM8S105K4T6C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB03A2))
|
||||
(comp (ref C1)
|
||||
(value 1u)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0413))
|
||||
(comp (ref C2)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0426))
|
||||
(comp (ref P2)
|
||||
(value CONN_4)
|
||||
(libsource (lib conn) (part CONN_4))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A49))
|
||||
(comp (ref P1)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A6A))
|
||||
(comp (ref P3)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A79))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DD3))
|
||||
(comp (ref R1)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DE2))
|
||||
(comp (ref D2)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ECD))
|
||||
(comp (ref R2)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ED3))
|
||||
(comp (ref R3)
|
||||
(value 10k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0EFD))
|
||||
(comp (ref SW1)
|
||||
(value SW_PUSH)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F3B))
|
||||
(comp (ref C3)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F99))
|
||||
(comp (ref J1)
|
||||
(value DB25)
|
||||
(libsource (lib conn) (part DB25))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB403E))
|
||||
(comp (ref P4)
|
||||
(value CONN_5)
|
||||
(libsource (lib conn) (part CONN_5))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB4AA7)))
|
||||
(libparts
|
||||
(libpart (lib device) (part C)
|
||||
(description "Condensateur non polarise")
|
||||
(footprints
|
||||
(fp SM*)
|
||||
(fp C?)
|
||||
(fp C1-1))
|
||||
(fields
|
||||
(field (name Reference) C)
|
||||
(field (name Value) C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part LED)
|
||||
(footprints
|
||||
(fp LED-3MM)
|
||||
(fp LED-5MM)
|
||||
(fp LED-10MM)
|
||||
(fp LED-0603)
|
||||
(fp LED-0805)
|
||||
(fp LED-1206)
|
||||
(fp LEDV))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name A) (type passive))
|
||||
(pin (num 2) (name K) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistance)
|
||||
(footprints
|
||||
(fp R?)
|
||||
(fp SM0603)
|
||||
(fp SM0805)
|
||||
(fp R?-*)
|
||||
(fp SM1206))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part SW_PUSH)
|
||||
(description "Push Button")
|
||||
(fields
|
||||
(field (name Reference) SW)
|
||||
(field (name Value) SW_PUSH)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib conn) (part CONN_14)
|
||||
(description "Symbole general de connexion")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_14))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))
|
||||
(pin (num 5) (name P5) (type passive))
|
||||
(pin (num 6) (name P6) (type passive))
|
||||
(pin (num 7) (name P7) (type passive))
|
||||
(pin (num 8) (name P8) (type passive))
|
||||
(pin (num 9) (name P9) (type passive))
|
||||
(pin (num 10) (name P10) (type passive))
|
||||
(pin (num 11) (name P11) (type passive))
|
||||
(pin (num 12) (name P12) (type passive))
|
||||
(pin (num 13) (name P13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))))
|
||||
(libpart (lib conn) (part CONN_4)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_4))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))))
|
||||
(libpart (lib conn) (part DB25)
|
||||
(footprints
|
||||
(fp DB25*))
|
||||
(fields
|
||||
(field (name Reference) J)
|
||||
(field (name Value) DB25))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))
|
||||
(pin (num 3) (name 3) (type passive))
|
||||
(pin (num 4) (name 4) (type passive))
|
||||
(pin (num 5) (name 5) (type passive))
|
||||
(pin (num 6) (name 6) (type passive))
|
||||
(pin (num 7) (name 7) (type passive))
|
||||
(pin (num 8) (name 8) (type passive))
|
||||
(pin (num 9) (name 9) (type passive))
|
||||
(pin (num 10) (name 10) (type passive))
|
||||
(pin (num 11) (name 11) (type passive))
|
||||
(pin (num 12) (name 12) (type passive))
|
||||
(pin (num 13) (name 13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))
|
||||
(pin (num 15) (name P15) (type passive))
|
||||
(pin (num 16) (name P16) (type passive))
|
||||
(pin (num 17) (name P17) (type passive))
|
||||
(pin (num 18) (name P18) (type passive))
|
||||
(pin (num 19) (name P19) (type passive))
|
||||
(pin (num 20) (name P20) (type passive))
|
||||
(pin (num 21) (name P21) (type passive))
|
||||
(pin (num 22) (name P22) (type passive))
|
||||
(pin (num 23) (name P23) (type passive))
|
||||
(pin (num 24) (name P24) (type passive))
|
||||
(pin (num 25) (name P25) (type passive))))
|
||||
(libpart (lib stm8s105k4t6c) (part STM8S105K4T6C)
|
||||
(footprints
|
||||
(fp lqfp32*))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) STM8S105K4T6C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name NRST) (type input))
|
||||
(pin (num 2) (name OSCIN/PA1) (type 3state))
|
||||
(pin (num 3) (name OSCOUT/PA2) (type 3state))
|
||||
(pin (num 4) (name VSS) (type power_in))
|
||||
(pin (num 5) (name VCAP) (type power_out))
|
||||
(pin (num 6) (name "VDD(3.3-5v)") (type power_in))
|
||||
(pin (num 7) (name VDDio) (type power_in))
|
||||
(pin (num 8) (name PF4/AIN12) (type 3state))
|
||||
(pin (num 9) (name VDDA) (type power_in))
|
||||
(pin (num 10) (name VSSA) (type power_in))
|
||||
(pin (num 11) (name PB5/AIN5[I2X_SDA]) (type 3state))
|
||||
(pin (num 12) (name PB4/AIN4[I2C_SCL]) (type 3state))
|
||||
(pin (num 13) (name PB3/AIN3[TIM1_ETR]) (type 3state))
|
||||
(pin (num 14) (name PB2/AIN2[TIM1_CH3N]) (type 3state))
|
||||
(pin (num 15) (name PB1/AIN1_[TIM1_CH2N]) (type 3state))
|
||||
(pin (num 16) (name PB0/AIN0_[TIM1_CH1N]) (type 3state))
|
||||
(pin (num 17) (name PE5/SPI_NSS) (type 3state))
|
||||
(pin (num 18) (name "PC1(HS)/TIM1_CH1") (type 3state))
|
||||
(pin (num 19) (name "PC2(HS)/TIM1_CH2") (type 3state))
|
||||
(pin (num 20) (name "PC3(HS)/TIM1_CH3") (type 3state))
|
||||
(pin (num 21) (name "PC4(HS)/TIM1_CH4") (type 3state))
|
||||
(pin (num 22) (name "PC5(HS)/SPI_SCK") (type 3state))
|
||||
(pin (num 23) (name "PC6(HS)/SPI_MOSI") (type 3state))
|
||||
(pin (num 24) (name "PC7(HS)/SPI_MISO") (type 3state))
|
||||
(pin (num 25) (name "PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO]") (type 3state))
|
||||
(pin (num 26) (name "PD1(HS)/SWIM") (type 3state))
|
||||
(pin (num 27) (name "PD2(HS)/TIM3_CH1[TIM2_CH3]") (type 3state))
|
||||
(pin (num 28) (name "PD3(HS)/TIM2_CH2[ADC_ETR]") (type 3state))
|
||||
(pin (num 29) (name "PD4(HS)/TIM2_CH1[BEEP]") (type 3state))
|
||||
(pin (num 30) (name PD5/UART2_TX) (type 3state))
|
||||
(pin (num 31) (name PD6/UART2_RX) (type 3state))
|
||||
(pin (num 32) (name PD7/TLI[TIM1_CH4]) (type 3state))))
|
||||
(libpart (lib conn) (part CONN_5)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_5))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type power_out))
|
||||
(pin (num 2) (name ~) (type passive))
|
||||
(pin (num 3) (name ~) (type passive))
|
||||
(pin (num 4) (name ~) (type passive))
|
||||
(pin (num 5) (name ~) (type power_out)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri /usr/share/kicad/library/device.lib))
|
||||
(library (logical conn)
|
||||
(uri /usr/share/kicad/library/conn.lib))
|
||||
(library (logical stm8s105k4t6c)
|
||||
(uri stm8s105k4t6c.lib)))
|
||||
(nets
|
||||
(net (code 1) (name "")
|
||||
(node (ref J1) (pin 14)))
|
||||
(net (code 2) (name /PC1)
|
||||
(node (ref P1) (pin 14))
|
||||
(node (ref J1) (pin 2))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 3) (name GND)
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref P1) (pin 2))
|
||||
(node (ref P4) (pin 5))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref U1) (pin 10))
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref J1) (pin 24))
|
||||
(node (ref J1) (pin 25))
|
||||
(node (ref J1) (pin 18))
|
||||
(node (ref J1) (pin 19))
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref P2) (pin 4))
|
||||
(node (ref J1) (pin 20))
|
||||
(node (ref U1) (pin 4))
|
||||
(node (ref J1) (pin 21))
|
||||
(node (ref J1) (pin 22))
|
||||
(node (ref J1) (pin 23))
|
||||
(node (ref C3) (pin 2)))
|
||||
(net (code 4) (name /NRST)
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref P2) (pin 3))
|
||||
(node (ref U1) (pin 1))
|
||||
(node (ref R3) (pin 2))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref P1) (pin 3)))
|
||||
(net (code 5) (name +3.3V)
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref U1) (pin 9))
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref P4) (pin 1))
|
||||
(node (ref U1) (pin 6)))
|
||||
(net (code 6) (name /PC2)
|
||||
(node (ref P3) (pin 14))
|
||||
(node (ref R1) (pin 2))
|
||||
(node (ref U1) (pin 19)))
|
||||
(net (code 7) (name "/1st out")
|
||||
(node (ref J1) (pin 17)))
|
||||
(net (code 8) (name /5.0V)
|
||||
(node (ref P4) (pin 2)))
|
||||
(net (code 9) (name /IN4)
|
||||
(node (ref J1) (pin 13)))
|
||||
(net (code 10) (name /IN3)
|
||||
(node (ref J1) (pin 12)))
|
||||
(net (code 11) (name /IN2)
|
||||
(node (ref J1) (pin 11)))
|
||||
(net (code 12) (name /IN1)
|
||||
(node (ref J1) (pin 10)))
|
||||
(net (code 13) (name /EN)
|
||||
(node (ref J1) (pin 16)))
|
||||
(net (code 14) (name /IN5)
|
||||
(node (ref J1) (pin 15)))
|
||||
(net (code 15) (name "/2nd out")
|
||||
(node (ref J1) (pin 1)))
|
||||
(net (code 16) (name /PD5)
|
||||
(node (ref P3) (pin 3))
|
||||
(node (ref U1) (pin 30))
|
||||
(node (ref P4) (pin 4)))
|
||||
(net (code 17) (name /PD6)
|
||||
(node (ref P4) (pin 3))
|
||||
(node (ref P3) (pin 2))
|
||||
(node (ref U1) (pin 31)))
|
||||
(net (code 18) (name "/A CLK")
|
||||
(node (ref J1) (pin 8)))
|
||||
(net (code 19) (name /PD2)
|
||||
(node (ref J1) (pin 6))
|
||||
(node (ref P3) (pin 6))
|
||||
(node (ref U1) (pin 27)))
|
||||
(net (code 20) (name /PD4)
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref J1) (pin 4))
|
||||
(node (ref P3) (pin 4)))
|
||||
(net (code 21) (name "")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref D2) (pin 2)))
|
||||
(net (code 22) (name "/A DIR")
|
||||
(node (ref J1) (pin 9))
|
||||
(node (ref U1) (pin 13))
|
||||
(node (ref P1) (pin 9)))
|
||||
(net (code 23) (name /PB2)
|
||||
(node (ref U1) (pin 14))
|
||||
(node (ref P1) (pin 10))
|
||||
(node (ref J1) (pin 7)))
|
||||
(net (code 24) (name /PB1)
|
||||
(node (ref P1) (pin 11))
|
||||
(node (ref U1) (pin 15))
|
||||
(node (ref J1) (pin 5)))
|
||||
(net (code 25) (name /PB0)
|
||||
(node (ref U1) (pin 16))
|
||||
(node (ref P1) (pin 12))
|
||||
(node (ref J1) (pin 3)))
|
||||
(net (code 26) (name "")
|
||||
(node (ref C1) (pin 2))
|
||||
(node (ref U1) (pin 5)))
|
||||
(net (code 27) (name /PC3)
|
||||
(node (ref U1) (pin 20))
|
||||
(node (ref P3) (pin 13)))
|
||||
(net (code 28) (name /PC6)
|
||||
(node (ref U1) (pin 23))
|
||||
(node (ref P3) (pin 10)))
|
||||
(net (code 29) (name /PD7)
|
||||
(node (ref P3) (pin 1))
|
||||
(node (ref U1) (pin 32)))
|
||||
(net (code 30) (name /PC5)
|
||||
(node (ref P3) (pin 11))
|
||||
(node (ref U1) (pin 22)))
|
||||
(net (code 31) (name /PB4)
|
||||
(node (ref P1) (pin 8))
|
||||
(node (ref U1) (pin 12)))
|
||||
(net (code 32) (name /PC4)
|
||||
(node (ref P3) (pin 12))
|
||||
(node (ref U1) (pin 21)))
|
||||
(net (code 33) (name /PB5)
|
||||
(node (ref U1) (pin 11))
|
||||
(node (ref P1) (pin 7)))
|
||||
(net (code 34) (name /PF4)
|
||||
(node (ref U1) (pin 8))
|
||||
(node (ref P1) (pin 6)))
|
||||
(net (code 35) (name /OSC2IN)
|
||||
(node (ref U1) (pin 3))
|
||||
(node (ref P1) (pin 5)))
|
||||
(net (code 36) (name /OSC1IN)
|
||||
(node (ref P1) (pin 4))
|
||||
(node (ref U1) (pin 2)))
|
||||
(net (code 37) (name /PD3)
|
||||
(node (ref P3) (pin 5))
|
||||
(node (ref U1) (pin 28)))
|
||||
(net (code 38) (name /PE5)
|
||||
(node (ref U1) (pin 17))
|
||||
(node (ref P1) (pin 13)))
|
||||
(net (code 39) (name /SWIM/PD1)
|
||||
(node (ref P3) (pin 7))
|
||||
(node (ref P2) (pin 2))
|
||||
(node (ref U1) (pin 26)))
|
||||
(net (code 40) (name /PD0)
|
||||
(node (ref P3) (pin 8))
|
||||
(node (ref U1) (pin 25)))
|
||||
(net (code 41) (name /PC7)
|
||||
(node (ref U1) (pin 24))
|
||||
(node (ref P3) (pin 9)))
|
||||
(net (code 42) (name "")
|
||||
(node (ref R1) (pin 1))
|
||||
(node (ref D1) (pin 2)))))
|
||||
731
stepper_independent/schematic/stepper.sch
Normal file
731
stepper_independent/schematic/stepper.sch
Normal file
@ -0,0 +1,731 @@
|
||||
EESchema Schematic File Version 2 date Ср 12 фев 2014 14:02:01
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:special
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:stm8
|
||||
LIBS:st-microelectronics
|
||||
LIBS:stm8s105k4t6c
|
||||
LIBS:stepper-cache
|
||||
EELAYER 27 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date "12 feb 2014"
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L STM8S105K4T6C U1
|
||||
U 1 1 52FB03A2
|
||||
P 4400 3100
|
||||
F 0 "U1" H 4400 4150 60 0000 C CNN
|
||||
F 1 "STM8S105K4T6C" H 4450 2250 60 0000 C CNN
|
||||
F 2 "~" H 4400 3100 60 0000 C CNN
|
||||
F 3 "~" H 4400 3100 60 0000 C CNN
|
||||
1 4400 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR01
|
||||
U 1 1 52FB03EF
|
||||
P 2750 3200
|
||||
F 0 "#PWR01" H 2750 3200 30 0001 C CNN
|
||||
F 1 "GND" H 2750 3130 30 0001 C CNN
|
||||
F 2 "" H 2750 3200 60 0000 C CNN
|
||||
F 3 "" H 2750 3200 60 0000 C CNN
|
||||
1 2750 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 3200 2750 3150
|
||||
Wire Wire Line
|
||||
2750 3150 3000 3150
|
||||
$Comp
|
||||
L GND #PWR02
|
||||
U 1 1 52FB0400
|
||||
P 2750 2600
|
||||
F 0 "#PWR02" H 2750 2600 30 0001 C CNN
|
||||
F 1 "GND" H 2750 2530 30 0001 C CNN
|
||||
F 2 "" H 2750 2600 60 0000 C CNN
|
||||
F 3 "" H 2750 2600 60 0000 C CNN
|
||||
1 2750 2600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 2600 2750 2550
|
||||
Wire Wire Line
|
||||
2750 2550 3000 2550
|
||||
$Comp
|
||||
L C C1
|
||||
U 1 1 52FB0413
|
||||
P 2250 2700
|
||||
F 0 "C1" H 2300 2800 50 0000 L CNN
|
||||
F 1 "1u" H 2300 2600 50 0000 L CNN
|
||||
F 2 "" H 2250 2700 60 0000 C CNN
|
||||
F 3 "" H 2250 2700 60 0000 C CNN
|
||||
1 2250 2700
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L C C2
|
||||
U 1 1 52FB0426
|
||||
P 2250 2950
|
||||
F 0 "C2" H 2300 3050 50 0000 L CNN
|
||||
F 1 "104" H 2300 2850 50 0000 L CNN
|
||||
F 2 "" H 2250 2950 60 0000 C CNN
|
||||
F 3 "" H 2250 2950 60 0000 C CNN
|
||||
1 2250 2950
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2450 2700 2850 2700
|
||||
Wire Wire Line
|
||||
2850 2700 2850 2650
|
||||
Wire Wire Line
|
||||
2850 2650 3000 2650
|
||||
Wire Wire Line
|
||||
3000 2750 3000 2850
|
||||
Wire Wire Line
|
||||
2450 2950 2450 2850
|
||||
Wire Wire Line
|
||||
2450 2850 3000 2850
|
||||
Wire Wire Line
|
||||
2050 2700 2050 3100
|
||||
$Comp
|
||||
L GND #PWR03
|
||||
U 1 1 52FB0453
|
||||
P 2050 3100
|
||||
F 0 "#PWR03" H 2050 3100 30 0001 C CNN
|
||||
F 1 "GND" H 2050 3030 30 0001 C CNN
|
||||
F 2 "" H 2050 3100 60 0000 C CNN
|
||||
F 3 "" H 2050 3100 60 0000 C CNN
|
||||
1 2050 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 2050 2800
|
||||
Connection ~ 2050 2950
|
||||
Text Label 3000 2250 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 3000 2350 2 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 3000 2450 2 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 3000 2950 2 60 ~ 0
|
||||
PF4
|
||||
Text Label 3000 3250 2 60 ~ 0
|
||||
PB5
|
||||
Text Label 3000 3350 2 60 ~ 0
|
||||
PB4
|
||||
Text Label 3000 3450 2 60 ~ 0
|
||||
PB3
|
||||
Text Label 3000 3550 2 60 ~ 0
|
||||
PB2
|
||||
Text Label 3000 3650 2 60 ~ 0
|
||||
PB1
|
||||
Text Label 3000 3750 2 60 ~ 0
|
||||
PB0
|
||||
Text Label 5800 3750 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 5800 3650 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 5800 3550 0 60 ~ 0
|
||||
PC2
|
||||
Text Label 5800 3450 0 60 ~ 0
|
||||
PC3
|
||||
Text Label 5800 3350 0 60 ~ 0
|
||||
PC4
|
||||
Text Label 5800 3250 0 60 ~ 0
|
||||
PC5
|
||||
Text Label 5800 3150 0 60 ~ 0
|
||||
PC6
|
||||
Text Label 5800 3050 0 60 ~ 0
|
||||
PC7
|
||||
Text Label 5800 2950 0 60 ~ 0
|
||||
PD0
|
||||
Text Label 5800 2850 0 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 5800 2750 0 60 ~ 0
|
||||
PD2
|
||||
Text Label 5800 2650 0 60 ~ 0
|
||||
PD3
|
||||
Text Label 5800 2550 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 5800 2450 0 60 ~ 0
|
||||
PD5
|
||||
Text Label 5800 2350 0 60 ~ 0
|
||||
PD6
|
||||
Text Label 5800 2250 0 60 ~ 0
|
||||
PD7
|
||||
$Comp
|
||||
L CONN_4 P2
|
||||
U 1 1 52FB0A49
|
||||
P 4350 1000
|
||||
F 0 "P2" V 4300 1000 50 0000 C CNN
|
||||
F 1 "CONN_4" V 4400 1000 50 0000 C CNN
|
||||
F 2 "" H 4350 1000 60 0000 C CNN
|
||||
F 3 "" H 4350 1000 60 0000 C CNN
|
||||
1 4350 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P1
|
||||
U 1 1 52FB0A6A
|
||||
P 1250 1500
|
||||
F 0 "P1" V 1220 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 1330 1500 60 0000 C CNN
|
||||
F 2 "" H 1250 1500 60 0000 C CNN
|
||||
F 3 "" H 1250 1500 60 0000 C CNN
|
||||
1 1250 1500
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P3
|
||||
U 1 1 52FB0A79
|
||||
P 7100 1500
|
||||
F 0 "P3" V 7070 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 7180 1500 60 0000 C CNN
|
||||
F 2 "" H 7100 1500 60 0000 C CNN
|
||||
F 3 "" H 7100 1500 60 0000 C CNN
|
||||
1 7100 1500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Text Label 1600 1150 0 60 ~ 0
|
||||
OSC1IN
|
||||
Text Label 1600 1250 0 60 ~ 0
|
||||
OSC2IN
|
||||
Text Label 1600 1350 0 60 ~ 0
|
||||
PF4
|
||||
Text Label 1600 1450 0 60 ~ 0
|
||||
PB5
|
||||
Text Label 1600 1550 0 60 ~ 0
|
||||
PB4
|
||||
Text Label 1600 1650 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1600 1750 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1600 1850 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1600 1950 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1600 2050 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 1600 2150 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 1600 1050 0 60 ~ 0
|
||||
NRST
|
||||
Text Label 4000 950 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 4000 1050 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 6750 850 2 60 ~ 0
|
||||
PD7
|
||||
Text Label 6750 950 2 60 ~ 0
|
||||
PD6
|
||||
Text Label 6750 1050 2 60 ~ 0
|
||||
PD5
|
||||
Text Label 6750 1150 2 60 ~ 0
|
||||
PD4
|
||||
Text Label 6750 1250 2 60 ~ 0
|
||||
PD3
|
||||
Text Label 6750 1350 2 60 ~ 0
|
||||
PD2
|
||||
Text Label 6750 1450 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 6750 1550 2 60 ~ 0
|
||||
PD0
|
||||
Text Label 6750 1650 2 60 ~ 0
|
||||
PC7
|
||||
Text Label 6750 1750 2 60 ~ 0
|
||||
PC6
|
||||
Text Label 6750 1850 2 60 ~ 0
|
||||
PC5
|
||||
Text Label 6750 1950 2 60 ~ 0
|
||||
PC4
|
||||
Text Label 6750 2050 2 60 ~ 0
|
||||
PC3
|
||||
Text Label 6750 2150 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR04
|
||||
U 1 1 52FB0DC4
|
||||
P 950 2800
|
||||
F 0 "#PWR04" H 950 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 950 2910 30 0000 C CNN
|
||||
F 2 "" H 950 2800 60 0000 C CNN
|
||||
F 3 "" H 950 2800 60 0000 C CNN
|
||||
1 950 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D1
|
||||
U 1 1 52FB0DD3
|
||||
P 950 3100
|
||||
F 0 "D1" H 950 3200 50 0000 C CNN
|
||||
F 1 "LED" H 950 3000 50 0000 C CNN
|
||||
F 2 "" H 950 3100 60 0000 C CNN
|
||||
F 3 "" H 950 3100 60 0000 C CNN
|
||||
1 950 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 52FB0DE2
|
||||
P 950 3600
|
||||
F 0 "R1" V 1030 3600 50 0000 C CNN
|
||||
F 1 "1k" V 950 3600 50 0000 C CNN
|
||||
F 2 "" H 950 3600 60 0000 C CNN
|
||||
F 3 "" H 950 3600 60 0000 C CNN
|
||||
1 950 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
950 2800 950 2900
|
||||
Wire Wire Line
|
||||
950 3300 950 3350
|
||||
Wire Wire Line
|
||||
950 3850 950 3950
|
||||
$Comp
|
||||
L +3.3V #PWR05
|
||||
U 1 1 52FB0EC7
|
||||
P 1300 2800
|
||||
F 0 "#PWR05" H 1300 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1300 2910 30 0000 C CNN
|
||||
F 2 "" H 1300 2800 60 0000 C CNN
|
||||
F 3 "" H 1300 2800 60 0000 C CNN
|
||||
1 1300 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D2
|
||||
U 1 1 52FB0ECD
|
||||
P 1300 3100
|
||||
F 0 "D2" H 1300 3200 50 0000 C CNN
|
||||
F 1 "LED" H 1300 3000 50 0000 C CNN
|
||||
F 2 "" H 1300 3100 60 0000 C CNN
|
||||
F 3 "" H 1300 3100 60 0000 C CNN
|
||||
1 1300 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 52FB0ED3
|
||||
P 1300 3600
|
||||
F 0 "R2" V 1380 3600 50 0000 C CNN
|
||||
F 1 "1k" V 1300 3600 50 0000 C CNN
|
||||
F 2 "" H 1300 3600 60 0000 C CNN
|
||||
F 3 "" H 1300 3600 60 0000 C CNN
|
||||
1 1300 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR06
|
||||
U 1 1 52FB0ED9
|
||||
P 1300 3950
|
||||
F 0 "#PWR06" H 1300 3950 30 0001 C CNN
|
||||
F 1 "GND" H 1300 3880 30 0001 C CNN
|
||||
F 2 "" H 1300 3950 60 0000 C CNN
|
||||
F 3 "" H 1300 3950 60 0000 C CNN
|
||||
1 1300 3950
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 2800 1300 2900
|
||||
Wire Wire Line
|
||||
1300 3300 1300 3350
|
||||
Wire Wire Line
|
||||
1300 3850 1300 3950
|
||||
Text Label 950 3950 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR07
|
||||
U 1 1 52FB0EF1
|
||||
P 6500 2550
|
||||
F 0 "#PWR07" H 6500 2510 30 0001 C CNN
|
||||
F 1 "+3.3V" H 6500 2660 30 0000 C CNN
|
||||
F 2 "" H 6500 2550 60 0000 C CNN
|
||||
F 3 "" H 6500 2550 60 0000 C CNN
|
||||
1 6500 2550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 52FB0EFD
|
||||
P 6500 2900
|
||||
F 0 "R3" V 6580 2900 50 0000 C CNN
|
||||
F 1 "10k" V 6500 2900 50 0000 C CNN
|
||||
F 2 "" H 6500 2900 60 0000 C CNN
|
||||
F 3 "" H 6500 2900 60 0000 C CNN
|
||||
1 6500 2900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR08
|
||||
U 1 1 52FB0F03
|
||||
P 6500 4050
|
||||
F 0 "#PWR08" H 6500 4050 30 0001 C CNN
|
||||
F 1 "GND" H 6500 3980 30 0001 C CNN
|
||||
F 2 "" H 6500 4050 60 0000 C CNN
|
||||
F 3 "" H 6500 4050 60 0000 C CNN
|
||||
1 6500 4050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 2550 6500 2650
|
||||
Wire Wire Line
|
||||
6500 3850 6500 4050
|
||||
$Comp
|
||||
L SW_PUSH SW1
|
||||
U 1 1 52FB0F3B
|
||||
P 6500 3550
|
||||
F 0 "SW1" H 6650 3660 50 0000 C CNN
|
||||
F 1 "SW_PUSH" H 6500 3470 50 0000 C CNN
|
||||
F 2 "" H 6500 3550 60 0000 C CNN
|
||||
F 3 "" H 6500 3550 60 0000 C CNN
|
||||
1 6500 3550
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 3250 6500 3150
|
||||
$Comp
|
||||
L C C3
|
||||
U 1 1 52FB0F99
|
||||
P 6900 3550
|
||||
F 0 "C3" H 6950 3650 50 0000 L CNN
|
||||
F 1 "104" H 6950 3450 50 0000 L CNN
|
||||
F 2 "" H 6900 3550 60 0000 C CNN
|
||||
F 3 "" H 6900 3550 60 0000 C CNN
|
||||
1 6900 3550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6900 3200 6900 3350
|
||||
Wire Wire Line
|
||||
6900 3750 6900 3900
|
||||
Wire Wire Line
|
||||
6900 3900 6500 3900
|
||||
Connection ~ 6500 3900
|
||||
Wire Wire Line
|
||||
6500 3200 6900 3200
|
||||
Connection ~ 6500 3200
|
||||
Text Label 6500 3200 2 60 ~ 0
|
||||
NRST
|
||||
$Comp
|
||||
L +3.3V #PWR09
|
||||
U 1 1 52FB2273
|
||||
P 2150 850
|
||||
F 0 "#PWR09" H 2150 810 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2150 960 30 0000 C CNN
|
||||
F 2 "" H 2150 850 60 0000 C CNN
|
||||
F 3 "" H 2150 850 60 0000 C CNN
|
||||
1 2150 850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 850 2150 850
|
||||
$Comp
|
||||
L GND #PWR010
|
||||
U 1 1 52FB2296
|
||||
P 2150 1000
|
||||
F 0 "#PWR010" H 2150 1000 30 0001 C CNN
|
||||
F 1 "GND" H 2150 930 30 0001 C CNN
|
||||
F 2 "" H 2150 1000 60 0000 C CNN
|
||||
F 3 "" H 2150 1000 60 0000 C CNN
|
||||
1 2150 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 950 2150 950
|
||||
Wire Wire Line
|
||||
2150 950 2150 1000
|
||||
Wire Wire Line
|
||||
2600 3050 3000 3050
|
||||
Wire Wire Line
|
||||
2750 3050 2750 2850
|
||||
Connection ~ 2750 2850
|
||||
$Comp
|
||||
L +3.3V #PWR011
|
||||
U 1 1 52FB26FA
|
||||
P 2600 3000
|
||||
F 0 "#PWR011" H 2600 2960 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2600 3110 30 0000 C CNN
|
||||
F 2 "" H 2600 3000 60 0000 C CNN
|
||||
F 3 "" H 2600 3000 60 0000 C CNN
|
||||
1 2600 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2600 3000 2600 3050
|
||||
Connection ~ 2750 3050
|
||||
$Comp
|
||||
L +3.3V #PWR012
|
||||
U 1 1 52FB286D
|
||||
P 4000 750
|
||||
F 0 "#PWR012" H 4000 710 30 0001 C CNN
|
||||
F 1 "+3.3V" H 4000 860 30 0000 C CNN
|
||||
F 2 "" H 4000 750 60 0000 C CNN
|
||||
F 3 "" H 4000 750 60 0000 C CNN
|
||||
1 4000 750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR013
|
||||
U 1 1 52FB287C
|
||||
P 4000 1300
|
||||
F 0 "#PWR013" H 4000 1300 30 0001 C CNN
|
||||
F 1 "GND" H 4000 1230 30 0001 C CNN
|
||||
F 2 "" H 4000 1300 60 0000 C CNN
|
||||
F 3 "" H 4000 1300 60 0000 C CNN
|
||||
1 4000 1300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4000 1300 4000 1150
|
||||
Wire Wire Line
|
||||
4000 850 4000 750
|
||||
Wire Notes Line
|
||||
600 500 600 4200
|
||||
Wire Notes Line
|
||||
600 4200 7500 4200
|
||||
Wire Notes Line
|
||||
7500 4200 7500 500
|
||||
Wire Notes Line
|
||||
7500 500 600 500
|
||||
Text Notes 3550 4450 0 118 ~ 0
|
||||
STM8 board
|
||||
$Comp
|
||||
L DB25 J1
|
||||
U 1 1 52FB403E
|
||||
P 1150 6100
|
||||
F 0 "J1" H 1200 7450 70 0000 C CNN
|
||||
F 1 "DB25" H 1100 4750 70 0000 C CNN
|
||||
F 2 "" H 1150 6100 60 0000 C CNN
|
||||
F 3 "" H 1150 6100 60 0000 C CNN
|
||||
1 1150 6100
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR014
|
||||
U 1 1 52FB40A4
|
||||
P 2200 7500
|
||||
F 0 "#PWR014" H 2200 7500 30 0001 C CNN
|
||||
F 1 "GND" H 2200 7430 30 0001 C CNN
|
||||
F 2 "" H 2200 7500 60 0000 C CNN
|
||||
F 3 "" H 2200 7500 60 0000 C CNN
|
||||
1 2200 7500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 7200 2200 7200
|
||||
Wire Wire Line
|
||||
2200 5800 2200 7500
|
||||
Wire Wire Line
|
||||
1600 7000 2200 7000
|
||||
Connection ~ 2200 7200
|
||||
Wire Wire Line
|
||||
2200 6800 1600 6800
|
||||
Connection ~ 2200 7000
|
||||
Wire Wire Line
|
||||
1600 6600 2200 6600
|
||||
Connection ~ 2200 6800
|
||||
Wire Wire Line
|
||||
1600 6400 2200 6400
|
||||
Connection ~ 2200 6600
|
||||
Wire Wire Line
|
||||
1600 6200 2200 6200
|
||||
Connection ~ 2200 6400
|
||||
Wire Wire Line
|
||||
1600 6000 2200 6000
|
||||
Connection ~ 2200 6200
|
||||
Wire Wire Line
|
||||
1600 5800 2200 5800
|
||||
Connection ~ 2200 6000
|
||||
Text Label 1600 4900 0 60 ~ 0
|
||||
2nd out
|
||||
Text Label 1600 5100 0 60 ~ 0
|
||||
X CLK
|
||||
Text Label 1600 5300 0 60 ~ 0
|
||||
X DIR
|
||||
Text Label 1600 5500 0 60 ~ 0
|
||||
Y CLK
|
||||
Text Label 1600 5700 0 60 ~ 0
|
||||
Y DIR
|
||||
Text Label 1600 5900 0 60 ~ 0
|
||||
Z CLK
|
||||
Text Label 1600 6100 0 60 ~ 0
|
||||
Z DIR
|
||||
Text Label 1600 6300 0 60 ~ 0
|
||||
A CLK
|
||||
Text Label 1600 6500 0 60 ~ 0
|
||||
A DIR
|
||||
Text Label 1600 6700 0 60 ~ 0
|
||||
IN1
|
||||
Text Label 1600 6900 0 60 ~ 0
|
||||
IN2
|
||||
Text Label 1600 7100 0 60 ~ 0
|
||||
IN3
|
||||
Text Label 1600 7300 0 60 ~ 0
|
||||
IN4
|
||||
Text Label 1600 5200 0 60 ~ 0
|
||||
IN5
|
||||
Text Label 1600 5400 0 60 ~ 0
|
||||
EN
|
||||
Text Label 1600 5600 0 60 ~ 0
|
||||
1st out
|
||||
Wire Wire Line
|
||||
1600 5300 3000 5300
|
||||
Wire Wire Line
|
||||
1600 5700 3000 5700
|
||||
Wire Wire Line
|
||||
1600 6100 3000 6100
|
||||
Wire Wire Line
|
||||
1600 6500 3000 6500
|
||||
Text Label 3000 5300 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 3000 5700 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 3000 6100 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 3000 6500 0 60 ~ 0
|
||||
PB3
|
||||
Wire Wire Line
|
||||
1600 5100 2600 5100
|
||||
Wire Wire Line
|
||||
1600 5500 2600 5500
|
||||
Wire Wire Line
|
||||
1600 5900 2600 5900
|
||||
Wire Wire Line
|
||||
1600 6300 2600 6300
|
||||
NoConn ~ 1600 5000
|
||||
Text Label 2600 5100 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 2600 5500 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 2600 5900 0 60 ~ 0
|
||||
PD2
|
||||
NoConn ~ 2600 6300
|
||||
Wire Wire Line
|
||||
1600 4900 2300 4900
|
||||
Wire Wire Line
|
||||
1600 5200 2300 5200
|
||||
Wire Wire Line
|
||||
1600 5400 2300 5400
|
||||
Wire Wire Line
|
||||
1600 5600 2300 5600
|
||||
Wire Wire Line
|
||||
1600 7300 2300 7300
|
||||
Wire Wire Line
|
||||
1600 7100 2300 7100
|
||||
Wire Wire Line
|
||||
1600 6900 2300 6900
|
||||
Wire Wire Line
|
||||
1600 6700 2300 6700
|
||||
NoConn ~ 2300 4900
|
||||
NoConn ~ 2300 5200
|
||||
NoConn ~ 2300 5400
|
||||
NoConn ~ 2300 5600
|
||||
NoConn ~ 2300 6700
|
||||
NoConn ~ 2300 6900
|
||||
NoConn ~ 2300 7100
|
||||
NoConn ~ 2300 7300
|
||||
$Comp
|
||||
L CONN_5 P4
|
||||
U 1 1 52FB4AA7
|
||||
P 4800 5300
|
||||
F 0 "P4" V 4750 5300 50 0000 C CNN
|
||||
F 1 "CONN_5" V 4850 5300 50 0000 C CNN
|
||||
F 2 "" H 4800 5300 60 0000 C CNN
|
||||
F 3 "" H 4800 5300 60 0000 C CNN
|
||||
1 4800 5300
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Text Notes 700 4600 0 118 ~ 0
|
||||
To TB6560_T4_V4
|
||||
Text Notes 4150 4900 0 118 ~ 0
|
||||
USB <-> TTL
|
||||
Text Label 5200 5100 0 61 ~ 0
|
||||
GND
|
||||
Text Label 5200 5200 0 61 ~ 0
|
||||
RXD
|
||||
Text Label 5200 5300 0 61 ~ 0
|
||||
TXD
|
||||
Text Label 5200 5400 0 61 ~ 0
|
||||
5.0V
|
||||
Text Label 5200 5500 0 61 ~ 0
|
||||
3.3V
|
||||
$Comp
|
||||
L GND #PWR015
|
||||
U 1 1 52FB4CEF
|
||||
P 6200 5200
|
||||
F 0 "#PWR015" H 6200 5200 30 0001 C CNN
|
||||
F 1 "GND" H 6200 5130 30 0001 C CNN
|
||||
F 2 "" H 6200 5200 60 0000 C CNN
|
||||
F 3 "" H 6200 5200 60 0000 C CNN
|
||||
1 6200 5200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
5200 5100 6200 5100
|
||||
Wire Wire Line
|
||||
6200 5100 6200 5200
|
||||
Wire Wire Line
|
||||
5200 5200 5800 5200
|
||||
Wire Wire Line
|
||||
5800 5200 5800 4800
|
||||
Wire Wire Line
|
||||
5200 5300 6400 5300
|
||||
Wire Wire Line
|
||||
6400 5300 6400 4800
|
||||
$Comp
|
||||
L +3.3V #PWR016
|
||||
U 1 1 52FB4EDC
|
||||
P 6600 5400
|
||||
F 0 "#PWR016" H 6600 5360 30 0001 C CNN
|
||||
F 1 "+3.3V" H 6600 5510 30 0000 C CNN
|
||||
F 2 "" H 6600 5400 60 0000 C CNN
|
||||
F 3 "" H 6600 5400 60 0000 C CNN
|
||||
1 6600 5400
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
5200 5500 6600 5500
|
||||
Wire Wire Line
|
||||
6600 5500 6600 5400
|
||||
NoConn ~ 5200 5400
|
||||
Text Label 5800 4800 0 61 ~ 0
|
||||
PD5
|
||||
Text Label 6400 4800 0 61 ~ 0
|
||||
PD6
|
||||
$EndSCHEMATC
|
||||
9
stepper_independent/schematic/stm8s105k4t6c.bck
Normal file
9
stepper_independent/schematic/stm8s105k4t6c.bck
Normal file
@ -0,0 +1,9 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:09:58
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
13
stepper_independent/schematic/stm8s105k4t6c.dcm
Normal file
13
stepper_independent/schematic/stm8s105k4t6c.dcm
Normal file
@ -0,0 +1,13 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:26:38
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
$CMP STM8S105K4T6C
|
||||
K stm8
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
99
stepper_independent/schematic/stm8s105k4t6c.lib
Normal file
99
stepper_independent/schematic/stm8s105k4t6c.lib
Normal file
@ -0,0 +1,99 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Вт 11 фев 2014 17:26:38
|
||||
#encoding utf-8
|
||||
#
|
||||
# STM8S003K3T
|
||||
#
|
||||
DEF STM8S003K3T IC 0 40 Y Y 1 F N
|
||||
F0 "IC" -800 1150 60 H V C CNN
|
||||
F1 "STM8S003K3T" 550 -1100 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LQFP32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -850 1100 850 -1050 0 1 10 f
|
||||
X NRST 1 -1000 1000 149 R 40 40 1 1 I
|
||||
X OSCI/PA1 2 1000 1000 149 L 40 40 1 1 B
|
||||
X OSCOUT/PA2 3 1000 900 149 L 40 40 1 1 B
|
||||
X VSS 4 0 -1200 149 U 40 40 1 1 W
|
||||
X Vcap 5 -1000 -950 149 R 40 40 1 1 I
|
||||
X VDD 6 0 1250 149 D 40 40 1 1 W
|
||||
X [SPI_NSS]TIM2_CH3/PA3 7 1000 800 149 L 40 40 1 1 B
|
||||
X PF4 8 -1000 -350 149 R 40 40 1 1 B
|
||||
X PB7 9 1000 -50 149 L 40 40 1 1 B
|
||||
X PB6 10 1000 50 149 L 40 40 1 1 B
|
||||
X TIM1_CH3/PC3 20 1000 -400 149 L 40 40 1 1 B
|
||||
X PD5/UART1_TX 30 -1000 150 149 R 40 40 1 1 B
|
||||
X I2C_SDA/PB5 11 1000 150 149 L 40 40 1 1 B
|
||||
X CLK_CCO/TIM1_CH4/PC4 21 1000 -500 149 L 40 40 1 1 B
|
||||
X PD6/UART1_RX 31 -1000 50 149 R 40 40 1 1 B
|
||||
X I2C_SCL/PB4 12 1000 250 149 L 40 40 1 1 B
|
||||
X SPI_SCK/PC5 22 1000 -600 149 L 40 40 1 1 B
|
||||
X PD7/TLI[TIM1_CH4] 32 -1000 -50 148 R 40 40 1 1 B
|
||||
X TIM1_ETR/AIN3/PB3 13 1000 350 149 L 40 40 1 1 B
|
||||
X PI_MOSI/PC6 23 1000 -700 149 L 40 40 1 1 B
|
||||
X TIM1_CH3N/AIN2/PB2 14 1000 450 149 L 40 40 1 1 B
|
||||
X PI_MISO/PC7 24 1000 -800 149 L 40 40 1 1 B
|
||||
X TIM1_CH2N/AIN1/PB1 15 1000 550 149 L 40 40 1 1 B
|
||||
X PD0/TIM1_BKIN[CLK_CCO] 25 -1000 650 148 R 40 40 1 1 B
|
||||
X TIM1_CH1N/AIN0/PB0 16 1000 650 149 L 40 40 1 1 B
|
||||
X PD1/SWIM 26 -1000 550 149 R 40 40 1 1 B
|
||||
X PE5/SPI_NSS 17 -1000 -200 148 R 40 40 1 1 B
|
||||
X PD2[TIM2_CH3] 27 -1000 450 149 R 40 40 1 1 B
|
||||
X UART1_CK/TIM1_CH1/PC1 18 1000 -200 149 L 40 40 1 1 B
|
||||
X PD3/ADC_ETR/TIM2_CH2 28 -1000 350 149 R 40 40 1 1 B
|
||||
X TIM1_CH2/PC2 19 1000 -300 149 L 40 40 1 1 B
|
||||
X PD4/BEEP/TIM2_CH1 29 -1000 250 149 R 40 40 1 1 B
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
187
stepper_independent/stepper.c
Normal file
187
stepper_independent/stepper.c
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* stepper.c
|
||||
*
|
||||
* Copyright 2014 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 "ports_definition.h"
|
||||
#include "stepper.h"
|
||||
|
||||
volatile int Nsteps[3]={0,0,0}; // Number of steps
|
||||
U8 Motor_number = 5; // Number of motor to move, 5 -- not moving
|
||||
U16 Stepper_speed[3] = {1000,1000,1000}; // length of one MICROstep in us
|
||||
//U8* Timers[3] = {&TIM1_CR1, &TIM2_CR1, &TIM3_CR1};
|
||||
U8* Timers[3] = {0x5250, 0x5300, 0x5320};
|
||||
|
||||
#define pause_motor(N) *Timers[N] &= ~TIM_CR1_CEN
|
||||
#define resume_motor(N) *Timers[N] |= TIM_CR1_CEN
|
||||
#define check_motor(N) *Timers[N] & TIM_CR1_CEN
|
||||
#define PPOUT(P, PIN) PORT(P, DDR) |= PIN; PORT(P, CR1) |= PIN
|
||||
#define TMR(a, b) CONCAT(a , b)
|
||||
#define TIMER_CONF(reg, val) TMR(TIM1, reg) = val; TMR(TIM2, reg) = val; TMR(TIM3, reg) = val;
|
||||
|
||||
/**
|
||||
* Setup pins of stepper motor (all - PP out)
|
||||
*/
|
||||
void setup_stepper_pins(){
|
||||
// CLK
|
||||
PPOUT(STP0_CLK_PORT, STP0_CLK_PIN);
|
||||
PPOUT(STP1_CLK_PORT, STP1_CLK_PIN);
|
||||
PPOUT(STP2_CLK_PORT, STP2_CLK_PIN);
|
||||
// DIR
|
||||
PPOUT(STP0_DIR_PORT, STP0_DIR_PIN);
|
||||
PPOUT(STP1_DIR_PORT, STP1_DIR_PIN);
|
||||
PPOUT(STP2_DIR_PORT, STP2_DIR_PIN);
|
||||
/**** TIMERS (all - 1MHz, default speed - 1000 Hz) ****/
|
||||
// Motor x - timer x+1
|
||||
TIM1_PSCRH = 0; // this timer have 16 bit prescaler
|
||||
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
|
||||
TIM2_PSCR = 4;
|
||||
TIM3_PSCR = 4;
|
||||
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
|
||||
TIMER_CONF(ARRH, 0x03);
|
||||
TIMER_CONF(ARRL, 0xE8);
|
||||
// 50% duty cycle: TIM_CCR = 500 = 0x01F4
|
||||
TIMER_CONF(CCR1H, 0x01);
|
||||
TIMER_CONF(CCR1L, 0xF4);
|
||||
// channel 1 generates PWM pulses
|
||||
TIMER_CONF(CCMR1, 0x60); // OC1M = 110b - PWM mode 1 ( 1 -> 0)
|
||||
TIMER_CONF(CCER1, 1); // Channel 1 is on. Active is high
|
||||
// interrupts: update
|
||||
TIMER_CONF(IER, TIM_IER_UIE);
|
||||
// auto-reload + interrupt on overflow
|
||||
TIMER_CONF(CR1, TIM_CR1_APRE | TIM_CR1_URS);
|
||||
// enable PWM output for timer1
|
||||
TIM1_BKR |= 0x80; // MOE
|
||||
}
|
||||
|
||||
/**
|
||||
* Set speed of stepper motor
|
||||
* @param Sps - period (in us) of one MICROstep
|
||||
*/
|
||||
void set_stepper_speed(U8 N, U16 SpS){
|
||||
U8 AH, AL, CH, CL;
|
||||
if(N > 2) return;
|
||||
Stepper_speed[N] = SpS;
|
||||
AH = SpS >> 8;
|
||||
AL = SpS & 0xff;
|
||||
SpS >>= 1; // divide to 2 - 50% duty cycle
|
||||
CH = SpS >> 8;
|
||||
CL = SpS & 0xff;
|
||||
switch(N){
|
||||
case 0:
|
||||
TIM1_ARRH = AH;
|
||||
TIM1_ARRL = AL;
|
||||
TIM1_CCR1H = CH;
|
||||
TIM1_CCR1L = CL;
|
||||
break;
|
||||
case 1:
|
||||
TIM2_ARRH = AH;
|
||||
TIM2_ARRL = AL;
|
||||
TIM2_CCR1H = CH;
|
||||
TIM2_CCR1L = CL;
|
||||
break;
|
||||
case 2:
|
||||
TIM3_ARRH = AH;
|
||||
TIM3_ARRL = AL;
|
||||
TIM3_CCR1H = CH;
|
||||
TIM3_CCR1L = CL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void add_steps(U8 N, int Steps){
|
||||
long NS;
|
||||
U8 sign = 0;
|
||||
if(N > 3) return;
|
||||
// pause
|
||||
pause_motor(N);
|
||||
NS = Nsteps[N];
|
||||
if(PORT(STP_DIR_PORT, ODR) & STP_DIR_PIN == 0)
|
||||
NS *= -1L; // direction to opposite side
|
||||
NS += (long)Steps;
|
||||
if(NS == 0){ // there's nothing to move
|
||||
stop_motor(N);
|
||||
return;
|
||||
}
|
||||
// now change direction
|
||||
if(Nsteps < 0){
|
||||
uart_write("reverce\n");
|
||||
//??PORT(STP_DIR_PORT, ODR) ^= STP_DIR_PIN; // go to the opposite side
|
||||
Nsteps *= -1L;
|
||||
}
|
||||
// resume
|
||||
*resume_motor(N);
|
||||
}
|
||||
* */
|
||||
|
||||
void move_motor(U8 N, int Steps){
|
||||
if(N > 2) return;
|
||||
pause_motor(N);
|
||||
if(Steps < 0){// dir to left
|
||||
switch(N){
|
||||
case 0:
|
||||
PORT(STP0_DIR_PORT, ODR) &= ~STP0_DIR_PIN;
|
||||
break;
|
||||
case 1:
|
||||
PORT(STP1_DIR_PORT, ODR) &= ~STP1_DIR_PIN;
|
||||
break;
|
||||
case 2:
|
||||
PORT(STP2_DIR_PORT, ODR) &= ~STP2_DIR_PIN;
|
||||
break;
|
||||
}
|
||||
Steps *= -1;
|
||||
}
|
||||
Nsteps[N] = Steps;
|
||||
resume_motor(N);
|
||||
}
|
||||
|
||||
void stop_motor(U8 N){
|
||||
if(N > 2) return;
|
||||
pause_motor(N);
|
||||
switch(N){ // turn off DIR
|
||||
case 0:
|
||||
PORT(STP0_DIR_PORT, ODR) |= STP0_DIR_PIN;
|
||||
break;
|
||||
case 1:
|
||||
PORT(STP1_DIR_PORT, ODR) |= STP1_DIR_PIN;
|
||||
break;
|
||||
case 2:
|
||||
PORT(STP2_DIR_PORT, ODR) |= STP2_DIR_PIN;
|
||||
break;
|
||||
}
|
||||
Nsteps[N] = 0;
|
||||
uart_write("stop");
|
||||
printUint(&N, 1);
|
||||
}
|
||||
|
||||
void pause_resume(U8 N){
|
||||
if(N > 2) return;
|
||||
if(Nsteps[N] == 0) return; // motor is stopped
|
||||
if(check_motor(N)){ // motor is running - pause
|
||||
pause_motor(N);
|
||||
uart_write("pause");
|
||||
}else{ // resume
|
||||
resume_motor(N);
|
||||
uart_write("resume");
|
||||
}
|
||||
printUint(&N, 1);
|
||||
}
|
||||
|
||||
|
||||
38
stepper_independent/stepper.h
Normal file
38
stepper_independent/stepper.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* stepper.h
|
||||
*
|
||||
* Copyright 2014 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
|
||||
extern volatile int Nsteps[];
|
||||
extern U16 Stepper_speed[];
|
||||
|
||||
void setup_stepper_pins();
|
||||
void set_stepper_speed(U8 N, U16 SpS);
|
||||
void move_motor(U8 N, int Steps);
|
||||
void stop_motor(U8 N);
|
||||
void pause_resume(U8 N);
|
||||
|
||||
#endif // __STEPPER_H__
|
||||
BIN
stepper_independent/testproj.bin
Normal file
BIN
stepper_independent/testproj.bin
Normal file
Binary file not shown.
34
stepper_independent_bin/Makefile
Normal file
34
stepper_independent_bin/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
|
||||
CCFLAGS=-DSTM8S105 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -mstm8 --out-fmt-ihx -lstm8
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s105
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h ports_definition.h Makefile
|
||||
|
||||
all: $(NAME).ihx
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).ihx
|
||||
stm8flash $(FLASHFLAGS) -w $(NAME).ihx
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
.PHONY: all
|
||||
26
stepper_independent_bin/README
Normal file
26
stepper_independent_bin/README
Normal file
@ -0,0 +1,26 @@
|
||||
This is a simple example of INDEPENDENT management of 3 stepper motors.
|
||||
|
||||
You can connect up to 256 devices to common UART line
|
||||
To work with them use simple protocol:
|
||||
- each byte have 8 bits of data and nineth control bit
|
||||
- inactive modules don't read bytes with nineth bit == 0,
|
||||
only active module reads them
|
||||
- all modules send data with nineth bit == 0
|
||||
- to activate module simple send its number with nineth bit == 1
|
||||
- you can change module number (value will be stored in flash memory) by command 'N'
|
||||
and get its current number with command 'n'
|
||||
|
||||
All motors have independent lines DIR and CLK and common line EN.
|
||||
Motor selection performed by setting to 1 corresponding EN pin.
|
||||
Communication with MCU realized through simple USB<->TTL converter.
|
||||
Just connect lines Rx/Tx of converter to Tx/Rx of evaluation boart,
|
||||
connect together lines GND and +3.3V.
|
||||
Communication speed: 57600, proto: 8N1
|
||||
Comminication with MCU don't need special soft: you can even run screen session
|
||||
or some terminal client like _com_. Another wariant is a simple client - client-term.
|
||||
MCU itself can print to terminal a short help about its protocol, just sent letter 'h'
|
||||
to it.
|
||||
|
||||
You can connect up to 4 (5 for motor 0) end-point switches for each motor.
|
||||
There's an ability to move till certain EP switches value, also you can move
|
||||
motors infinitely (for now it realized only for all motors simultaneously).
|
||||
22
stepper_independent_bin/client-term/Makefile
Normal file
22
stepper_independent_bin/client-term/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
PROGRAM = client
|
||||
LDFLAGS =
|
||||
SRCS = client.c
|
||||
CC = gcc
|
||||
DEFINES = -D_XOPEN_SOURCE=501
|
||||
CXX = gcc
|
||||
CFLAGS = -Wall -Werror $(DEFINES)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
all : $(PROGRAM) clean
|
||||
$(PROGRAM) : $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
|
||||
|
||||
# some addition dependencies
|
||||
# %.o: %.c
|
||||
# $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@
|
||||
#$(SRCS) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
# @touch $@
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o *~
|
||||
depend:
|
||||
$(CXX) -MM $(CXX.SRCS)
|
||||
259
stepper_independent_bin/client-term/client.c
Normal file
259
stepper_independent_bin/client-term/client.c
Normal file
@ -0,0 +1,259 @@
|
||||
/*
|
||||
* client.c - simple terminal client
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 <termios.h> // tcsetattr
|
||||
#include <unistd.h> // tcsetattr, close, read, write
|
||||
#include <sys/ioctl.h> // ioctl
|
||||
#include <stdio.h> // printf, getchar, fopen, perror
|
||||
#include <stdlib.h> // exit
|
||||
#include <sys/stat.h> // read
|
||||
#include <fcntl.h> // read
|
||||
#include <signal.h> // signal
|
||||
#include <time.h> // time
|
||||
#include <string.h> // memcpy
|
||||
#include <stdint.h> // int types
|
||||
#include <sys/time.h> // gettimeofday
|
||||
|
||||
#define CMSPAR 010000000000
|
||||
|
||||
double t0; // start time
|
||||
|
||||
FILE *fout = NULL; // file for messages duplicating
|
||||
char *comdev = "/dev/ttyUSB0";
|
||||
int BAUD_RATE = B57600;
|
||||
struct termio oldtty, tty; // TTY flags
|
||||
struct termios oldt, newt; // terminal flags
|
||||
int comfd; // TTY fd
|
||||
|
||||
/**
|
||||
* function for different purposes that need to know time intervals
|
||||
* @return double value: time in seconds
|
||||
*/
|
||||
double dtime(){
|
||||
double t;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
t = tv.tv_sec + ((double)tv.tv_usec)/1e6;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit & return terminal to old state
|
||||
* @param ex_stat - status (return code)
|
||||
*/
|
||||
void quit(int ex_stat){
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state
|
||||
ioctl(comfd, TCSANOW, &oldtty ); // return TTY to previous state
|
||||
close(comfd);
|
||||
if(fout) fclose(fout);
|
||||
printf("Exit! (%d)\n", ex_stat);
|
||||
exit(ex_stat);
|
||||
}
|
||||
|
||||
unsigned char crc(unsigned char data){
|
||||
unsigned char crc = data & 1;
|
||||
unsigned int i;
|
||||
for(i = 1; i<8; i++) crc ^= (data >> i) & 1;
|
||||
return crc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open & setup TTY, terminal
|
||||
*/
|
||||
void tty_init(){
|
||||
// terminal without echo
|
||||
tcgetattr(STDIN_FILENO, &oldt);
|
||||
newt = oldt;
|
||||
newt.c_lflag &= ~(ICANON | ECHO);
|
||||
if(tcsetattr(STDIN_FILENO, TCSANOW, &newt) < 0) quit(-2);
|
||||
printf("\nOpen port...\n");
|
||||
if ((comfd = open(comdev,O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0){
|
||||
fprintf(stderr,"Can't use port %s\n",comdev);
|
||||
quit(1);
|
||||
}
|
||||
printf(" OK\nGet current settings...\n");
|
||||
if(ioctl(comfd,TCGETA,&oldtty) < 0) exit(-1); // Get settings
|
||||
tty = oldtty;
|
||||
tty.c_lflag = 0; // ~(ICANON | ECHO | ECHOE | ISIG)
|
||||
tty.c_oflag = 0;
|
||||
tty.c_iflag = 0;
|
||||
tty.c_cflag = BAUD_RATE|CS8|CREAD|CLOCAL|PARENB; // we will emulate 9bit by PAR
|
||||
tty.c_cc[VMIN] = 0; // non-canonical mode
|
||||
tty.c_cc[VTIME] = 5;
|
||||
if(ioctl(comfd,TCSETA,&tty) < 0) exit(-1); // set new mode
|
||||
printf(" OK\n");
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read character from console without echo
|
||||
* @return char readed
|
||||
*/
|
||||
int read_console(){
|
||||
int rb;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(STDIN_FILENO, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000;
|
||||
retval = select(1, &rfds, NULL, NULL, &tv);
|
||||
if(!retval) rb = 0;
|
||||
else {
|
||||
if(FD_ISSET(STDIN_FILENO, &rfds)) rb = getchar();
|
||||
else rb = 0;
|
||||
}
|
||||
return rb;
|
||||
}
|
||||
|
||||
/**
|
||||
* getchar() without echo
|
||||
* wait until at least one character pressed
|
||||
* @return character readed
|
||||
*/
|
||||
int mygetchar(){ // аналог getchar() без необходимости жать Enter
|
||||
int ret;
|
||||
do ret = read_console();
|
||||
while(ret == 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from TTY
|
||||
* @param buff (o) - buffer for data read
|
||||
* @param length - buffer len
|
||||
* @return amount of readed bytes
|
||||
*/
|
||||
size_t read_tty(uint8_t *buff, size_t length){
|
||||
ssize_t L = 0;
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
int retval;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(comfd, &rfds);
|
||||
tv.tv_sec = 0; tv.tv_usec = 10000; // wait for 10ms
|
||||
retval = select(comfd + 1, &rfds, NULL, NULL, &tv);
|
||||
if (!retval) return 0;
|
||||
if(FD_ISSET(comfd, &rfds)){
|
||||
if((L = read(comfd, buff, length)) < 1) return 0;
|
||||
}
|
||||
return (size_t)L;
|
||||
}
|
||||
|
||||
void help(){
|
||||
printf("Use this commands:\n"
|
||||
"H\tShow this help\n"
|
||||
"D\tChange device number\n"
|
||||
"q\tQuit\n"
|
||||
);
|
||||
}
|
||||
|
||||
#define dup_pr(...) do{printf(__VA_ARGS__); if(fout) fprintf(fout, __VA_ARGS__);}while(0)
|
||||
|
||||
/**
|
||||
* Set/reset nineth bit and send command
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void send_with_9(unsigned char cmd, int nineth){
|
||||
if(crc(cmd) ^ nineth) // (ODD CRC) XOR (set nineth) -> odd parity
|
||||
tty.c_cflag |= PARODD; // odd parity
|
||||
else
|
||||
tty.c_cflag &= ~PARODD; // even parity
|
||||
if(ioctl(comfd, TCSETA, &tty) < 0){
|
||||
perror("Ioctl");
|
||||
quit(2);
|
||||
}
|
||||
if(write(comfd, &cmd, 1) < 1){
|
||||
perror("Can't write to port");
|
||||
quit(2);
|
||||
}
|
||||
}
|
||||
|
||||
void con_sig(int rb){
|
||||
if(rb < 1) return;
|
||||
if(rb == 'q') quit(0); // q == exit
|
||||
else if(rb == 'H'){ // this program help
|
||||
help();
|
||||
return;
|
||||
}else if(rb == 'D'){ // change device
|
||||
int N;
|
||||
printf("device number: ");
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state
|
||||
scanf("%d", &N);
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt); // and again - no echo
|
||||
if(N < 0 || N > 255){
|
||||
printf("\nWRONG DEVNUM!\n");
|
||||
return;
|
||||
}
|
||||
send_with_9((unsigned char)N, 1); // send marked byte with new device number
|
||||
return;
|
||||
}
|
||||
send_with_9((unsigned char)rb, 0); // just send command with zero nineth bit
|
||||
}
|
||||
|
||||
/**
|
||||
* Get integer value from buffer
|
||||
* @param buff (i) - buffer with int
|
||||
* @param len - length of data in buffer (could be 2 or 4)
|
||||
* @return
|
||||
*/
|
||||
uint32_t get_int(uint8_t *buff, size_t len){
|
||||
if(len != 2 && len != 4){
|
||||
fprintf(stdout, "Bad data length!\n");
|
||||
return 0xffffffff;
|
||||
}
|
||||
uint32_t data = 0;
|
||||
uint8_t *i8 = (uint8_t*) &data;
|
||||
if(len == 2) memcpy(i8, buff, 2);
|
||||
else memcpy(i8, buff, 4);
|
||||
return data;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int rb;
|
||||
uint8_t buff[128];
|
||||
size_t L;
|
||||
if(argc == 2){
|
||||
fout = fopen(argv[1], "a");
|
||||
if(!fout){
|
||||
perror("Can't open output file");
|
||||
exit(-1);
|
||||
}
|
||||
setbuf(fout, NULL);
|
||||
}
|
||||
tty_init();
|
||||
signal(SIGTERM, quit); // kill (-15)
|
||||
signal(SIGINT, quit); // ctrl+C
|
||||
signal(SIGQUIT, SIG_IGN); // ctrl+\ .
|
||||
signal(SIGTSTP, SIG_IGN); // ctrl+Z
|
||||
setbuf(stdout, NULL);
|
||||
t0 = dtime();
|
||||
while(1){
|
||||
rb = read_console();
|
||||
if(rb > 0) con_sig(rb);
|
||||
L = read_tty(buff, 127);
|
||||
if(L){
|
||||
buff[L] = 0;
|
||||
printf("%s", buff);
|
||||
if(fout) fprintf(fout, "%zd\t%s\n", time(NULL), buff);
|
||||
}
|
||||
}
|
||||
}
|
||||
207
stepper_independent_bin/interrupts.c
Normal file
207
stepper_independent_bin/interrupts.c
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
#define TREG(N, R) TIM##N##_##R
|
||||
|
||||
#define STPR_INTR(X) \
|
||||
if(TREG(X, SR1) & TIM_SR1_UIF){ \
|
||||
TREG(X, SR1) &= ~TIM_SR1_UIF; \
|
||||
if(Nsteps[X-1]){ \
|
||||
if(++usteps[X-1] == USteps){ \
|
||||
usteps[X-1] = 0; \
|
||||
if(!StepperInfty) \
|
||||
if(--Nsteps[X-1] == 0){ \
|
||||
stop_motor(X-1); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){
|
||||
check_EP();
|
||||
}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){
|
||||
check_EP();
|
||||
}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){
|
||||
check_EP();
|
||||
}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
check_EP();
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){
|
||||
check_EP();
|
||||
}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
STPR_INTR(1);
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){ // generate pulses for stepper CLK
|
||||
STPR_INTR(2);
|
||||
}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){
|
||||
STPR_INTR(3);
|
||||
}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){
|
||||
U8 rb;
|
||||
if(UART2_SR & UART_SR_RXNE){ // data received
|
||||
rb = UART2_DR; // read received byte & clear RXNE flag
|
||||
//while(!(UART2_SR & UART_SR_TXE));
|
||||
// get marked byte?
|
||||
if(UART2_CR1 & UART_CR1_R8){ // Master wanna change device?
|
||||
if(rb != UART_devNUM){ // another device number
|
||||
UART_is_our = 0;
|
||||
UART2_CR2 &= ~UART_CR2_TEN; // disable transmitter
|
||||
}else{ // our device
|
||||
UART_is_our = 1;
|
||||
UART2_CR2 |= UART_CR2_TEN; // enable transmitter
|
||||
UART_send_byte('*'); // send '*' - we got the command
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!UART_is_our) return; // this isn't our business - !marked & !our
|
||||
UART_send_byte(rb); // echo received symbol
|
||||
UART_rx[UART_rx_cur_i++] = rb; // put received byte into cycled buffer
|
||||
if(UART_rx_cur_i == UART_rx_start_i){ // Oops: buffer overflow! Just forget old data
|
||||
UART_rx_start_i++;
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
}
|
||||
check_UART_pointer(UART_rx_cur_i);
|
||||
}
|
||||
}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){
|
||||
if(TIM4_SR & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM4_SR = 0; // clear all interrupt flags
|
||||
}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
144
stepper_independent_bin/interrupts.h
Normal file
144
stepper_independent_bin/interrupts.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
392
stepper_independent_bin/main.c
Normal file
392
stepper_independent_bin/main.c
Normal file
@ -0,0 +1,392 @@
|
||||
/*
|
||||
* blinky.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "ports_definition.h"
|
||||
#include "interrupts.h"
|
||||
#include "main.h"
|
||||
#include "stepper.h"
|
||||
|
||||
/*
|
||||
* 0 0000
|
||||
* 1 0001
|
||||
* 2 0010
|
||||
* 3 0011
|
||||
* 4 0100
|
||||
* 5 0101
|
||||
* 6 0110
|
||||
* 7 0111
|
||||
* 8 1000
|
||||
* 9 1001
|
||||
* a 1010
|
||||
* b 1011
|
||||
* c 1100
|
||||
* d 1101
|
||||
* e 1110
|
||||
* f 1111
|
||||
*/
|
||||
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
U16 paused_val = 500; // interval between LED flashing
|
||||
|
||||
U8 UART_rx[UART_BUF_LEN]; // cycle buffer for received data
|
||||
U8 UART_rx_start_i = 0; // started index of received data (from which reading starts)
|
||||
U8 UART_rx_cur_i = 0; // index of current first byte in rx array (to which data will be written)
|
||||
U8 UART_is_our = 0; // ==1 if we get UART
|
||||
// ATTENTION! to change global variable in PROGRAM memory, it should be CONST!!!
|
||||
const U8 UART_devNUM = THIS_DEVICE_NUM; // device number, master sais it
|
||||
|
||||
/**
|
||||
* Send one byte through UART
|
||||
* @param byte - data to send
|
||||
*/
|
||||
void UART_send_byte(U8 byte){
|
||||
if(!UART_is_our) return; // don't use UART when we have no right!
|
||||
//UART2_CR2 |= UART_CR2_TEN; // enable transmitter
|
||||
UART2_DR = byte;
|
||||
while(!(UART2_SR & UART_SR_TC));
|
||||
//UART2_CR2 &= ~UART_CR2_TEN; // disable transmitter
|
||||
}
|
||||
|
||||
void uart_write(char *str){
|
||||
if(!UART_is_our) return; // don't use UART when we have no right!
|
||||
//UART2_CR2 |= UART_CR2_TEN; // enable transmitter
|
||||
while(*str){
|
||||
UART2_DR = *str++;
|
||||
while(!(UART2_SR & UART_SR_TC));
|
||||
}
|
||||
//UART2_CR2 &= ~UART_CR2_TEN; // disable transmitter
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read one byte from Rx buffer
|
||||
* @param byte - where to store readed data
|
||||
* @return 1 in case of non-empty buffer
|
||||
*/
|
||||
U8 UART_read_byte(U8 *byte){
|
||||
if(UART_rx_start_i == UART_rx_cur_i) // buffer is empty
|
||||
return 0;
|
||||
*byte = UART_rx[UART_rx_start_i++];
|
||||
check_UART_pointer(UART_rx_start_i);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void printUint(U8 *val, U8 len){
|
||||
unsigned long Number = 0;
|
||||
U8 i = len;
|
||||
char ch;
|
||||
U8 decimal_buff[12]; // max len of U32 == 10 + \n + \0
|
||||
if(len > 4 || len == 3 || len == 0) return;
|
||||
for(i = 0; i < 12; i++)
|
||||
decimal_buff[i] = 0;
|
||||
decimal_buff[10] = '\n';
|
||||
ch = 9;
|
||||
switch(len){
|
||||
case 1:
|
||||
Number = *((U8*)val);
|
||||
break;
|
||||
case 2:
|
||||
Number = *((U16*)val);
|
||||
break;
|
||||
case 4:
|
||||
Number = *((unsigned long*)val);
|
||||
break;
|
||||
}
|
||||
do{
|
||||
i = Number % 10L;
|
||||
decimal_buff[ch--] = i + '0';
|
||||
Number /= 10L;
|
||||
}while(Number && ch > -1);
|
||||
uart_write((char*)&decimal_buff[ch+1]);
|
||||
}
|
||||
/*
|
||||
U8 U8toHEX(U8 val){
|
||||
val &= 0x0f;
|
||||
if(val < 10) val += '0';
|
||||
else val += 'a' - 10;
|
||||
return val;
|
||||
}
|
||||
|
||||
void printUintHEX(U8 *val, U8 len){
|
||||
U8 i, V;
|
||||
uart_write("0x");
|
||||
for(i = 0; i < len; i++){
|
||||
V = *val++;
|
||||
UART_send_byte(U8toHEX(V>>4)); // MSB
|
||||
UART_send_byte(U8toHEX(V)); // LSB
|
||||
}
|
||||
UART_send_byte('\n');
|
||||
}*/
|
||||
|
||||
U8 readInt(int *val){
|
||||
unsigned long T = Global_time;
|
||||
unsigned long R = 0;
|
||||
int readed;
|
||||
U8 sign = 0, rb, ret = 0, bad = 0;
|
||||
do{
|
||||
if(!UART_read_byte(&rb)) continue;
|
||||
if(rb == '-' && R == 0){ // negative number
|
||||
sign = 1;
|
||||
continue;
|
||||
}
|
||||
if(rb < '0' || rb > '9') break; // number ends with any non-digit symbol that will be omitted
|
||||
ret = 1; // there's at least one digit
|
||||
R = R * 10L + rb - '0';
|
||||
if(R > 0x7fff){ // bad value
|
||||
R = 0;
|
||||
bad = 0;
|
||||
}
|
||||
}while(Global_time - T < 10000); // wait no longer than 10s
|
||||
if(bad || !ret) return 0;
|
||||
readed = (int) R;
|
||||
if(sign) readed *= -1;
|
||||
*val = readed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void error_msg(char *msg){
|
||||
uart_write("\nERROR: ");
|
||||
uart_write(msg);
|
||||
UART_send_byte('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* read motor number
|
||||
* @param N - readed Number
|
||||
* @return 0 in case of error
|
||||
*/
|
||||
U8 get_motor_number(U8 *N){
|
||||
int Ival;
|
||||
if(readInt(&Ival) && Ival > -1 && Ival < 3){
|
||||
*N = (U8) Ival;
|
||||
UART_send_byte('*'); // OK
|
||||
return 1;
|
||||
}else{
|
||||
error_msg("bad motor");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void show_uid(){
|
||||
uart_write("\nMCU ID:\n");
|
||||
printUintHEX(U_ID00, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change variable stored in program memory
|
||||
* !!! You can change only const values (non-constants are initializes on program start)
|
||||
* @param addr - variable address
|
||||
* @param new value
|
||||
* @return 0 in case of error
|
||||
*/
|
||||
U8 change_progmem_value(U8 *addr, U8 val){
|
||||
// unlock memory
|
||||
FLASH_PUKR = EEPROM_KEY2;
|
||||
FLASH_PUKR = EEPROM_KEY1;
|
||||
// check bit PUL=1 in FLASH_IAPSR
|
||||
if(!FLASH_IAPSR & 0x02)
|
||||
return 0;
|
||||
*addr = val;
|
||||
// clear PUL to lock write
|
||||
FLASH_IAPSR &= ~0x02;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
U8 change_eeprom_value(U8 *addr, U8 val){
|
||||
// unlock memory
|
||||
FLASH_DUKR = EEPROM_KEY1;
|
||||
FLASH_DUKR = EEPROM_KEY2;
|
||||
// check bit DUL=1 in FLASH_IAPSR
|
||||
if(!FLASH_IAPSR & 0x08)
|
||||
return 0;
|
||||
*addr = val;
|
||||
// clear DUL to lock write
|
||||
FLASH_IAPSR &= ~0x08;
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int main() {
|
||||
unsigned long T = 0L;
|
||||
int Ival;
|
||||
U8 rb, Num;
|
||||
|
||||
CFG_GCR |= 1; // disable SWIM
|
||||
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
|
||||
// Timer 4 (8 bit) used as system tick timer
|
||||
// prescaler == 128 (2^7), Tfreq = 125kHz
|
||||
// period = 1ms, so ARR = 125
|
||||
TIM4_PSCR = 7;
|
||||
TIM4_ARR = 125;
|
||||
// interrupts: update
|
||||
TIM4_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM4_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
|
||||
// Configure pins
|
||||
// PC2 - PP output (on-board LED)
|
||||
PORT(LED_PORT, DDR) |= LED_PIN;
|
||||
PORT(LED_PORT, CR1) |= LED_PIN;
|
||||
// PD5 - UART2_TX -- pseudo open-drain output; don't forget an pullup resistor!
|
||||
PORT(UART_PORT, DDR) |= UART_TX_PIN;
|
||||
PORT(UART_PORT, ODR) |= UART_TX_PIN; // torn off N push-down
|
||||
//PORT(UART_PORT, CR1) |= UART_TX_PIN;
|
||||
|
||||
// Configure UART
|
||||
// 9 bit, no parity, 1 stop (UART_CR3 = 0 - reset value)
|
||||
// 57600 on 16MHz: BRR1=0x11, BRR2=0x06
|
||||
UART2_BRR1 = 0x11; UART2_BRR2 = 0x06;
|
||||
UART2_CR1 = UART_CR1_M; // M = 1 -- 9bits
|
||||
UART2_CR2 = UART_CR2_REN | UART_CR2_RIEN; // Allow RX, generate ints on rx
|
||||
|
||||
setup_stepper_pins();
|
||||
|
||||
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
// Loop
|
||||
do{
|
||||
if((Global_time - T > paused_val) || (T > Global_time)){
|
||||
T = Global_time;
|
||||
PORT(LED_PORT, ODR) ^= LED_PIN; // blink on-board LED
|
||||
}
|
||||
if(UART_read_byte(&rb)){ // buffer isn't empty
|
||||
switch(rb){
|
||||
case 'h': // help
|
||||
case 'H':
|
||||
uart_write("\nPROTO:\n"
|
||||
"+/-\tLED period\n"
|
||||
"Ex/ex\tset/get end-switches stored\n"
|
||||
"p\tget HW end-switches\n"
|
||||
"Mx\tstop on end-switch\n"
|
||||
"Sx/sx\tset/get Mspeed\n"
|
||||
"mx\tget steps\n"
|
||||
"Px\tpause/resume\n"
|
||||
"Xx\tstop\n"
|
||||
"0..2N\tmove xth motor for N steps\n"
|
||||
"=\tinfinity moving (after 0..2)"
|
||||
"U/u\tset/get U-stepping\n"
|
||||
"I\tget serial ID\n"
|
||||
"N\tchange HW number\n"
|
||||
"n\tshow HW number\n"
|
||||
);
|
||||
break;
|
||||
case 'I': // get serial id
|
||||
show_uid();
|
||||
break;
|
||||
case '+':
|
||||
paused_val += 100;
|
||||
if(paused_val > 10000)
|
||||
paused_val = 500; // but not more than 10s
|
||||
break;
|
||||
case '-':
|
||||
paused_val -= 100;
|
||||
if(paused_val < 100) // but not less than 0.1s
|
||||
paused_val = 500;
|
||||
break;
|
||||
case 'E': // set end-switches value
|
||||
if(get_motor_number(&Num)){
|
||||
if(readInt(&Ival) && (Ival == (Ival & 0x1f))){
|
||||
if(Num)
|
||||
EPs[Num] = Ival & 0x0f; // 4 bits in motors 1&2
|
||||
else
|
||||
EPs[0] = Ival; // all 5 bits in motor 0
|
||||
}else
|
||||
error_msg("bad EP");
|
||||
}
|
||||
break;
|
||||
case 'e': // get stored end-switches value
|
||||
if(get_motor_number(&Num)){
|
||||
printUint(&EPs[Num], 1);
|
||||
}
|
||||
break;
|
||||
case 'p': // get hardware end-switches value
|
||||
if(get_motor_number(&Num)){
|
||||
Num = get_ep_value(Num);
|
||||
printUint(&Num, 1);
|
||||
}
|
||||
break;
|
||||
case 'S': // set stepper speed
|
||||
if(get_motor_number(&Num)){
|
||||
if(readInt(&Ival) && Ival > MIN_STEP_LENGTH)
|
||||
set_stepper_speed(Num, Ival);
|
||||
else
|
||||
error_msg("bad speed");
|
||||
}
|
||||
break;
|
||||
case 's': // get stepper speed
|
||||
if(get_motor_number(&Num))
|
||||
printUint((U8*)&Stepper_speed[Num], 2);
|
||||
break;
|
||||
case 'M': // move till EP, you can call it before starting motor
|
||||
if(get_motor_number(&Num))
|
||||
Stop_on_EP[Num] = 1;
|
||||
break;
|
||||
case 'm': // how much steps there is to the end of moving
|
||||
if(get_motor_number(&Num))
|
||||
printUint((U8*)&Nsteps[Num], 2);
|
||||
break;
|
||||
case 'X': // stop
|
||||
if(get_motor_number(&Num))
|
||||
stop_motor(Num);
|
||||
break;
|
||||
case 'P': // pause/resume
|
||||
if(get_motor_number(&Num))
|
||||
pause_resume(Num);
|
||||
break;
|
||||
case 'N':
|
||||
if(readInt(&Ival) && Ival > 0 && Ival < 256)
|
||||
if(!change_progmem_value(&UART_devNUM, (unsigned int) Ival))
|
||||
error_msg("can't change val");
|
||||
break;
|
||||
case 'n': // show HW num
|
||||
printUint(&UART_devNUM, 1);
|
||||
break;
|
||||
case 'u': // show UStepping
|
||||
printUint(&USteps, 1);
|
||||
break;
|
||||
case 'U': // set UStepping
|
||||
if(readInt(&Ival) && Ival > 0 && Ival < 256)
|
||||
USteps = Ival;
|
||||
break;
|
||||
case '=': // infinity moving: just don't decrement steps
|
||||
StepperInfty = 1;
|
||||
break;
|
||||
default:
|
||||
if(rb >= '0' && rb <= '2'){ // run motor
|
||||
Num = rb - '0';
|
||||
if(readInt(&Ival) && Ival)
|
||||
move_motor(Num, Ival);
|
||||
else{
|
||||
error_msg("bad Nsteps");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}while(1);
|
||||
}
|
||||
|
||||
|
||||
44
stepper_independent_bin/main.h
Normal file
44
stepper_independent_bin/main.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* blinky.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
|
||||
#define UART_BUF_LEN 8 // max 7 bytes transmited in on operation
|
||||
#define MIN_STEP_LENGTH 9 // max speed, microseconds for one microstep
|
||||
#define THIS_DEVICE_NUM 1 // hardware number (0..255) can be changed by writting into EEPROM
|
||||
|
||||
extern U8 UART_rx[];
|
||||
extern U8 UART_rx_start_i;
|
||||
extern U8 UART_rx_cur_i;
|
||||
extern U8 UART_is_our; // ==1 if we get UART
|
||||
extern const U8 UART_devNUM;
|
||||
|
||||
void UART_send_byte(U8 byte);
|
||||
void uart_write(char *str);
|
||||
void printUint(U8 *val, U8 len);
|
||||
void error_msg(char *msg);
|
||||
|
||||
#define check_UART_pointer(x) if(x == UART_BUF_LEN) x = 0;
|
||||
|
||||
#endif // __MAIN_H__
|
||||
90
stepper_independent_bin/ports_definition.h
Normal file
90
stepper_independent_bin/ports_definition.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* ports_definition.h - definition of ports pins & so on
|
||||
*
|
||||
* Copyright 2014 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 __PORTS_DEFINITION_H__
|
||||
#define __PORTS_DEFINITION_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
// macro for using in port constructions like PORT(LED_PORT, ODR) = xx
|
||||
#define CONCAT(a,b) a##_##b
|
||||
#define PORT(a,b) CONCAT(a,b)
|
||||
|
||||
// on-board LED
|
||||
#define LED_PORT PC
|
||||
#define LED_PIN GPIO_PIN2
|
||||
|
||||
// UART2_TX
|
||||
#define UART_PORT PD
|
||||
#define UART_TX_PIN GPIO_PIN5
|
||||
|
||||
/***** Stepper motor *****/
|
||||
// Clocking
|
||||
#define STP0_CLK_PORT PC
|
||||
#define STP0_CLK_PIN GPIO_PIN1
|
||||
#define STP1_CLK_PORT PD
|
||||
#define STP1_CLK_PIN GPIO_PIN4
|
||||
#define STP2_CLK_PORT PD
|
||||
#define STP2_CLK_PIN GPIO_PIN2
|
||||
// Direction
|
||||
#define STP0_DIR_PORT PD
|
||||
#define STP0_DIR_PIN GPIO_PIN0
|
||||
#define STP1_DIR_PORT PD
|
||||
#define STP1_DIR_PIN GPIO_PIN7
|
||||
#define STP2_DIR_PORT PF
|
||||
#define STP2_DIR_PIN GPIO_PIN4
|
||||
// Enable
|
||||
#define STP0_EN_PORT PE
|
||||
#define STP0_EN_PIN GPIO_PIN5
|
||||
#define STP1_EN_PORT PD
|
||||
#define STP1_EN_PIN GPIO_PIN3
|
||||
#define STP2_EN_PORT PD
|
||||
#define STP2_EN_PIN GPIO_PIN1
|
||||
|
||||
/** sensors for each motor **/
|
||||
// SETUP (interrupts: only falling edge; inputs: all with weak pull-up)
|
||||
#define SETUP_EP(x) SET_EP ## x ## UP()
|
||||
|
||||
// motor 0: PC3..PC7, 5EPs
|
||||
#define SET_EP0UP() do{PORT(PC, CR2) |= 0xfc; PORT(PC, CR1) |= 0xfc; EXTI_CR1 |= 0x20;}while(0)
|
||||
// motor 1: PB0..PB3, 4EPs
|
||||
#define SET_EP1UP() do{PORT(PB, CR2) |= 0x0f; PORT(PB, CR1) |= 0x0f; EXTI_CR1 |= 0x08;}while(0)
|
||||
// motor 2: PB4, PB5, PA1, PA2, 4EPs
|
||||
#define SET_EP2UP() do{PORT(PB, CR2) |= 0x30; PORT(PA, CR2) |= 0x06; \
|
||||
PORT(PB, CR1) |= 0x30; PORT(PA, CR1) |= 0x06; EXTI_CR1 |= 0x0a; }while(0)
|
||||
|
||||
/*
|
||||
// motor 0: PC3..PC7, 5EPs
|
||||
#define SET_EP0UP() do{PORT(PC, CR1) |= 0xfc; }while(0)
|
||||
// motor 1: PB0..PB3, 4EPs
|
||||
#define SET_EP1UP() do{PORT(PB, CR1) |= 0x0f; }while(0)
|
||||
// motor 2: PB4, PB5, PA1, PA2, 4EPs
|
||||
#define SET_EP2UP() do{PORT(PB, CR1) |= 0x30; PORT(PA, CR1) |= 0x06; }while(0)
|
||||
*/
|
||||
// GET VALUE
|
||||
#define READ_EP(x) GET_EP ## x ## _()
|
||||
#define GET_EP0_() (( PORT(PC, IDR) >> 3 ))
|
||||
#define GET_EP1_() (( PORT(PB, IDR) & 0x0f ))
|
||||
#define GET_EP2_() (( ((PORT(PB,IDR) >> 4) & 0x03) | ((PORT(PA,IDR) << 1) & 0x0c) ))
|
||||
|
||||
|
||||
#endif // __PORTS_DEFINITION_H__
|
||||
961
stepper_independent_bin/schematic/kicad.kicad_pcb
Normal file
961
stepper_independent_bin/schematic/kicad.kicad_pcb
Normal file
@ -0,0 +1,961 @@
|
||||
(kicad_pcb (version 3) (host pcbnew "(2013-feb-26)-stable")
|
||||
|
||||
(general
|
||||
(links 70)
|
||||
(no_connects 70)
|
||||
(area 0 0 0 0)
|
||||
(thickness 1.6)
|
||||
(drawings 0)
|
||||
(tracks 0)
|
||||
(zones 0)
|
||||
(modules 15)
|
||||
(nets 32)
|
||||
)
|
||||
|
||||
(page A3)
|
||||
(layers
|
||||
(15 F.Cu signal)
|
||||
(0 B.Cu signal)
|
||||
(16 B.Adhes user)
|
||||
(17 F.Adhes user)
|
||||
(18 B.Paste user)
|
||||
(19 F.Paste user)
|
||||
(20 B.SilkS user)
|
||||
(21 F.SilkS user)
|
||||
(22 B.Mask user)
|
||||
(23 F.Mask user)
|
||||
(24 Dwgs.User user)
|
||||
(25 Cmts.User user)
|
||||
(26 Eco1.User user)
|
||||
(27 Eco2.User user)
|
||||
(28 Edge.Cuts user)
|
||||
)
|
||||
|
||||
(setup
|
||||
(last_trace_width 0.254)
|
||||
(trace_clearance 0.254)
|
||||
(zone_clearance 0.508)
|
||||
(zone_45_only no)
|
||||
(trace_min 0.254)
|
||||
(segment_width 0.2)
|
||||
(edge_width 0.15)
|
||||
(via_size 0.889)
|
||||
(via_drill 0.635)
|
||||
(via_min_size 0.889)
|
||||
(via_min_drill 0.508)
|
||||
(uvia_size 0.508)
|
||||
(uvia_drill 0.127)
|
||||
(uvias_allowed no)
|
||||
(uvia_min_size 0.508)
|
||||
(uvia_min_drill 0.127)
|
||||
(pcb_text_width 0.3)
|
||||
(pcb_text_size 1 1)
|
||||
(mod_edge_width 0.15)
|
||||
(mod_text_size 1 1)
|
||||
(mod_text_width 0.15)
|
||||
(pad_size 1 1)
|
||||
(pad_drill 0.6)
|
||||
(pad_to_mask_clearance 0)
|
||||
(aux_axis_origin 0 0)
|
||||
(visible_elements FFFFFFBF)
|
||||
(pcbplotparams
|
||||
(layerselection 3178497)
|
||||
(usegerberextensions true)
|
||||
(excludeedgelayer true)
|
||||
(linewidth 152400)
|
||||
(plotframeref false)
|
||||
(viasonmask false)
|
||||
(mode 1)
|
||||
(useauxorigin false)
|
||||
(hpglpennumber 1)
|
||||
(hpglpenspeed 20)
|
||||
(hpglpendiameter 15)
|
||||
(hpglpenoverlay 2)
|
||||
(psnegative false)
|
||||
(psa4output false)
|
||||
(plotreference true)
|
||||
(plotvalue true)
|
||||
(plotothertext true)
|
||||
(plotinvisibletext false)
|
||||
(padsonsilk false)
|
||||
(subtractmaskfromsilk false)
|
||||
(outputformat 1)
|
||||
(mirror false)
|
||||
(drillshape 1)
|
||||
(scaleselection 1)
|
||||
(outputdirectory ""))
|
||||
)
|
||||
|
||||
(net 0 "")
|
||||
(net 1 +3.3V)
|
||||
(net 2 "/A DIR")
|
||||
(net 3 /NRST)
|
||||
(net 4 /OSC1IN)
|
||||
(net 5 /OSC2IN)
|
||||
(net 6 /PB0)
|
||||
(net 7 /PB1)
|
||||
(net 8 /PB2)
|
||||
(net 9 /PB4)
|
||||
(net 10 /PB5)
|
||||
(net 11 /PC1)
|
||||
(net 12 /PC2)
|
||||
(net 13 /PC3)
|
||||
(net 14 /PC4)
|
||||
(net 15 /PC5)
|
||||
(net 16 /PC6)
|
||||
(net 17 /PC7)
|
||||
(net 18 /PD0)
|
||||
(net 19 /PD2)
|
||||
(net 20 /PD3)
|
||||
(net 21 /PD4)
|
||||
(net 22 /PD5)
|
||||
(net 23 /PD6)
|
||||
(net 24 /PD7)
|
||||
(net 25 /PE5)
|
||||
(net 26 /PF4)
|
||||
(net 27 /SWIM/PD1)
|
||||
(net 28 GND)
|
||||
(net 29 N-0000021)
|
||||
(net 30 N-0000026)
|
||||
(net 31 N-0000042)
|
||||
|
||||
(net_class Default "This is the default net class."
|
||||
(clearance 0.254)
|
||||
(trace_width 0.254)
|
||||
(via_dia 0.889)
|
||||
(via_drill 0.635)
|
||||
(uvia_dia 0.508)
|
||||
(uvia_drill 0.127)
|
||||
(add_net "")
|
||||
(add_net +3.3V)
|
||||
(add_net "/A DIR")
|
||||
(add_net /NRST)
|
||||
(add_net /OSC1IN)
|
||||
(add_net /OSC2IN)
|
||||
(add_net /PB0)
|
||||
(add_net /PB1)
|
||||
(add_net /PB2)
|
||||
(add_net /PB4)
|
||||
(add_net /PB5)
|
||||
(add_net /PC1)
|
||||
(add_net /PC2)
|
||||
(add_net /PC3)
|
||||
(add_net /PC4)
|
||||
(add_net /PC5)
|
||||
(add_net /PC6)
|
||||
(add_net /PC7)
|
||||
(add_net /PD0)
|
||||
(add_net /PD2)
|
||||
(add_net /PD3)
|
||||
(add_net /PD4)
|
||||
(add_net /PD5)
|
||||
(add_net /PD6)
|
||||
(add_net /PD7)
|
||||
(add_net /PE5)
|
||||
(add_net /PF4)
|
||||
(add_net /SWIM/PD1)
|
||||
(add_net GND)
|
||||
(add_net N-0000021)
|
||||
(add_net N-0000026)
|
||||
(add_net N-0000042)
|
||||
)
|
||||
|
||||
(module TQFP32 (layer F.Cu) (tedit 43A670DA) (tstamp 52FB46F3)
|
||||
(at 239.268 53.34)
|
||||
(path /52FB03A2)
|
||||
(fp_text reference U1 (at 0 -1.27) (layer F.SilkS)
|
||||
(effects (font (size 1.27 1.016) (thickness 0.2032)))
|
||||
)
|
||||
(fp_text value STM8S105K4T6C (at 0 1.905) (layer F.SilkS)
|
||||
(effects (font (size 1.27 1.016) (thickness 0.2032)))
|
||||
)
|
||||
(fp_line (start 5.0292 2.7686) (end 3.8862 2.7686) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 5.0292 -2.7686) (end 3.9116 -2.7686) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 5.0292 2.7686) (end 5.0292 -2.7686) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.794 3.9624) (end 2.794 5.0546) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.8194 3.9878) (end -2.8194 5.0546) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.8448 5.0546) (end 2.794 5.08) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.794 -5.0292) (end 2.7178 -5.0546) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.8862 -3.2766) (end -3.8862 3.9116) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.7432 -5.0292) (end 2.7432 -3.9878) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.2512 -3.8862) (end 3.81 -3.8862) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 3.8608 3.937) (end 3.8608 -3.7846) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.8862 3.937) (end 3.7338 3.937) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -5.0292 -2.8448) (end -5.0292 2.794) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -5.0292 2.794) (end -3.8862 2.794) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -3.87604 -3.302) (end -3.29184 -3.8862) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -5.02412 -2.8448) (end -3.87604 -2.8448) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.794 -3.8862) (end -2.794 -5.03428) (layer F.SilkS) (width 0.1524))
|
||||
(fp_circle (center -2.83972 -2.86004) (end -2.43332 -2.60604) (layer F.SilkS) (width 0.1524))
|
||||
(pad 8 smd rect (at -4.81584 2.77622) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 26 /PF4)
|
||||
)
|
||||
(pad 7 smd rect (at -4.81584 1.97612) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 6 smd rect (at -4.81584 1.17602) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 5 smd rect (at -4.81584 0.37592) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 30 N-0000026)
|
||||
)
|
||||
(pad 4 smd rect (at -4.81584 -0.42418) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 3 smd rect (at -4.81584 -1.22428) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 5 /OSC2IN)
|
||||
)
|
||||
(pad 2 smd rect (at -4.81584 -2.02438) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 4 /OSC1IN)
|
||||
)
|
||||
(pad 1 smd rect (at -4.81584 -2.82448) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 24 smd rect (at 4.7498 -2.8194) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 17 /PC7)
|
||||
)
|
||||
(pad 17 smd rect (at 4.7498 2.794) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 25 /PE5)
|
||||
)
|
||||
(pad 18 smd rect (at 4.7498 1.9812) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 11 /PC1)
|
||||
)
|
||||
(pad 19 smd rect (at 4.7498 1.1684) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 12 /PC2)
|
||||
)
|
||||
(pad 20 smd rect (at 4.7498 0.381) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 13 /PC3)
|
||||
)
|
||||
(pad 21 smd rect (at 4.7498 -0.4318) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 14 /PC4)
|
||||
)
|
||||
(pad 22 smd rect (at 4.7498 -1.2192) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 15 /PC5)
|
||||
)
|
||||
(pad 23 smd rect (at 4.7498 -2.032) (size 1.99898 0.44958)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 16 /PC6)
|
||||
)
|
||||
(pad 32 smd rect (at -2.82448 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 24 /PD7)
|
||||
)
|
||||
(pad 31 smd rect (at -2.02692 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 23 /PD6)
|
||||
)
|
||||
(pad 30 smd rect (at -1.22428 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 22 /PD5)
|
||||
)
|
||||
(pad 29 smd rect (at -0.42672 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 21 /PD4)
|
||||
)
|
||||
(pad 28 smd rect (at 0.37592 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 20 /PD3)
|
||||
)
|
||||
(pad 27 smd rect (at 1.17348 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 19 /PD2)
|
||||
)
|
||||
(pad 26 smd rect (at 1.97612 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 27 /SWIM/PD1)
|
||||
)
|
||||
(pad 25 smd rect (at 2.77368 -4.826) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 18 /PD0)
|
||||
)
|
||||
(pad 9 smd rect (at -2.8194 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 10 smd rect (at -2.032 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 11 smd rect (at -1.2192 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 10 /PB5)
|
||||
)
|
||||
(pad 12 smd rect (at -0.4318 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 9 /PB4)
|
||||
)
|
||||
(pad 13 smd rect (at 0.3556 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 2 "/A DIR")
|
||||
)
|
||||
(pad 14 smd rect (at 1.1684 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 8 /PB2)
|
||||
)
|
||||
(pad 15 smd rect (at 1.9812 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 7 /PB1)
|
||||
)
|
||||
(pad 16 smd rect (at 2.794 4.7752) (size 0.44958 1.99898)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 6 /PB0)
|
||||
)
|
||||
(model smd/tqfp32.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM2010 (layer F.Cu) (tedit 4EFC4DD5) (tstamp 52FB4700)
|
||||
(at 207.518 73.66)
|
||||
(tags "CMS SM")
|
||||
(path /52FB0F3B)
|
||||
(attr smd)
|
||||
(fp_text reference SW1 (at -0.50038 0 90) (layer F.SilkS)
|
||||
(effects (font (size 0.70104 0.70104) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value SW_PUSH (at 0.8001 0 90) (layer F.SilkS)
|
||||
(effects (font (size 0.70104 0.70104) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start 3.50012 -1.6002) (end 3.50012 1.6002) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start -3.50012 -1.6002) (end -3.50012 1.6002) (layer F.SilkS) (width 0.11938))
|
||||
(fp_text user + (at -4.30022 1.80086) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.29972)))
|
||||
)
|
||||
(fp_line (start 1.19634 1.60528) (end 3.48234 1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start 3.48234 -1.60528) (end 1.19634 -1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start -1.19888 -1.60528) (end -3.48488 -1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(fp_line (start -3.48488 1.60528) (end -1.19888 1.60528) (layer F.SilkS) (width 0.11938))
|
||||
(pad 1 smd rect (at -2.4003 0) (size 1.80086 2.70002)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 2 smd rect (at 2.4003 0) (size 1.80086 2.70002)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(model smd\chip_smd_pol_wide.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.35 0.35 0.35))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB470C)
|
||||
(at 214.884 73.406)
|
||||
(path /52FB0413)
|
||||
(attr smd)
|
||||
(fp_text reference C1 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 1u (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 30 N-0000026)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4718)
|
||||
(at 220.98 73.406)
|
||||
(path /52FB0426)
|
||||
(attr smd)
|
||||
(fp_text reference C2 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 104 (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4724)
|
||||
(at 227.076 73.406)
|
||||
(path /52FB0DD3)
|
||||
(attr smd)
|
||||
(fp_text reference D1 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value LED (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 31 N-0000042)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4730)
|
||||
(at 233.172 73.406)
|
||||
(path /52FB0DE2)
|
||||
(attr smd)
|
||||
(fp_text reference R1 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 1k (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 31 N-0000042)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 12 /PC2)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB473C)
|
||||
(at 182.626 76.962)
|
||||
(path /52FB0ECD)
|
||||
(attr smd)
|
||||
(fp_text reference D2 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value LED (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 29 N-0000021)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4748)
|
||||
(at 188.722 76.962)
|
||||
(path /52FB0ED3)
|
||||
(attr smd)
|
||||
(fp_text reference R2 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 1k (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 29 N-0000021)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4754)
|
||||
(at 194.818 76.962)
|
||||
(path /52FB0EFD)
|
||||
(attr smd)
|
||||
(fp_text reference R3 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 10k (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SM1206 (layer F.Cu) (tedit 42806E24) (tstamp 52FB4760)
|
||||
(at 200.914 76.962)
|
||||
(path /52FB0F99)
|
||||
(attr smd)
|
||||
(fp_text reference C3 (at 0 0) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_text value 104 (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.127)))
|
||||
)
|
||||
(fp_line (start -2.54 -1.143) (end -2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -2.54 1.143) (end -0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 0.889 -1.143) (end 2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 -1.143) (end 2.54 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 2.54 1.143) (end 0.889 1.143) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -0.889 -1.143) (end -2.54 -1.143) (layer F.SilkS) (width 0.127))
|
||||
(pad 1 smd rect (at -1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 2 smd rect (at 1.651 0) (size 1.524 2.032)
|
||||
(layers F.Cu F.Paste F.Mask)
|
||||
(net 28 GND)
|
||||
)
|
||||
(model smd/chip_cms.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.17 0.16 0.16))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-5 (layer F.Cu) (tedit 200000) (tstamp 52FB476E)
|
||||
(at 187.452 73.66)
|
||||
(descr "Connecteur 5 pins")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB4AA7)
|
||||
(fp_text reference P4 (at -0.635 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_5 (at 0 -2.54) (layer F.SilkS) hide
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -7.62 1.27) (end -7.62 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 -1.27) (end 5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 -1.27) (end 5.08 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 1.27) (end -7.62 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 23 /PD6)
|
||||
)
|
||||
(pad 4 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 22 /PD5)
|
||||
)
|
||||
(pad 5 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-4 (layer F.Cu) (tedit 200000) (tstamp 52FB477D)
|
||||
(at 198.12 73.66)
|
||||
(descr "Connecteur 4 pibs")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB0A49)
|
||||
(fp_text reference P2 (at 0 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.73482 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_4 (at 0 -2.54) (layer F.SilkS) hide
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -5.08 -1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 -1.27) (end -5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 -1.27) (end 5.08 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 -1.27) (end 5.08 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 5.08 1.27) (end -5.08 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 27 /SWIM/PD1)
|
||||
)
|
||||
(pad 3 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 4 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-14 (layer F.Cu) (tedit 200000) (tstamp 52FB4793)
|
||||
(at 197.612 70.358)
|
||||
(descr "Connecteur 14 pins")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB0A6A)
|
||||
(fp_text reference P1 (at -10.16 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_14 (at 7.62 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -17.78 -1.27) (end 17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 -1.27) (end 17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 1.27) (end -17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -17.78 1.27) (end -17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 +3.3V)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 3 /NRST)
|
||||
)
|
||||
(pad 4 thru_hole circle (at -8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 4 /OSC1IN)
|
||||
)
|
||||
(pad 5 thru_hole circle (at -6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 5 /OSC2IN)
|
||||
)
|
||||
(pad 6 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 26 /PF4)
|
||||
)
|
||||
(pad 7 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 10 /PB5)
|
||||
)
|
||||
(pad 8 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 9 /PB4)
|
||||
)
|
||||
(pad 9 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 2 "/A DIR")
|
||||
)
|
||||
(pad 10 thru_hole circle (at 6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 8 /PB2)
|
||||
)
|
||||
(pad 11 thru_hole circle (at 8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 7 /PB1)
|
||||
)
|
||||
(pad 12 thru_hole circle (at 11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 6 /PB0)
|
||||
)
|
||||
(pad 13 thru_hole circle (at 13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 25 /PE5)
|
||||
)
|
||||
(pad 14 thru_hole circle (at 16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 11 /PC1)
|
||||
)
|
||||
)
|
||||
|
||||
(module SIL-14 (layer F.Cu) (tedit 200000) (tstamp 52FB47A9)
|
||||
(at 233.68 70.358)
|
||||
(descr "Connecteur 14 pins")
|
||||
(tags "CONN DEV")
|
||||
(path /52FB0A79)
|
||||
(fp_text reference P3 (at -10.16 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value CONN_14 (at 7.62 -2.54) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.016) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -17.78 -1.27) (end 17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 -1.27) (end 17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 17.78 1.27) (end -17.78 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -17.78 1.27) (end -17.78 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 24 /PD7)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 23 /PD6)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 22 /PD5)
|
||||
)
|
||||
(pad 4 thru_hole circle (at -8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 21 /PD4)
|
||||
)
|
||||
(pad 5 thru_hole circle (at -6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 20 /PD3)
|
||||
)
|
||||
(pad 6 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 19 /PD2)
|
||||
)
|
||||
(pad 7 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 27 /SWIM/PD1)
|
||||
)
|
||||
(pad 8 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 18 /PD0)
|
||||
)
|
||||
(pad 9 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 17 /PC7)
|
||||
)
|
||||
(pad 10 thru_hole circle (at 6.35 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 16 /PC6)
|
||||
)
|
||||
(pad 11 thru_hole circle (at 8.89 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 15 /PC5)
|
||||
)
|
||||
(pad 12 thru_hole circle (at 11.43 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 14 /PC4)
|
||||
)
|
||||
(pad 13 thru_hole circle (at 13.97 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 13 /PC3)
|
||||
)
|
||||
(pad 14 thru_hole circle (at 16.51 0) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 12 /PC2)
|
||||
)
|
||||
)
|
||||
|
||||
(module DB25FC (layer F.Cu) (tedit 200000) (tstamp 52FB47DC)
|
||||
(at 206.502 66.04)
|
||||
(descr "Connecteur DB25 femelle couche")
|
||||
(tags "CONN DB25")
|
||||
(path /52FB403E)
|
||||
(fp_text reference J1 (at 0 -15.24) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value DB25 (at 0 -6.35) (layer F.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start 26.67 -11.43) (end 26.67 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 19.05 -6.35) (end 19.05 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 20.955 -11.43) (end 20.955 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.955 -11.43) (end -20.955 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -19.05 -6.35) (end -19.05 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 2.54) (end -26.67 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 26.67 -6.35) (end 19.05 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 -6.35) (end -19.05 -6.35) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 20.32 -8.255) (end 20.32 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -8.255) (end -20.32 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 20.32 -18.415) (end 20.32 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -18.415) (end -20.32 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 26.67 -11.43) (end 26.67 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 26.67 -12.7) (end -26.67 -12.7) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 -12.7) (end -26.67 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 -11.43) (end 26.67 -11.43) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 19.05 2.54) (end 26.67 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -8.255) (end 20.32 -8.255) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -20.32 -18.415) (end 20.32 -18.415) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -26.67 2.54) (end -19.05 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(pad "" thru_hole circle (at 23.495 -1.27) (size 3.81 3.81) (drill 3.048)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad "" thru_hole circle (at -23.495 -1.27) (size 3.81 3.81) (drill 3.048)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 1 thru_hole rect (at -16.51 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 2 thru_hole circle (at -13.716 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 11 /PC1)
|
||||
)
|
||||
(pad 3 thru_hole circle (at -11.049 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 6 /PB0)
|
||||
)
|
||||
(pad 4 thru_hole circle (at -8.255 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 21 /PD4)
|
||||
)
|
||||
(pad 5 thru_hole circle (at -5.461 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 7 /PB1)
|
||||
)
|
||||
(pad 6 thru_hole circle (at -2.667 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 19 /PD2)
|
||||
)
|
||||
(pad 7 thru_hole circle (at 0 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 8 /PB2)
|
||||
)
|
||||
(pad 8 thru_hole circle (at 2.794 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 9 thru_hole circle (at 5.588 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 2 "/A DIR")
|
||||
)
|
||||
(pad 10 thru_hole circle (at 8.382 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 11 thru_hole circle (at 11.049 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 12 thru_hole circle (at 13.843 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 13 thru_hole circle (at 16.637 1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 14 thru_hole circle (at -14.9352 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 15 thru_hole circle (at -12.3952 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 16 thru_hole circle (at -9.6012 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 17 thru_hole circle (at -6.858 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
)
|
||||
(pad 18 thru_hole circle (at -4.1148 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 19 thru_hole circle (at -1.3208 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 20 thru_hole circle (at 1.4224 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 21 thru_hole circle (at 4.1656 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 22 thru_hole circle (at 7.0104 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 23 thru_hole circle (at 9.7028 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 24 thru_hole circle (at 12.446 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(pad 25 thru_hole circle (at 15.24 -1.27) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask F.SilkS)
|
||||
(net 28 GND)
|
||||
)
|
||||
(model conn_DBxx/db25_female_pin90deg.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
82
stepper_independent_bin/schematic/kicad.pro
Normal file
82
stepper_independent_bin/schematic/kicad.pro
Normal file
@ -0,0 +1,82 @@
|
||||
update=Вт 11 фев 2014 17:26:13
|
||||
version=1
|
||||
last_client=eeschema
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[cvpcb/libraries]
|
||||
EquName1=devcms
|
||||
[pcbnew]
|
||||
version=1
|
||||
LastNetListRead=
|
||||
PadDrlX=320
|
||||
PadDimH=550
|
||||
PadDimV=550
|
||||
BoardThickness=620
|
||||
TxtPcbV=600
|
||||
TxtPcbH=600
|
||||
TxtModV=500
|
||||
TxtModH=500
|
||||
TxtModW=100
|
||||
VEgarde=100
|
||||
DrawLar=120
|
||||
EdgeLar=80
|
||||
TxtLar=120
|
||||
MSegLar=120
|
||||
[pcbnew/libraries]
|
||||
LibDir=
|
||||
LibName1=sockets
|
||||
LibName2=connect
|
||||
LibName3=discret
|
||||
LibName4=pin_array
|
||||
LibName5=divers
|
||||
LibName6=libcms
|
||||
LibName7=display
|
||||
LibName8=led
|
||||
LibName9=dip_sockets
|
||||
LibName10=pga_sockets
|
||||
LibName11=valves
|
||||
[general]
|
||||
version=1
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
NetFmtName=
|
||||
RptD_X=0
|
||||
RptD_Y=100
|
||||
RptLab=1
|
||||
LabSize=60
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=special
|
||||
LibName13=microcontrollers
|
||||
LibName14=dsp
|
||||
LibName15=microchip
|
||||
LibName16=analog_switches
|
||||
LibName17=motorola
|
||||
LibName18=texas
|
||||
LibName19=intel
|
||||
LibName20=audio
|
||||
LibName21=interface
|
||||
LibName22=digital-audio
|
||||
LibName23=philips
|
||||
LibName24=display
|
||||
LibName25=cypress
|
||||
LibName26=siliconi
|
||||
LibName27=opto
|
||||
LibName28=atmel
|
||||
LibName29=contrib
|
||||
LibName30=valves
|
||||
LibName31=stm8
|
||||
LibName32=st-microelectronics
|
||||
LibName33=stm8s105k4t6c
|
||||
8
stepper_independent_bin/schematic/stepper-cache.dcm
Normal file
8
stepper_independent_bin/schematic/stepper-cache.dcm
Normal file
@ -0,0 +1,8 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Ср 26 фев 2014 17:45:20
|
||||
#
|
||||
$CMP CONN_5_
|
||||
D Symbole general de connecteur
|
||||
K CONN
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
253
stepper_independent_bin/schematic/stepper-cache.lib
Normal file
253
stepper_independent_bin/schematic/stepper-cache.lib
Normal file
@ -0,0 +1,253 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Пн 03 мар 2014 17:27:22
|
||||
#encoding utf-8
|
||||
#
|
||||
# +3.3V
|
||||
#
|
||||
DEF +3.3V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -40 30 H I C CNN
|
||||
F1 "+3.3V" 0 110 30 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS +3,3V
|
||||
DRAW
|
||||
X +3.3V 1 0 0 0 U 30 30 0 0 W N
|
||||
C 0 60 20 0 1 0 N
|
||||
P 3 0 1 0 0 0 0 40 0 40 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# C
|
||||
#
|
||||
DEF C C 0 10 N Y 1 F N
|
||||
F0 "C" 0 100 40 H V L CNN
|
||||
F1 "C" 6 -85 40 H V L CNN
|
||||
F2 "~" 38 -150 30 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
SM*
|
||||
C?
|
||||
C1-1
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 20 -80 -30 80 -30 N
|
||||
P 2 0 1 20 -80 30 80 30 N
|
||||
X ~ 1 0 200 170 D 40 40 1 1 P
|
||||
X ~ 2 0 -200 170 U 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_14
|
||||
#
|
||||
DEF CONN_14 P 0 40 Y N 1 F N
|
||||
F0 "P" -30 0 60 V V C CNN
|
||||
F1 "CONN_14" 80 0 60 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 700 150 -700 0 1 0 N
|
||||
X P1 1 -350 650 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 550 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 450 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 350 250 R 50 50 1 1 P I
|
||||
X P5 5 -350 250 250 R 50 50 1 1 P I
|
||||
X P6 6 -350 150 250 R 50 50 1 1 P I
|
||||
X P7 7 -350 50 250 R 50 50 1 1 P I
|
||||
X P8 8 -350 -50 250 R 50 50 1 1 P I
|
||||
X P9 9 -350 -150 250 R 50 50 1 1 P I
|
||||
X P10 10 -350 -250 250 R 50 50 1 1 P I
|
||||
X P11 11 -350 -350 250 R 50 50 1 1 P I
|
||||
X P12 12 -350 -450 250 R 50 50 1 1 P I
|
||||
X P13 13 -350 -550 250 R 50 50 1 1 P I
|
||||
X P14 14 -350 -650 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_3
|
||||
#
|
||||
DEF CONN_3 K 0 40 Y N 1 F N
|
||||
F0 "K" -50 0 50 V V C CNN
|
||||
F1 "CONN_3" 50 0 40 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 150 100 -150 0 1 0 N
|
||||
X P1 1 -350 100 250 R 60 60 1 1 P I
|
||||
X PM 2 -350 0 250 R 60 60 1 1 P I
|
||||
X P3 3 -350 -100 250 R 60 60 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_4
|
||||
#
|
||||
DEF CONN_4 P 0 40 Y N 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_4" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 200 100 -200 0 1 0 N
|
||||
X P1 1 -350 150 250 R 50 50 1 1 P I
|
||||
X P2 2 -350 50 250 R 50 50 1 1 P I
|
||||
X P3 3 -350 -50 250 R 50 50 1 1 P I
|
||||
X P4 4 -350 -150 250 R 50 50 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_5
|
||||
#
|
||||
DEF CONN_5 P 0 40 Y Y 1 F N
|
||||
F0 "P" -50 0 50 V V C CNN
|
||||
F1 "CONN_5" 50 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 250 100 -250 0 1 0 f
|
||||
X ~ 1 -400 200 300 R 60 60 1 1 P I
|
||||
X ~ 2 -400 100 300 R 60 60 1 1 P I
|
||||
X ~ 3 -400 0 300 R 60 60 1 1 P I
|
||||
X ~ 4 -400 -100 300 R 60 60 1 1 P I
|
||||
X ~ 5 -400 -200 300 R 60 60 1 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# CONN_5_
|
||||
#
|
||||
DEF CONN_5_ P 0 40 Y Y 1 F N
|
||||
F0 "P" 50 -300 50 H V C CNN
|
||||
F1 "CONN_5_" 150 0 50 V V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -100 250 200 -250 0 1 0 f
|
||||
X ~ 1 -400 200 300 R 60 60 1 1 w I
|
||||
X ~ 2 -400 100 300 R 60 60 1 1 w I
|
||||
X ~ 3 -400 0 300 R 60 60 1 1 O I
|
||||
X ~ 4 -400 -100 300 R 60 60 1 1 I I
|
||||
X ~ 5 -400 -200 300 R 60 60 1 1 w I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# GND
|
||||
#
|
||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 0 30 H I C CNN
|
||||
F1 "GND" 0 -70 30 H I C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# LED
|
||||
#
|
||||
DEF LED D 0 40 Y N 1 F N
|
||||
F0 "D" 0 100 50 H V C CNN
|
||||
F1 "LED" 0 -100 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LED-3MM
|
||||
LED-5MM
|
||||
LED-10MM
|
||||
LED-0603
|
||||
LED-0805
|
||||
LED-1206
|
||||
LEDV
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
P 2 0 1 0 50 50 50 -50 N
|
||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||
P 3 0 1 0 65 -40 110 -80 105 -55 N
|
||||
P 3 0 1 0 80 -25 125 -65 120 -40 N
|
||||
X A 1 -200 0 150 R 40 40 1 1 P
|
||||
X K 2 200 0 150 L 40 40 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# R
|
||||
#
|
||||
DEF R R 0 0 N Y 1 F N
|
||||
F0 "R" 80 0 40 V V C CNN
|
||||
F1 "R" 7 1 40 V V C CNN
|
||||
F2 "~" -70 0 30 V V C CNN
|
||||
F3 "~" 0 0 30 H V C CNN
|
||||
$FPLIST
|
||||
R?
|
||||
SM0603
|
||||
SM0805
|
||||
R?-*
|
||||
SM1206
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -40 150 40 -150 0 1 12 N
|
||||
X ~ 1 0 250 100 D 60 60 1 1 P
|
||||
X ~ 2 0 -250 100 U 60 60 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SW_PUSH
|
||||
#
|
||||
DEF SW_PUSH SW 0 40 N N 1 F N
|
||||
F0 "SW" 150 110 50 H V C CNN
|
||||
F1 "SW_PUSH" 0 -80 50 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
DRAW
|
||||
S -170 50 170 60 0 1 0 N
|
||||
P 4 0 1 0 -40 60 -30 90 30 90 40 60 N
|
||||
X 1 1 -300 0 200 R 60 60 0 1 P I
|
||||
X 2 2 300 0 200 L 60 60 0 1 P I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
108
stepper_independent_bin/schematic/stepper.cmp
Normal file
108
stepper_independent_bin/schematic/stepper.cmp
Normal file
@ -0,0 +1,108 @@
|
||||
Cmp-Mod V01 Created by CvPcb (2013-feb-26)-stable date = Ср 12 фев 2014 14:01:35
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0413;
|
||||
Reference = C1;
|
||||
ValeurCmp = 1u;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0426;
|
||||
Reference = C2;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F99;
|
||||
Reference = C3;
|
||||
ValeurCmp = 104;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DD3;
|
||||
Reference = D1;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ECD;
|
||||
Reference = D2;
|
||||
ValeurCmp = LED;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB403E;
|
||||
Reference = J1;
|
||||
ValeurCmp = DB25;
|
||||
IdModule = DB25FC;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A6A;
|
||||
Reference = P1;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A49;
|
||||
Reference = P2;
|
||||
ValeurCmp = CONN_4;
|
||||
IdModule = SIL-4;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0A79;
|
||||
Reference = P3;
|
||||
ValeurCmp = CONN_14;
|
||||
IdModule = SIL-14;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB4AA7;
|
||||
Reference = P4;
|
||||
ValeurCmp = CONN_5;
|
||||
IdModule = SIL-5;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0DE2;
|
||||
Reference = R1;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0ED3;
|
||||
Reference = R2;
|
||||
ValeurCmp = 1k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0EFD;
|
||||
Reference = R3;
|
||||
ValeurCmp = 10k;
|
||||
IdModule = SM1206;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB0F3B;
|
||||
Reference = SW1;
|
||||
ValeurCmp = SW_PUSH;
|
||||
IdModule = SM2010;
|
||||
EndCmp
|
||||
|
||||
BeginCmp
|
||||
TimeStamp = /52FB03A2;
|
||||
Reference = U1;
|
||||
ValeurCmp = STM8S105K4T6C;
|
||||
IdModule = TQFP32;
|
||||
EndCmp
|
||||
|
||||
EndListe
|
||||
415
stepper_independent_bin/schematic/stepper.net
Normal file
415
stepper_independent_bin/schematic/stepper.net
Normal file
@ -0,0 +1,415 @@
|
||||
(export (version D)
|
||||
(design
|
||||
(source /home/eddy/Docs/SAO/ELECTRONICS/STM8/stepper_independent/schematic/stepper.sch)
|
||||
(date "Ср 12 фев 2014 14:00:57")
|
||||
(tool "eeschema (2013-feb-26)-stable"))
|
||||
(components
|
||||
(comp (ref U1)
|
||||
(value STM8S105K4T6C)
|
||||
(libsource (lib stm8s105k4t6c) (part STM8S105K4T6C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB03A2))
|
||||
(comp (ref C1)
|
||||
(value 1u)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0413))
|
||||
(comp (ref C2)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0426))
|
||||
(comp (ref P2)
|
||||
(value CONN_4)
|
||||
(libsource (lib conn) (part CONN_4))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A49))
|
||||
(comp (ref P1)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A6A))
|
||||
(comp (ref P3)
|
||||
(value CONN_14)
|
||||
(libsource (lib conn) (part CONN_14))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0A79))
|
||||
(comp (ref D1)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DD3))
|
||||
(comp (ref R1)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0DE2))
|
||||
(comp (ref D2)
|
||||
(value LED)
|
||||
(libsource (lib device) (part LED))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ECD))
|
||||
(comp (ref R2)
|
||||
(value 1k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0ED3))
|
||||
(comp (ref R3)
|
||||
(value 10k)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0EFD))
|
||||
(comp (ref SW1)
|
||||
(value SW_PUSH)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F3B))
|
||||
(comp (ref C3)
|
||||
(value 104)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB0F99))
|
||||
(comp (ref J1)
|
||||
(value DB25)
|
||||
(libsource (lib conn) (part DB25))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB403E))
|
||||
(comp (ref P4)
|
||||
(value CONN_5)
|
||||
(libsource (lib conn) (part CONN_5))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 52FB4AA7)))
|
||||
(libparts
|
||||
(libpart (lib device) (part C)
|
||||
(description "Condensateur non polarise")
|
||||
(footprints
|
||||
(fp SM*)
|
||||
(fp C?)
|
||||
(fp C1-1))
|
||||
(fields
|
||||
(field (name Reference) C)
|
||||
(field (name Value) C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part LED)
|
||||
(footprints
|
||||
(fp LED-3MM)
|
||||
(fp LED-5MM)
|
||||
(fp LED-10MM)
|
||||
(fp LED-0603)
|
||||
(fp LED-0805)
|
||||
(fp LED-1206)
|
||||
(fp LEDV))
|
||||
(fields
|
||||
(field (name Reference) D)
|
||||
(field (name Value) LED)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name A) (type passive))
|
||||
(pin (num 2) (name K) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistance)
|
||||
(footprints
|
||||
(fp R?)
|
||||
(fp SM0603)
|
||||
(fp SM0805)
|
||||
(fp R?-*)
|
||||
(fp SM1206))
|
||||
(fields
|
||||
(field (name Reference) R)
|
||||
(field (name Value) R)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type passive))
|
||||
(pin (num 2) (name ~) (type passive))))
|
||||
(libpart (lib device) (part SW_PUSH)
|
||||
(description "Push Button")
|
||||
(fields
|
||||
(field (name Reference) SW)
|
||||
(field (name Value) SW_PUSH)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib conn) (part CONN_14)
|
||||
(description "Symbole general de connexion")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_14))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))
|
||||
(pin (num 5) (name P5) (type passive))
|
||||
(pin (num 6) (name P6) (type passive))
|
||||
(pin (num 7) (name P7) (type passive))
|
||||
(pin (num 8) (name P8) (type passive))
|
||||
(pin (num 9) (name P9) (type passive))
|
||||
(pin (num 10) (name P10) (type passive))
|
||||
(pin (num 11) (name P11) (type passive))
|
||||
(pin (num 12) (name P12) (type passive))
|
||||
(pin (num 13) (name P13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))))
|
||||
(libpart (lib conn) (part CONN_4)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_4))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))))
|
||||
(libpart (lib conn) (part DB25)
|
||||
(footprints
|
||||
(fp DB25*))
|
||||
(fields
|
||||
(field (name Reference) J)
|
||||
(field (name Value) DB25))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))
|
||||
(pin (num 3) (name 3) (type passive))
|
||||
(pin (num 4) (name 4) (type passive))
|
||||
(pin (num 5) (name 5) (type passive))
|
||||
(pin (num 6) (name 6) (type passive))
|
||||
(pin (num 7) (name 7) (type passive))
|
||||
(pin (num 8) (name 8) (type passive))
|
||||
(pin (num 9) (name 9) (type passive))
|
||||
(pin (num 10) (name 10) (type passive))
|
||||
(pin (num 11) (name 11) (type passive))
|
||||
(pin (num 12) (name 12) (type passive))
|
||||
(pin (num 13) (name 13) (type passive))
|
||||
(pin (num 14) (name P14) (type passive))
|
||||
(pin (num 15) (name P15) (type passive))
|
||||
(pin (num 16) (name P16) (type passive))
|
||||
(pin (num 17) (name P17) (type passive))
|
||||
(pin (num 18) (name P18) (type passive))
|
||||
(pin (num 19) (name P19) (type passive))
|
||||
(pin (num 20) (name P20) (type passive))
|
||||
(pin (num 21) (name P21) (type passive))
|
||||
(pin (num 22) (name P22) (type passive))
|
||||
(pin (num 23) (name P23) (type passive))
|
||||
(pin (num 24) (name P24) (type passive))
|
||||
(pin (num 25) (name P25) (type passive))))
|
||||
(libpart (lib stm8s105k4t6c) (part STM8S105K4T6C)
|
||||
(footprints
|
||||
(fp lqfp32*))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) STM8S105K4T6C)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name NRST) (type input))
|
||||
(pin (num 2) (name OSCIN/PA1) (type 3state))
|
||||
(pin (num 3) (name OSCOUT/PA2) (type 3state))
|
||||
(pin (num 4) (name VSS) (type power_in))
|
||||
(pin (num 5) (name VCAP) (type power_out))
|
||||
(pin (num 6) (name "VDD(3.3-5v)") (type power_in))
|
||||
(pin (num 7) (name VDDio) (type power_in))
|
||||
(pin (num 8) (name PF4/AIN12) (type 3state))
|
||||
(pin (num 9) (name VDDA) (type power_in))
|
||||
(pin (num 10) (name VSSA) (type power_in))
|
||||
(pin (num 11) (name PB5/AIN5[I2X_SDA]) (type 3state))
|
||||
(pin (num 12) (name PB4/AIN4[I2C_SCL]) (type 3state))
|
||||
(pin (num 13) (name PB3/AIN3[TIM1_ETR]) (type 3state))
|
||||
(pin (num 14) (name PB2/AIN2[TIM1_CH3N]) (type 3state))
|
||||
(pin (num 15) (name PB1/AIN1_[TIM1_CH2N]) (type 3state))
|
||||
(pin (num 16) (name PB0/AIN0_[TIM1_CH1N]) (type 3state))
|
||||
(pin (num 17) (name PE5/SPI_NSS) (type 3state))
|
||||
(pin (num 18) (name "PC1(HS)/TIM1_CH1") (type 3state))
|
||||
(pin (num 19) (name "PC2(HS)/TIM1_CH2") (type 3state))
|
||||
(pin (num 20) (name "PC3(HS)/TIM1_CH3") (type 3state))
|
||||
(pin (num 21) (name "PC4(HS)/TIM1_CH4") (type 3state))
|
||||
(pin (num 22) (name "PC5(HS)/SPI_SCK") (type 3state))
|
||||
(pin (num 23) (name "PC6(HS)/SPI_MOSI") (type 3state))
|
||||
(pin (num 24) (name "PC7(HS)/SPI_MISO") (type 3state))
|
||||
(pin (num 25) (name "PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO]") (type 3state))
|
||||
(pin (num 26) (name "PD1(HS)/SWIM") (type 3state))
|
||||
(pin (num 27) (name "PD2(HS)/TIM3_CH1[TIM2_CH3]") (type 3state))
|
||||
(pin (num 28) (name "PD3(HS)/TIM2_CH2[ADC_ETR]") (type 3state))
|
||||
(pin (num 29) (name "PD4(HS)/TIM2_CH1[BEEP]") (type 3state))
|
||||
(pin (num 30) (name PD5/UART2_TX) (type 3state))
|
||||
(pin (num 31) (name PD6/UART2_RX) (type 3state))
|
||||
(pin (num 32) (name PD7/TLI[TIM1_CH4]) (type 3state))))
|
||||
(libpart (lib conn) (part CONN_5)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_5))
|
||||
(pins
|
||||
(pin (num 1) (name ~) (type power_out))
|
||||
(pin (num 2) (name ~) (type passive))
|
||||
(pin (num 3) (name ~) (type passive))
|
||||
(pin (num 4) (name ~) (type passive))
|
||||
(pin (num 5) (name ~) (type power_out)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri /usr/share/kicad/library/device.lib))
|
||||
(library (logical conn)
|
||||
(uri /usr/share/kicad/library/conn.lib))
|
||||
(library (logical stm8s105k4t6c)
|
||||
(uri stm8s105k4t6c.lib)))
|
||||
(nets
|
||||
(net (code 1) (name "")
|
||||
(node (ref J1) (pin 14)))
|
||||
(net (code 2) (name /PC1)
|
||||
(node (ref P1) (pin 14))
|
||||
(node (ref J1) (pin 2))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 3) (name GND)
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref P1) (pin 2))
|
||||
(node (ref P4) (pin 5))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref U1) (pin 10))
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref J1) (pin 24))
|
||||
(node (ref J1) (pin 25))
|
||||
(node (ref J1) (pin 18))
|
||||
(node (ref J1) (pin 19))
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref P2) (pin 4))
|
||||
(node (ref J1) (pin 20))
|
||||
(node (ref U1) (pin 4))
|
||||
(node (ref J1) (pin 21))
|
||||
(node (ref J1) (pin 22))
|
||||
(node (ref J1) (pin 23))
|
||||
(node (ref C3) (pin 2)))
|
||||
(net (code 4) (name /NRST)
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref P2) (pin 3))
|
||||
(node (ref U1) (pin 1))
|
||||
(node (ref R3) (pin 2))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref P1) (pin 3)))
|
||||
(net (code 5) (name +3.3V)
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref U1) (pin 9))
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref P4) (pin 1))
|
||||
(node (ref U1) (pin 6)))
|
||||
(net (code 6) (name /PC2)
|
||||
(node (ref P3) (pin 14))
|
||||
(node (ref R1) (pin 2))
|
||||
(node (ref U1) (pin 19)))
|
||||
(net (code 7) (name "/1st out")
|
||||
(node (ref J1) (pin 17)))
|
||||
(net (code 8) (name /5.0V)
|
||||
(node (ref P4) (pin 2)))
|
||||
(net (code 9) (name /IN4)
|
||||
(node (ref J1) (pin 13)))
|
||||
(net (code 10) (name /IN3)
|
||||
(node (ref J1) (pin 12)))
|
||||
(net (code 11) (name /IN2)
|
||||
(node (ref J1) (pin 11)))
|
||||
(net (code 12) (name /IN1)
|
||||
(node (ref J1) (pin 10)))
|
||||
(net (code 13) (name /EN)
|
||||
(node (ref J1) (pin 16)))
|
||||
(net (code 14) (name /IN5)
|
||||
(node (ref J1) (pin 15)))
|
||||
(net (code 15) (name "/2nd out")
|
||||
(node (ref J1) (pin 1)))
|
||||
(net (code 16) (name /PD5)
|
||||
(node (ref P3) (pin 3))
|
||||
(node (ref U1) (pin 30))
|
||||
(node (ref P4) (pin 4)))
|
||||
(net (code 17) (name /PD6)
|
||||
(node (ref P4) (pin 3))
|
||||
(node (ref P3) (pin 2))
|
||||
(node (ref U1) (pin 31)))
|
||||
(net (code 18) (name "/A CLK")
|
||||
(node (ref J1) (pin 8)))
|
||||
(net (code 19) (name /PD2)
|
||||
(node (ref J1) (pin 6))
|
||||
(node (ref P3) (pin 6))
|
||||
(node (ref U1) (pin 27)))
|
||||
(net (code 20) (name /PD4)
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref J1) (pin 4))
|
||||
(node (ref P3) (pin 4)))
|
||||
(net (code 21) (name "")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref D2) (pin 2)))
|
||||
(net (code 22) (name "/A DIR")
|
||||
(node (ref J1) (pin 9))
|
||||
(node (ref U1) (pin 13))
|
||||
(node (ref P1) (pin 9)))
|
||||
(net (code 23) (name /PB2)
|
||||
(node (ref U1) (pin 14))
|
||||
(node (ref P1) (pin 10))
|
||||
(node (ref J1) (pin 7)))
|
||||
(net (code 24) (name /PB1)
|
||||
(node (ref P1) (pin 11))
|
||||
(node (ref U1) (pin 15))
|
||||
(node (ref J1) (pin 5)))
|
||||
(net (code 25) (name /PB0)
|
||||
(node (ref U1) (pin 16))
|
||||
(node (ref P1) (pin 12))
|
||||
(node (ref J1) (pin 3)))
|
||||
(net (code 26) (name "")
|
||||
(node (ref C1) (pin 2))
|
||||
(node (ref U1) (pin 5)))
|
||||
(net (code 27) (name /PC3)
|
||||
(node (ref U1) (pin 20))
|
||||
(node (ref P3) (pin 13)))
|
||||
(net (code 28) (name /PC6)
|
||||
(node (ref U1) (pin 23))
|
||||
(node (ref P3) (pin 10)))
|
||||
(net (code 29) (name /PD7)
|
||||
(node (ref P3) (pin 1))
|
||||
(node (ref U1) (pin 32)))
|
||||
(net (code 30) (name /PC5)
|
||||
(node (ref P3) (pin 11))
|
||||
(node (ref U1) (pin 22)))
|
||||
(net (code 31) (name /PB4)
|
||||
(node (ref P1) (pin 8))
|
||||
(node (ref U1) (pin 12)))
|
||||
(net (code 32) (name /PC4)
|
||||
(node (ref P3) (pin 12))
|
||||
(node (ref U1) (pin 21)))
|
||||
(net (code 33) (name /PB5)
|
||||
(node (ref U1) (pin 11))
|
||||
(node (ref P1) (pin 7)))
|
||||
(net (code 34) (name /PF4)
|
||||
(node (ref U1) (pin 8))
|
||||
(node (ref P1) (pin 6)))
|
||||
(net (code 35) (name /OSC2IN)
|
||||
(node (ref U1) (pin 3))
|
||||
(node (ref P1) (pin 5)))
|
||||
(net (code 36) (name /OSC1IN)
|
||||
(node (ref P1) (pin 4))
|
||||
(node (ref U1) (pin 2)))
|
||||
(net (code 37) (name /PD3)
|
||||
(node (ref P3) (pin 5))
|
||||
(node (ref U1) (pin 28)))
|
||||
(net (code 38) (name /PE5)
|
||||
(node (ref U1) (pin 17))
|
||||
(node (ref P1) (pin 13)))
|
||||
(net (code 39) (name /SWIM/PD1)
|
||||
(node (ref P3) (pin 7))
|
||||
(node (ref P2) (pin 2))
|
||||
(node (ref U1) (pin 26)))
|
||||
(net (code 40) (name /PD0)
|
||||
(node (ref P3) (pin 8))
|
||||
(node (ref U1) (pin 25)))
|
||||
(net (code 41) (name /PC7)
|
||||
(node (ref U1) (pin 24))
|
||||
(node (ref P3) (pin 9)))
|
||||
(net (code 42) (name "")
|
||||
(node (ref R1) (pin 1))
|
||||
(node (ref D1) (pin 2)))))
|
||||
45
stepper_independent_bin/schematic/stepper.pro
Normal file
45
stepper_independent_bin/schematic/stepper.pro
Normal file
@ -0,0 +1,45 @@
|
||||
update=Ср 26 фев 2014 17:43:07
|
||||
last_client=eeschema
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
NetFmtName=
|
||||
RptD_X=0
|
||||
RptD_Y=100
|
||||
RptLab=1
|
||||
LabSize=118
|
||||
[eeschema/libraries]
|
||||
LibName1=power
|
||||
LibName2=device
|
||||
LibName3=transistors
|
||||
LibName4=conn
|
||||
LibName5=linear
|
||||
LibName6=regul
|
||||
LibName7=74xx
|
||||
LibName8=cmos4000
|
||||
LibName9=adc-dac
|
||||
LibName10=memory
|
||||
LibName11=xilinx
|
||||
LibName12=special
|
||||
LibName13=microcontrollers
|
||||
LibName14=dsp
|
||||
LibName15=microchip
|
||||
LibName16=analog_switches
|
||||
LibName17=motorola
|
||||
LibName18=texas
|
||||
LibName19=intel
|
||||
LibName20=audio
|
||||
LibName21=interface
|
||||
LibName22=digital-audio
|
||||
LibName23=philips
|
||||
LibName24=display
|
||||
LibName25=cypress
|
||||
LibName26=siliconi
|
||||
LibName27=opto
|
||||
LibName28=atmel
|
||||
LibName29=contrib
|
||||
LibName30=valves
|
||||
LibName31=stm8
|
||||
LibName32=st-microelectronics
|
||||
LibName33=stm8s105k4t6c
|
||||
LibName34=stepper-cache
|
||||
779
stepper_independent_bin/schematic/stepper.sch
Normal file
779
stepper_independent_bin/schematic/stepper.sch
Normal file
@ -0,0 +1,779 @@
|
||||
EESchema Schematic File Version 2 date Пн 03 мар 2014 17:27:22
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:special
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:stm8
|
||||
LIBS:st-microelectronics
|
||||
LIBS:stm8s105k4t6c
|
||||
LIBS:stepper-cache
|
||||
LIBS:stepper-cache
|
||||
EELAYER 27 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date "3 mar 2014"
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L STM8S105K4T6C U1
|
||||
U 1 1 52FB03A2
|
||||
P 4400 3100
|
||||
F 0 "U1" H 4400 4150 60 0000 C CNN
|
||||
F 1 "STM8S105K4T6C" H 4450 2250 60 0000 C CNN
|
||||
F 2 "~" H 4400 3100 60 0000 C CNN
|
||||
F 3 "~" H 4400 3100 60 0000 C CNN
|
||||
1 4400 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR01
|
||||
U 1 1 52FB03EF
|
||||
P 2750 3200
|
||||
F 0 "#PWR01" H 2750 3200 30 0001 C CNN
|
||||
F 1 "GND" H 2750 3130 30 0001 C CNN
|
||||
F 2 "" H 2750 3200 60 0000 C CNN
|
||||
F 3 "" H 2750 3200 60 0000 C CNN
|
||||
1 2750 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 3200 2750 3150
|
||||
Wire Wire Line
|
||||
2750 3150 3000 3150
|
||||
$Comp
|
||||
L GND #PWR02
|
||||
U 1 1 52FB0400
|
||||
P 2750 2600
|
||||
F 0 "#PWR02" H 2750 2600 30 0001 C CNN
|
||||
F 1 "GND" H 2750 2530 30 0001 C CNN
|
||||
F 2 "" H 2750 2600 60 0000 C CNN
|
||||
F 3 "" H 2750 2600 60 0000 C CNN
|
||||
1 2750 2600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2750 2600 2750 2550
|
||||
Wire Wire Line
|
||||
2750 2550 3000 2550
|
||||
$Comp
|
||||
L C C1
|
||||
U 1 1 52FB0413
|
||||
P 2250 2700
|
||||
F 0 "C1" H 2300 2800 50 0000 L CNN
|
||||
F 1 "1u" H 2300 2600 50 0000 L CNN
|
||||
F 2 "" H 2250 2700 60 0000 C CNN
|
||||
F 3 "" H 2250 2700 60 0000 C CNN
|
||||
1 2250 2700
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L C C2
|
||||
U 1 1 52FB0426
|
||||
P 2250 2950
|
||||
F 0 "C2" H 2300 3050 50 0000 L CNN
|
||||
F 1 "104" H 2300 2850 50 0000 L CNN
|
||||
F 2 "" H 2250 2950 60 0000 C CNN
|
||||
F 3 "" H 2250 2950 60 0000 C CNN
|
||||
1 2250 2950
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2450 2700 2850 2700
|
||||
Wire Wire Line
|
||||
2850 2700 2850 2650
|
||||
Wire Wire Line
|
||||
2850 2650 3000 2650
|
||||
Wire Wire Line
|
||||
3000 2750 3000 2850
|
||||
Wire Wire Line
|
||||
2450 2950 2450 2850
|
||||
Wire Wire Line
|
||||
2450 2850 3000 2850
|
||||
Wire Wire Line
|
||||
2050 2700 2050 3100
|
||||
$Comp
|
||||
L GND #PWR03
|
||||
U 1 1 52FB0453
|
||||
P 2050 3100
|
||||
F 0 "#PWR03" H 2050 3100 30 0001 C CNN
|
||||
F 1 "GND" H 2050 3030 30 0001 C CNN
|
||||
F 2 "" H 2050 3100 60 0000 C CNN
|
||||
F 3 "" H 2050 3100 60 0000 C CNN
|
||||
1 2050 3100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 2050 2800
|
||||
Connection ~ 2050 2950
|
||||
Text Label 3000 2250 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 3000 2350 2 60 ~ 0
|
||||
OSC1IN/PA1
|
||||
Text Label 3000 2450 2 60 ~ 0
|
||||
OSC2IN/PA2
|
||||
Text Label 3000 2950 2 60 ~ 0
|
||||
PF4
|
||||
Text Label 3000 3250 2 60 ~ 0
|
||||
PB5
|
||||
Text Label 3000 3350 2 60 ~ 0
|
||||
PB4
|
||||
Text Label 3000 3450 2 60 ~ 0
|
||||
PB3
|
||||
Text Label 3000 3550 2 60 ~ 0
|
||||
PB2
|
||||
Text Label 3000 3650 2 60 ~ 0
|
||||
PB1
|
||||
Text Label 3000 3750 2 60 ~ 0
|
||||
PB0
|
||||
Text Label 5800 3750 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 5800 3650 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 5800 3550 0 60 ~ 0
|
||||
PC2
|
||||
Text Label 5800 3450 0 60 ~ 0
|
||||
PC3
|
||||
Text Label 5800 3350 0 60 ~ 0
|
||||
PC4
|
||||
Text Label 5800 3250 0 60 ~ 0
|
||||
PC5
|
||||
Text Label 5800 3150 0 60 ~ 0
|
||||
PC6
|
||||
Text Label 5800 3050 0 60 ~ 0
|
||||
PC7
|
||||
Text Label 5800 2950 0 60 ~ 0
|
||||
PD0
|
||||
Text Label 5800 2850 0 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 5800 2750 0 60 ~ 0
|
||||
PD2
|
||||
Text Label 5800 2650 0 60 ~ 0
|
||||
PD3
|
||||
Text Label 5800 2550 0 60 ~ 0
|
||||
PD4
|
||||
Text Label 5800 2450 0 60 ~ 0
|
||||
PD5
|
||||
Text Label 5800 2350 0 60 ~ 0
|
||||
PD6
|
||||
Text Label 5800 2250 0 60 ~ 0
|
||||
PD7
|
||||
$Comp
|
||||
L CONN_4 P2
|
||||
U 1 1 52FB0A49
|
||||
P 4350 1000
|
||||
F 0 "P2" V 4300 1000 50 0000 C CNN
|
||||
F 1 "CONN_4" V 4400 1000 50 0000 C CNN
|
||||
F 2 "" H 4350 1000 60 0000 C CNN
|
||||
F 3 "" H 4350 1000 60 0000 C CNN
|
||||
1 4350 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P1
|
||||
U 1 1 52FB0A6A
|
||||
P 1250 1500
|
||||
F 0 "P1" V 1220 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 1330 1500 60 0000 C CNN
|
||||
F 2 "" H 1250 1500 60 0000 C CNN
|
||||
F 3 "" H 1250 1500 60 0000 C CNN
|
||||
1 1250 1500
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_14 P3
|
||||
U 1 1 52FB0A79
|
||||
P 7100 1500
|
||||
F 0 "P3" V 7070 1500 60 0000 C CNN
|
||||
F 1 "CONN_14" V 7180 1500 60 0000 C CNN
|
||||
F 2 "" H 7100 1500 60 0000 C CNN
|
||||
F 3 "" H 7100 1500 60 0000 C CNN
|
||||
1 7100 1500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Text Label 1600 1150 0 60 ~ 0
|
||||
OSC1IN/PA1
|
||||
Text Label 1600 1250 0 60 ~ 0
|
||||
OSC2IN/PA2
|
||||
Text Label 1600 1350 0 60 ~ 0
|
||||
PF4
|
||||
Text Label 1600 1450 0 60 ~ 0
|
||||
PB5
|
||||
Text Label 1600 1550 0 60 ~ 0
|
||||
PB4
|
||||
Text Label 1600 1650 0 60 ~ 0
|
||||
PB3
|
||||
Text Label 1600 1750 0 60 ~ 0
|
||||
PB2
|
||||
Text Label 1600 1850 0 60 ~ 0
|
||||
PB1
|
||||
Text Label 1600 1950 0 60 ~ 0
|
||||
PB0
|
||||
Text Label 1600 2050 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 1600 2150 0 60 ~ 0
|
||||
PC1
|
||||
Text Label 1600 1050 0 60 ~ 0
|
||||
NRST
|
||||
Text Label 4000 950 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 4000 1050 2 60 ~ 0
|
||||
NRST
|
||||
Text Label 6750 850 2 60 ~ 0
|
||||
PD7
|
||||
Text Label 6750 950 2 60 ~ 0
|
||||
PD6
|
||||
Text Label 6750 1050 2 60 ~ 0
|
||||
PD5
|
||||
Text Label 6750 1150 2 60 ~ 0
|
||||
PD4
|
||||
Text Label 6750 1250 2 60 ~ 0
|
||||
PD3
|
||||
Text Label 6750 1350 2 60 ~ 0
|
||||
PD2
|
||||
Text Label 6750 1450 2 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 6750 1550 2 60 ~ 0
|
||||
PD0
|
||||
Text Label 6750 1650 2 60 ~ 0
|
||||
PC7
|
||||
Text Label 6750 1750 2 60 ~ 0
|
||||
PC6
|
||||
Text Label 6750 1850 2 60 ~ 0
|
||||
PC5
|
||||
Text Label 6750 1950 2 60 ~ 0
|
||||
PC4
|
||||
Text Label 6750 2050 2 60 ~ 0
|
||||
PC3
|
||||
Text Label 6750 2150 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR04
|
||||
U 1 1 52FB0DC4
|
||||
P 950 2800
|
||||
F 0 "#PWR04" H 950 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 950 2910 30 0000 C CNN
|
||||
F 2 "" H 950 2800 60 0000 C CNN
|
||||
F 3 "" H 950 2800 60 0000 C CNN
|
||||
1 950 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D1
|
||||
U 1 1 52FB0DD3
|
||||
P 950 3100
|
||||
F 0 "D1" H 950 3200 50 0000 C CNN
|
||||
F 1 "LED" H 950 3000 50 0000 C CNN
|
||||
F 2 "" H 950 3100 60 0000 C CNN
|
||||
F 3 "" H 950 3100 60 0000 C CNN
|
||||
1 950 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 52FB0DE2
|
||||
P 950 3600
|
||||
F 0 "R1" V 1030 3600 50 0000 C CNN
|
||||
F 1 "1k" V 950 3600 50 0000 C CNN
|
||||
F 2 "" H 950 3600 60 0000 C CNN
|
||||
F 3 "" H 950 3600 60 0000 C CNN
|
||||
1 950 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
950 2800 950 2900
|
||||
Wire Wire Line
|
||||
950 3300 950 3350
|
||||
Wire Wire Line
|
||||
950 3850 950 3950
|
||||
$Comp
|
||||
L +3.3V #PWR05
|
||||
U 1 1 52FB0EC7
|
||||
P 1300 2800
|
||||
F 0 "#PWR05" H 1300 2760 30 0001 C CNN
|
||||
F 1 "+3.3V" H 1300 2910 30 0000 C CNN
|
||||
F 2 "" H 1300 2800 60 0000 C CNN
|
||||
F 3 "" H 1300 2800 60 0000 C CNN
|
||||
1 1300 2800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L LED D2
|
||||
U 1 1 52FB0ECD
|
||||
P 1300 3100
|
||||
F 0 "D2" H 1300 3200 50 0000 C CNN
|
||||
F 1 "LED" H 1300 3000 50 0000 C CNN
|
||||
F 2 "" H 1300 3100 60 0000 C CNN
|
||||
F 3 "" H 1300 3100 60 0000 C CNN
|
||||
1 1300 3100
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 52FB0ED3
|
||||
P 1300 3600
|
||||
F 0 "R2" V 1380 3600 50 0000 C CNN
|
||||
F 1 "1k" V 1300 3600 50 0000 C CNN
|
||||
F 2 "" H 1300 3600 60 0000 C CNN
|
||||
F 3 "" H 1300 3600 60 0000 C CNN
|
||||
1 1300 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR06
|
||||
U 1 1 52FB0ED9
|
||||
P 1300 3950
|
||||
F 0 "#PWR06" H 1300 3950 30 0001 C CNN
|
||||
F 1 "GND" H 1300 3880 30 0001 C CNN
|
||||
F 2 "" H 1300 3950 60 0000 C CNN
|
||||
F 3 "" H 1300 3950 60 0000 C CNN
|
||||
1 1300 3950
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 2800 1300 2900
|
||||
Wire Wire Line
|
||||
1300 3300 1300 3350
|
||||
Wire Wire Line
|
||||
1300 3850 1300 3950
|
||||
Text Label 950 3950 2 60 ~ 0
|
||||
PC2
|
||||
$Comp
|
||||
L +3.3V #PWR07
|
||||
U 1 1 52FB0EF1
|
||||
P 6500 2550
|
||||
F 0 "#PWR07" H 6500 2510 30 0001 C CNN
|
||||
F 1 "+3.3V" H 6500 2660 30 0000 C CNN
|
||||
F 2 "" H 6500 2550 60 0000 C CNN
|
||||
F 3 "" H 6500 2550 60 0000 C CNN
|
||||
1 6500 2550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 52FB0EFD
|
||||
P 6500 2900
|
||||
F 0 "R3" V 6580 2900 50 0000 C CNN
|
||||
F 1 "10k" V 6500 2900 50 0000 C CNN
|
||||
F 2 "" H 6500 2900 60 0000 C CNN
|
||||
F 3 "" H 6500 2900 60 0000 C CNN
|
||||
1 6500 2900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR08
|
||||
U 1 1 52FB0F03
|
||||
P 6500 4050
|
||||
F 0 "#PWR08" H 6500 4050 30 0001 C CNN
|
||||
F 1 "GND" H 6500 3980 30 0001 C CNN
|
||||
F 2 "" H 6500 4050 60 0000 C CNN
|
||||
F 3 "" H 6500 4050 60 0000 C CNN
|
||||
1 6500 4050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 2550 6500 2650
|
||||
Wire Wire Line
|
||||
6500 3850 6500 4050
|
||||
$Comp
|
||||
L SW_PUSH SW1
|
||||
U 1 1 52FB0F3B
|
||||
P 6500 3550
|
||||
F 0 "SW1" H 6650 3660 50 0000 C CNN
|
||||
F 1 "SW_PUSH" H 6500 3470 50 0000 C CNN
|
||||
F 2 "" H 6500 3550 60 0000 C CNN
|
||||
F 3 "" H 6500 3550 60 0000 C CNN
|
||||
1 6500 3550
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 3250 6500 3150
|
||||
$Comp
|
||||
L C C3
|
||||
U 1 1 52FB0F99
|
||||
P 6900 3550
|
||||
F 0 "C3" H 6950 3650 50 0000 L CNN
|
||||
F 1 "104" H 6950 3450 50 0000 L CNN
|
||||
F 2 "" H 6900 3550 60 0000 C CNN
|
||||
F 3 "" H 6900 3550 60 0000 C CNN
|
||||
1 6900 3550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6900 3200 6900 3350
|
||||
Wire Wire Line
|
||||
6900 3750 6900 3900
|
||||
Wire Wire Line
|
||||
6900 3900 6500 3900
|
||||
Connection ~ 6500 3900
|
||||
Wire Wire Line
|
||||
6500 3200 6900 3200
|
||||
Connection ~ 6500 3200
|
||||
Text Label 6500 3200 2 60 ~ 0
|
||||
NRST
|
||||
$Comp
|
||||
L +3.3V #PWR09
|
||||
U 1 1 52FB2273
|
||||
P 2150 850
|
||||
F 0 "#PWR09" H 2150 810 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2150 960 30 0000 C CNN
|
||||
F 2 "" H 2150 850 60 0000 C CNN
|
||||
F 3 "" H 2150 850 60 0000 C CNN
|
||||
1 2150 850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 850 2150 850
|
||||
$Comp
|
||||
L GND #PWR010
|
||||
U 1 1 52FB2296
|
||||
P 2150 1000
|
||||
F 0 "#PWR010" H 2150 1000 30 0001 C CNN
|
||||
F 1 "GND" H 2150 930 30 0001 C CNN
|
||||
F 2 "" H 2150 1000 60 0000 C CNN
|
||||
F 3 "" H 2150 1000 60 0000 C CNN
|
||||
1 2150 1000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1600 950 2150 950
|
||||
Wire Wire Line
|
||||
2150 950 2150 1000
|
||||
Wire Wire Line
|
||||
2600 3050 3000 3050
|
||||
Wire Wire Line
|
||||
2750 3050 2750 2850
|
||||
Connection ~ 2750 2850
|
||||
$Comp
|
||||
L +3.3V #PWR011
|
||||
U 1 1 52FB26FA
|
||||
P 2600 3000
|
||||
F 0 "#PWR011" H 2600 2960 30 0001 C CNN
|
||||
F 1 "+3.3V" H 2600 3110 30 0000 C CNN
|
||||
F 2 "" H 2600 3000 60 0000 C CNN
|
||||
F 3 "" H 2600 3000 60 0000 C CNN
|
||||
1 2600 3000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
2600 3000 2600 3050
|
||||
Connection ~ 2750 3050
|
||||
$Comp
|
||||
L +3.3V #PWR012
|
||||
U 1 1 52FB286D
|
||||
P 4000 750
|
||||
F 0 "#PWR012" H 4000 710 30 0001 C CNN
|
||||
F 1 "+3.3V" H 4000 860 30 0000 C CNN
|
||||
F 2 "" H 4000 750 60 0000 C CNN
|
||||
F 3 "" H 4000 750 60 0000 C CNN
|
||||
1 4000 750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR013
|
||||
U 1 1 52FB287C
|
||||
P 4000 1300
|
||||
F 0 "#PWR013" H 4000 1300 30 0001 C CNN
|
||||
F 1 "GND" H 4000 1230 30 0001 C CNN
|
||||
F 2 "" H 4000 1300 60 0000 C CNN
|
||||
F 3 "" H 4000 1300 60 0000 C CNN
|
||||
1 4000 1300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4000 1300 4000 1150
|
||||
Wire Wire Line
|
||||
4000 850 4000 750
|
||||
Wire Notes Line
|
||||
600 500 600 4200
|
||||
Wire Notes Line
|
||||
600 4200 7500 4200
|
||||
Wire Notes Line
|
||||
7500 4200 7500 500
|
||||
Wire Notes Line
|
||||
7500 500 600 500
|
||||
Text Notes 4800 750 0 118 ~ 0
|
||||
STM8 board
|
||||
Text Notes 7950 950 0 118 ~ 0
|
||||
USB <-> TTL
|
||||
Text Label 9000 1150 0 61 ~ 0
|
||||
GND
|
||||
Text Label 9000 1250 0 61 ~ 0
|
||||
RXD
|
||||
Text Label 9000 1350 0 61 ~ 0
|
||||
TXD
|
||||
Text Label 9000 1450 0 61 ~ 0
|
||||
5.0V
|
||||
Text Label 9000 1550 0 61 ~ 0
|
||||
3.3V
|
||||
$Comp
|
||||
L GND #PWR014
|
||||
U 1 1 52FB4CEF
|
||||
P 10000 1250
|
||||
F 0 "#PWR014" H 10000 1250 30 0001 C CNN
|
||||
F 1 "GND" H 10000 1180 30 0001 C CNN
|
||||
F 2 "" H 10000 1250 60 0000 C CNN
|
||||
F 3 "" H 10000 1250 60 0000 C CNN
|
||||
1 10000 1250
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
9000 1150 10000 1150
|
||||
Wire Wire Line
|
||||
10000 1150 10000 1250
|
||||
Wire Wire Line
|
||||
9000 1250 9600 1250
|
||||
Wire Wire Line
|
||||
9600 1250 9600 850
|
||||
Wire Wire Line
|
||||
9000 1350 10200 1350
|
||||
Wire Wire Line
|
||||
10200 1350 10200 850
|
||||
$Comp
|
||||
L +3.3V #PWR015
|
||||
U 1 1 52FB4EDC
|
||||
P 10400 1450
|
||||
F 0 "#PWR015" H 10400 1410 30 0001 C CNN
|
||||
F 1 "+3.3V" H 10400 1560 30 0000 C CNN
|
||||
F 2 "" H 10400 1450 60 0000 C CNN
|
||||
F 3 "" H 10400 1450 60 0000 C CNN
|
||||
1 10400 1450
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
9000 1550 10400 1550
|
||||
Wire Wire Line
|
||||
10400 1550 10400 1450
|
||||
NoConn ~ 9000 1450
|
||||
Text Label 9600 850 0 61 ~ 0
|
||||
PD5
|
||||
Text Label 10200 850 0 61 ~ 0
|
||||
PD6
|
||||
$Comp
|
||||
L CONN_3 K1
|
||||
U 1 1 530DEDA9
|
||||
P 950 5150
|
||||
F 0 "K1" V 900 5150 50 0000 C CNN
|
||||
F 1 "CONN_3" V 1000 5150 40 0000 C CNN
|
||||
F 2 "" H 950 5150 60 0000 C CNN
|
||||
F 3 "" H 950 5150 60 0000 C CNN
|
||||
1 950 5150
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 5050 1600 5050
|
||||
Wire Wire Line
|
||||
1300 5150 1600 5150
|
||||
Wire Wire Line
|
||||
1300 5250 1600 5250
|
||||
Text Label 1600 5050 0 60 ~ 0
|
||||
PD0
|
||||
Text Label 1600 5150 0 60 ~ 0
|
||||
PE5
|
||||
Text Label 1600 5250 0 60 ~ 0
|
||||
PC1
|
||||
$Comp
|
||||
L CONN_3 K2
|
||||
U 1 1 530DEE90
|
||||
P 950 5750
|
||||
F 0 "K2" V 900 5750 50 0000 C CNN
|
||||
F 1 "CONN_3" V 1000 5750 40 0000 C CNN
|
||||
F 2 "" H 950 5750 60 0000 C CNN
|
||||
F 3 "" H 950 5750 60 0000 C CNN
|
||||
1 950 5750
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 5650 1600 5650
|
||||
Wire Wire Line
|
||||
1300 5750 1600 5750
|
||||
Wire Wire Line
|
||||
1300 5850 1600 5850
|
||||
Text Label 1600 5650 0 60 ~ 0
|
||||
PD7
|
||||
Text Label 1600 5750 0 60 ~ 0
|
||||
PD3
|
||||
Text Label 1600 5850 0 60 ~ 0
|
||||
PD4
|
||||
$Comp
|
||||
L CONN_3 K3
|
||||
U 1 1 530DEE9C
|
||||
P 950 6350
|
||||
F 0 "K3" V 900 6350 50 0000 C CNN
|
||||
F 1 "CONN_3" V 1000 6350 40 0000 C CNN
|
||||
F 2 "" H 950 6350 60 0000 C CNN
|
||||
F 3 "" H 950 6350 60 0000 C CNN
|
||||
1 950 6350
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
1300 6250 1600 6250
|
||||
Wire Wire Line
|
||||
1300 6350 1600 6350
|
||||
Wire Wire Line
|
||||
1300 6450 1600 6450
|
||||
Text Label 1600 6250 0 60 ~ 0
|
||||
PF4
|
||||
Text Label 1600 6350 0 60 ~ 0
|
||||
SWIM/PD1
|
||||
Text Label 1600 6450 0 60 ~ 0
|
||||
PD2
|
||||
Text Notes 850 4900 0 98 ~ 0
|
||||
Motor 0
|
||||
Text Notes 850 5500 0 98 ~ 0
|
||||
Motor 1
|
||||
Text Notes 850 6100 0 98 ~ 0
|
||||
Motor 2
|
||||
Text Notes 700 4650 0 118 ~ 0
|
||||
MOTOR management
|
||||
Text Notes 3700 4650 0 118 ~ 0
|
||||
End-switches (EPs)
|
||||
$Comp
|
||||
L CONN_5 P4
|
||||
U 1 1 530DF06A
|
||||
P 3750 5200
|
||||
F 0 "P4" H 3800 5500 50 0000 C CNN
|
||||
F 1 "CONN_5" V 3900 5200 50 0000 C CNN
|
||||
F 2 "" H 3750 5200 60 0000 C CNN
|
||||
F 3 "" H 3750 5200 60 0000 C CNN
|
||||
1 3750 5200
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_5_ P7
|
||||
U 1 1 530DF308
|
||||
P 8600 1350
|
||||
F 0 "P7" H 8650 1050 50 0000 C CNN
|
||||
F 1 "CONN_5_" V 8750 1350 50 0000 C CNN
|
||||
F 2 "" H 8600 1350 60 0000 C CNN
|
||||
F 3 "" H 8600 1350 60 0000 C CNN
|
||||
1 8600 1350
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4150 5000 4700 5000
|
||||
Wire Wire Line
|
||||
4150 5200 4700 5200
|
||||
Wire Wire Line
|
||||
4150 5400 4700 5400
|
||||
Wire Wire Line
|
||||
4150 5100 4450 5100
|
||||
Wire Wire Line
|
||||
4150 5300 4450 5300
|
||||
Text Notes 3500 4850 0 98 ~ 0
|
||||
Motor 0
|
||||
Text Label 4700 5000 0 59 ~ 0
|
||||
PC7
|
||||
Text Label 4450 5100 0 59 ~ 0
|
||||
PC6
|
||||
Text Label 4700 5200 0 59 ~ 0
|
||||
PC5
|
||||
Text Label 4450 5300 0 59 ~ 0
|
||||
PC4
|
||||
Text Label 4700 5400 0 59 ~ 0
|
||||
PC3
|
||||
$Comp
|
||||
L CONN_5 P5
|
||||
U 1 1 530DF803
|
||||
P 3750 6100
|
||||
F 0 "P5" H 3800 6400 50 0000 C CNN
|
||||
F 1 "CONN_5" V 3900 6100 50 0000 C CNN
|
||||
F 2 "" H 3750 6100 60 0000 C CNN
|
||||
F 3 "" H 3750 6100 60 0000 C CNN
|
||||
1 3750 6100
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4150 6100 4700 6100
|
||||
Wire Wire Line
|
||||
4150 6300 4700 6300
|
||||
Wire Wire Line
|
||||
4150 6000 4450 6000
|
||||
Wire Wire Line
|
||||
4150 6200 4450 6200
|
||||
Text Notes 3500 5750 0 98 ~ 0
|
||||
Motor 1
|
||||
Text Label 4450 6000 0 59 ~ 0
|
||||
PB3
|
||||
Text Label 4700 6100 0 59 ~ 0
|
||||
PB2
|
||||
Text Label 4450 6200 0 59 ~ 0
|
||||
PB1
|
||||
Text Label 4700 6300 0 59 ~ 0
|
||||
PB0
|
||||
NoConn ~ 4150 5900
|
||||
$Comp
|
||||
L CONN_5 P6
|
||||
U 1 1 530DF8E3
|
||||
P 3750 7000
|
||||
F 0 "P6" H 3800 7300 50 0000 C CNN
|
||||
F 1 "CONN_5" V 3900 7000 50 0000 C CNN
|
||||
F 2 "" H 3750 7000 60 0000 C CNN
|
||||
F 3 "" H 3750 7000 60 0000 C CNN
|
||||
1 3750 7000
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4150 7000 4700 7000
|
||||
Wire Wire Line
|
||||
4150 7200 4700 7200
|
||||
Wire Wire Line
|
||||
4150 6900 4450 6900
|
||||
Wire Wire Line
|
||||
4150 7100 4450 7100
|
||||
Text Notes 3500 6650 0 98 ~ 0
|
||||
Motor 2
|
||||
Text Label 4450 6900 0 59 ~ 0
|
||||
OSC2IN/PA2
|
||||
Text Label 4700 7000 0 59 ~ 0
|
||||
OSC1IN/PA1
|
||||
Text Label 4450 7100 0 59 ~ 0
|
||||
PB5
|
||||
Text Label 4700 7200 0 59 ~ 0
|
||||
PB4
|
||||
NoConn ~ 4150 6800
|
||||
Text Notes 1300 5050 0 59 ~ 0
|
||||
DIR\nEN\nCLK
|
||||
Text Notes 1300 5650 0 59 ~ 0
|
||||
DIR\nEN\nCLK
|
||||
Text Notes 1300 6250 0 59 ~ 0
|
||||
DIR\nEN\nCLK
|
||||
Text Notes 4150 5000 0 63 ~ 0
|
||||
4\n3\n2\n1\n0
|
||||
Text Notes 4150 5900 0 63 ~ 0
|
||||
4\n3\n2\n1\n0
|
||||
Text Notes 4150 6800 0 63 ~ 0
|
||||
4\n3\n2\n1\n0
|
||||
$EndSCHEMATC
|
||||
9
stepper_independent_bin/schematic/stm8s105k4t6c.bck
Normal file
9
stepper_independent_bin/schematic/stm8s105k4t6c.bck
Normal file
@ -0,0 +1,9 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:09:58
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
13
stepper_independent_bin/schematic/stm8s105k4t6c.dcm
Normal file
13
stepper_independent_bin/schematic/stm8s105k4t6c.dcm
Normal file
@ -0,0 +1,13 @@
|
||||
EESchema-DOCLIB Version 2.0 Date: Вт 11 фев 2014 17:26:38
|
||||
#
|
||||
$CMP STM8S003K3T
|
||||
D STM8S003K3T, LQFP32 (7x7, 0.8mm pitch), 16MHz, 8K Flash, 1K RAM, 128 EEPROM
|
||||
K STM8 Microcontroller Value Line
|
||||
F http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00024550.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
$CMP STM8S105K4T6C
|
||||
K stm8
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
99
stepper_independent_bin/schematic/stm8s105k4t6c.lib
Normal file
99
stepper_independent_bin/schematic/stm8s105k4t6c.lib
Normal file
@ -0,0 +1,99 @@
|
||||
EESchema-LIBRARY Version 2.3 Date: Вт 11 фев 2014 17:26:38
|
||||
#encoding utf-8
|
||||
#
|
||||
# STM8S003K3T
|
||||
#
|
||||
DEF STM8S003K3T IC 0 40 Y Y 1 F N
|
||||
F0 "IC" -800 1150 60 H V C CNN
|
||||
F1 "STM8S003K3T" 550 -1100 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
$FPLIST
|
||||
LQFP32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -850 1100 850 -1050 0 1 10 f
|
||||
X NRST 1 -1000 1000 149 R 40 40 1 1 I
|
||||
X OSCI/PA1 2 1000 1000 149 L 40 40 1 1 B
|
||||
X OSCOUT/PA2 3 1000 900 149 L 40 40 1 1 B
|
||||
X VSS 4 0 -1200 149 U 40 40 1 1 W
|
||||
X Vcap 5 -1000 -950 149 R 40 40 1 1 I
|
||||
X VDD 6 0 1250 149 D 40 40 1 1 W
|
||||
X [SPI_NSS]TIM2_CH3/PA3 7 1000 800 149 L 40 40 1 1 B
|
||||
X PF4 8 -1000 -350 149 R 40 40 1 1 B
|
||||
X PB7 9 1000 -50 149 L 40 40 1 1 B
|
||||
X PB6 10 1000 50 149 L 40 40 1 1 B
|
||||
X TIM1_CH3/PC3 20 1000 -400 149 L 40 40 1 1 B
|
||||
X PD5/UART1_TX 30 -1000 150 149 R 40 40 1 1 B
|
||||
X I2C_SDA/PB5 11 1000 150 149 L 40 40 1 1 B
|
||||
X CLK_CCO/TIM1_CH4/PC4 21 1000 -500 149 L 40 40 1 1 B
|
||||
X PD6/UART1_RX 31 -1000 50 149 R 40 40 1 1 B
|
||||
X I2C_SCL/PB4 12 1000 250 149 L 40 40 1 1 B
|
||||
X SPI_SCK/PC5 22 1000 -600 149 L 40 40 1 1 B
|
||||
X PD7/TLI[TIM1_CH4] 32 -1000 -50 148 R 40 40 1 1 B
|
||||
X TIM1_ETR/AIN3/PB3 13 1000 350 149 L 40 40 1 1 B
|
||||
X PI_MOSI/PC6 23 1000 -700 149 L 40 40 1 1 B
|
||||
X TIM1_CH3N/AIN2/PB2 14 1000 450 149 L 40 40 1 1 B
|
||||
X PI_MISO/PC7 24 1000 -800 149 L 40 40 1 1 B
|
||||
X TIM1_CH2N/AIN1/PB1 15 1000 550 149 L 40 40 1 1 B
|
||||
X PD0/TIM1_BKIN[CLK_CCO] 25 -1000 650 148 R 40 40 1 1 B
|
||||
X TIM1_CH1N/AIN0/PB0 16 1000 650 149 L 40 40 1 1 B
|
||||
X PD1/SWIM 26 -1000 550 149 R 40 40 1 1 B
|
||||
X PE5/SPI_NSS 17 -1000 -200 148 R 40 40 1 1 B
|
||||
X PD2[TIM2_CH3] 27 -1000 450 149 R 40 40 1 1 B
|
||||
X UART1_CK/TIM1_CH1/PC1 18 1000 -200 149 L 40 40 1 1 B
|
||||
X PD3/ADC_ETR/TIM2_CH2 28 -1000 350 149 R 40 40 1 1 B
|
||||
X TIM1_CH2/PC2 19 1000 -300 149 L 40 40 1 1 B
|
||||
X PD4/BEEP/TIM2_CH1 29 -1000 250 149 R 40 40 1 1 B
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# STM8S105K4T6C
|
||||
#
|
||||
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 1050 60 H V C CNN
|
||||
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
|
||||
F2 "~" 0 0 60 H V C CNN
|
||||
F3 "~" 0 0 60 H V C CNN
|
||||
ALIAS stm8s105*
|
||||
$FPLIST
|
||||
lqfp32*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -1100 950 1100 -750 0 1 0 N
|
||||
X NRST 1 -1400 850 300 R 50 50 1 1 I
|
||||
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
|
||||
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
|
||||
X VSS 4 -1400 550 300 R 50 50 1 1 W
|
||||
X VCAP 5 -1400 450 300 R 50 50 1 1 w
|
||||
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
|
||||
X VDDio 7 -1400 250 300 R 50 50 1 1 W
|
||||
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
|
||||
X VDDA 9 -1400 50 300 R 50 50 1 1 W
|
||||
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
|
||||
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
|
||||
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
|
||||
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
|
||||
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
|
||||
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
|
||||
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
|
||||
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
|
||||
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
|
||||
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
|
||||
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
|
||||
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
|
||||
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
|
||||
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
|
||||
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
|
||||
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
|
||||
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
|
||||
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
|
||||
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
|
||||
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
|
||||
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
|
||||
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
|
||||
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
242
stepper_independent_bin/stepper.c
Normal file
242
stepper_independent_bin/stepper.c
Normal file
@ -0,0 +1,242 @@
|
||||
/*
|
||||
* stepper.c
|
||||
*
|
||||
* Copyright 2014 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 "ports_definition.h"
|
||||
#include "stepper.h"
|
||||
|
||||
volatile int Nsteps[3]={0,0,0}; // Number of steps
|
||||
volatile int usteps[3] = {0,0,0};// microstepping counters
|
||||
U8 Motor_number = 5; // Number of motor to move, 5 -- not moving
|
||||
U16 Stepper_speed[3] = {1000,1000,1000}; // length of one MICROstep in us
|
||||
U8* Timers[3] = {0x5250, 0x5300, 0x5320}; // {&TIM1_CR1, &TIM2_CR1, &TIM3_CR1}
|
||||
U8 EPs[3] = {0,0,0}; // value of conditional stop-on-EP terminals status
|
||||
U8 Stop_on_EP[3] = {0,0,0}; // boolean: whether motor should freely move or stop on EPs
|
||||
U8 USteps = 16; // amount of microsteps on each step
|
||||
U8 StepperInfty = 0; // infinity moving
|
||||
|
||||
#define pause_motor(N) *Timers[N] &= ~TIM_CR1_CEN
|
||||
#define resume_motor(N) *Timers[N] |= TIM_CR1_CEN
|
||||
#define check_motor(N) *Timers[N] & TIM_CR1_CEN
|
||||
#define PPOUT(P, PIN) do{PORT(P, DDR) |= PIN; PORT(P, CR1) |= PIN;}while(0)
|
||||
#define _MTR(X, N) PPOUT(STP ## N ## _ ## X ## _PORT, STP ## N ## _ ## X ## _PIN)
|
||||
#define SETUP_MOTOR_PORT(X) do{_MTR(X,0); _MTR(X,1); _MTR(X,2);}while(0)
|
||||
#define TMR(a, b) CONCAT(a , b)
|
||||
#define TIMER_CONF(reg, val) do{TMR(TIM1, reg) = val; TMR(TIM2, reg) = val; TMR(TIM3, reg) = val;}while(0)
|
||||
|
||||
/**
|
||||
* Setup pins of stepper motor (all - PP out) & timers
|
||||
*/
|
||||
void setup_stepper_pins(){
|
||||
// CLK
|
||||
SETUP_MOTOR_PORT(CLK);
|
||||
// DIR
|
||||
SETUP_MOTOR_PORT(DIR);
|
||||
// EN
|
||||
SETUP_MOTOR_PORT(EN);
|
||||
// End point switches:
|
||||
SETUP_EP(0);
|
||||
SETUP_EP(1);
|
||||
SETUP_EP(2);
|
||||
/**** TIMERS (all - 1MHz, default speed - 1000 Hz) ****/
|
||||
// Motor x - timer x+1
|
||||
TIM1_PSCRH = 0; // this timer have 16 bit prescaler
|
||||
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
|
||||
TIM2_PSCR = 4;
|
||||
TIM3_PSCR = 4;
|
||||
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
|
||||
TIMER_CONF(ARRH, 0x03);
|
||||
TIMER_CONF(ARRL, 0xE8);
|
||||
// 50% duty cycle: TIM_CCR = 500 = 0x01F4
|
||||
TIMER_CONF(CCR1H, 0x01);
|
||||
TIMER_CONF(CCR1L, 0xF4);
|
||||
// channel 1 generates PWM pulses
|
||||
TIMER_CONF(CCMR1, 0x60); // OC1M = 110b - PWM mode 1 ( 1 -> 0)
|
||||
TIMER_CONF(CCER1, 1); // Channel 1 is on. Active is high
|
||||
// interrupts: update
|
||||
TIMER_CONF(IER, TIM_IER_UIE);
|
||||
// auto-reload + interrupt on overflow
|
||||
TIMER_CONF(CR1, TIM_CR1_APRE | TIM_CR1_URS);
|
||||
// enable PWM output for timer1
|
||||
TIM1_BKR |= 0x80; // MOE
|
||||
// Turn off EN
|
||||
PORT(STP0_EN_PORT, ODR) |= STP0_EN_PIN;
|
||||
PORT(STP1_EN_PORT, ODR) |= STP1_EN_PIN;
|
||||
PORT(STP2_EN_PORT, ODR) |= STP2_EN_PIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set speed of stepper motor
|
||||
* @param N - number of motor
|
||||
* @param Sps - period (in us) of one MICROstep
|
||||
*/
|
||||
void set_stepper_speed(U8 N, U16 SpS){
|
||||
U8 AH, AL, CH, CL;
|
||||
if(N > 2) return;
|
||||
Stepper_speed[N] = SpS;
|
||||
AH = SpS >> 8;
|
||||
AL = SpS & 0xff;
|
||||
SpS >>= 1; // divide to 2 - 50% duty cycle
|
||||
CH = SpS >> 8;
|
||||
CL = SpS & 0xff;
|
||||
switch(N){
|
||||
case 0:
|
||||
TIM1_ARRH = AH;
|
||||
TIM1_ARRL = AL;
|
||||
TIM1_CCR1H = CH;
|
||||
TIM1_CCR1L = CL;
|
||||
break;
|
||||
case 1:
|
||||
TIM2_ARRH = AH;
|
||||
TIM2_ARRL = AL;
|
||||
TIM2_CCR1H = CH;
|
||||
TIM2_CCR1L = CL;
|
||||
break;
|
||||
case 2:
|
||||
TIM3_ARRH = AH;
|
||||
TIM3_ARRL = AL;
|
||||
TIM3_CCR1H = CH;
|
||||
TIM3_CCR1L = CL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move motor N for 'Steps' amount of steps
|
||||
* @param N - number of motor
|
||||
* @param Steps - number of steps to move (negative value means to move CCV)
|
||||
*/
|
||||
void move_motor(U8 N, int Steps){
|
||||
if(N > 2) return;
|
||||
pause_motor(N);
|
||||
if(Steps < 0){// dir to left
|
||||
switch(N){
|
||||
case 0:
|
||||
PORT(STP0_DIR_PORT, ODR) |= STP0_DIR_PIN;
|
||||
break;
|
||||
case 1:
|
||||
PORT(STP1_DIR_PORT, ODR) |= STP1_DIR_PIN;
|
||||
break;
|
||||
case 2:
|
||||
PORT(STP2_DIR_PORT, ODR) |= STP2_DIR_PIN;
|
||||
break;
|
||||
}
|
||||
Steps *= -1;
|
||||
}
|
||||
// turn on EN
|
||||
switch(N){
|
||||
case 0:
|
||||
PORT(STP0_EN_PORT, ODR) &= ~STP0_EN_PIN;
|
||||
break;
|
||||
case 1:
|
||||
PORT(STP1_EN_PORT, ODR) &= ~STP1_EN_PIN;
|
||||
break;
|
||||
case 2:
|
||||
PORT(STP2_EN_PORT, ODR) &= ~STP2_EN_PIN;
|
||||
break;
|
||||
}
|
||||
Nsteps[N] = Steps;
|
||||
resume_motor(N);
|
||||
uart_write("move");
|
||||
printUint(&N, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop motor N
|
||||
* @param N - number of motor
|
||||
*/
|
||||
void stop_motor(U8 N){
|
||||
if(N > 2) return;
|
||||
pause_motor(N);
|
||||
switch(N){ // turn off DIR & EN
|
||||
case 0:
|
||||
PORT(STP0_DIR_PORT, ODR) &= ~STP0_DIR_PIN;
|
||||
PORT(STP0_EN_PORT, ODR) |= STP0_EN_PIN;
|
||||
break;
|
||||
case 1:
|
||||
PORT(STP1_DIR_PORT, ODR) &= ~STP1_DIR_PIN;
|
||||
PORT(STP1_EN_PORT, ODR) |= STP1_EN_PIN;
|
||||
break;
|
||||
case 2:
|
||||
PORT(STP2_DIR_PORT, ODR) &= ~STP2_DIR_PIN;
|
||||
PORT(STP2_EN_PORT, ODR) |= STP2_EN_PIN;
|
||||
break;
|
||||
}
|
||||
StepperInfty = 0; // clear infinity flag
|
||||
Nsteps[N] = 0;
|
||||
usteps[N] = 0;
|
||||
uart_write("stop");
|
||||
printUint(&N, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause or resume motor N
|
||||
* @param N - number of motor
|
||||
*/
|
||||
void pause_resume(U8 N){
|
||||
if(N > 2) return;
|
||||
if(Nsteps[N] == 0) return; // motor is stopped
|
||||
if(check_motor(N)){ // motor is running - pause
|
||||
pause_motor(N);
|
||||
uart_write("pause");
|
||||
}else{ // resume
|
||||
resume_motor(N);
|
||||
uart_write("resume");
|
||||
}
|
||||
printUint(&N, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current value of EP switches
|
||||
* @param N - number of motor
|
||||
* @return value of EPs
|
||||
*/
|
||||
U8 get_ep_value(U8 N){
|
||||
U8 val = 0;
|
||||
switch(N){
|
||||
case 0:
|
||||
val = READ_EP(0);
|
||||
break;
|
||||
case 1:
|
||||
val = READ_EP(1);
|
||||
break;
|
||||
case 2:
|
||||
val = READ_EP(2);
|
||||
break;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for "stop-on-EP" condition
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void check_EP(){
|
||||
U8 i;
|
||||
for(i = 0; i < 3; i++){
|
||||
if(Stop_on_EP[i] == 0) continue;
|
||||
if(EPs[i] == get_ep_value(i)){
|
||||
stop_motor(i);
|
||||
uart_write("endpoint\n");
|
||||
// Stop_on_EP[i] = 0; // reset off-condition
|
||||
}
|
||||
}
|
||||
}
|
||||
47
stepper_independent_bin/stepper.h
Normal file
47
stepper_independent_bin/stepper.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* stepper.h
|
||||
*
|
||||
* Copyright 2014 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 "ports_definition.h"
|
||||
#include "main.h"
|
||||
|
||||
extern volatile int Nsteps[];
|
||||
extern volatile int usteps[];
|
||||
extern U16 Stepper_speed[];
|
||||
extern U8 EPs[];
|
||||
extern U8 Stop_on_EP[];
|
||||
extern U8 USteps;
|
||||
extern U8 StepperInfty;
|
||||
|
||||
void setup_stepper_pins();
|
||||
void set_stepper_speed(U8 N, U16 SpS);
|
||||
void move_motor(U8 N, int Steps);
|
||||
void stop_motor(U8 N);
|
||||
void pause_resume(U8 N);
|
||||
|
||||
U8 get_ep_value(U8 N);
|
||||
|
||||
void check_EP();
|
||||
|
||||
#endif // __STEPPER_H__
|
||||
BIN
stepper_independent_bin/testproj.bin
Normal file
BIN
stepper_independent_bin/testproj.bin
Normal file
Binary file not shown.
395
stm8l.h
Normal file
395
stm8l.h
Normal file
@ -0,0 +1,395 @@
|
||||
/*
|
||||
* stm8l.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __STM8L_H__
|
||||
#define __STM8L_H__
|
||||
|
||||
typedef unsigned char U8;
|
||||
typedef unsigned int U16;
|
||||
#define NULL (void*)0
|
||||
|
||||
/* functions */
|
||||
#define enableInterrupts() {__asm__("rim\n");} // enable interrupts
|
||||
#define disableInterrupts() {__asm__("sim\n");} // disable interrupts
|
||||
#define iret() {__asm__("iret\n");} // Interrupt routine return
|
||||
#define pop_ccr() {__asm__("pop cc\n");} // Pop CCR from the stack
|
||||
#define push_ccr() {__asm__("push cc\n");}// Push CCR on the stack
|
||||
#define rim() {__asm__("rim\n");} // enable interrupts
|
||||
#define sim() {__asm__("sim\n");} // disable interrupts
|
||||
#define nop() {__asm__("nop\n");} // No Operation
|
||||
#define trap() {__asm__("trap\n");} // Trap (soft IT)
|
||||
#define wfi() {__asm__("wfi\n");} // Wait For Interrupt
|
||||
#define halt() {__asm__("halt\n");} // Halt
|
||||
|
||||
/*
|
||||
* Registers map is shown in short datasheet, page 26
|
||||
*/
|
||||
/* GPIO */
|
||||
#define PA_ODR *(unsigned char*)0x5000
|
||||
#define PA_IDR *(unsigned char*)0x5001
|
||||
#define PA_DDR *(unsigned char*)0x5002
|
||||
#define PA_CR1 *(unsigned char*)0x5003
|
||||
#define PA_CR2 *(unsigned char*)0x5004
|
||||
|
||||
#define PB_ODR *(unsigned char*)0x5005
|
||||
#define PB_IDR *(unsigned char*)0x5006
|
||||
#define PB_DDR *(unsigned char*)0x5007
|
||||
#define PB_CR1 *(unsigned char*)0x5008
|
||||
#define PB_CR2 *(unsigned char*)0x5009
|
||||
|
||||
#define PC_ODR *(unsigned char*)0x500A
|
||||
#define PC_IDR *(unsigned char*)0x500B
|
||||
#define PC_DDR *(unsigned char*)0x500C
|
||||
#define PC_CR1 *(unsigned char*)0x500D
|
||||
#define PC_CR2 *(unsigned char*)0x500E
|
||||
|
||||
#define PD_ODR *(unsigned char*)0x500F
|
||||
#define PD_IDR *(unsigned char*)0x5010
|
||||
#define PD_DDR *(unsigned char*)0x5011
|
||||
#define PD_CR1 *(unsigned char*)0x5012
|
||||
#define PD_CR2 *(unsigned char*)0x5013
|
||||
|
||||
#define PE_ODR *(unsigned char*)0x5014
|
||||
#define PE_IDR *(unsigned char*)0x5015
|
||||
#define PE_DDR *(unsigned char*)0x5016
|
||||
#define PE_CR1 *(unsigned char*)0x5017
|
||||
#define PE_CR2 *(unsigned char*)0x5018
|
||||
|
||||
#define PF_ODR *(unsigned char*)0x5019
|
||||
#define PF_IDR *(unsigned char*)0x501A
|
||||
#define PF_DDR *(unsigned char*)0x501B
|
||||
#define PF_CR1 *(unsigned char*)0x501C
|
||||
#define PF_CR2 *(unsigned char*)0x501D
|
||||
|
||||
#ifdef STM8S105
|
||||
#define PG_ODR *(unsigned char*)0x501E
|
||||
#define PG_IDR *(unsigned char*)0x501F
|
||||
#define PG_DDR *(unsigned char*)0x5020
|
||||
#define PG_CR1 *(unsigned char*)0x5021
|
||||
#define PG_CR2 *(unsigned char*)0x5022
|
||||
|
||||
#define PH_ODR *(unsigned char*)0x5023
|
||||
#define PH_IDR *(unsigned char*)0x5024
|
||||
#define PH_DDR *(unsigned char*)0x5025
|
||||
#define PH_CR1 *(unsigned char*)0x5026
|
||||
#define PH_CR2 *(unsigned char*)0x5027
|
||||
|
||||
#define PI_ODR *(unsigned char*)0x5028
|
||||
#define PI_IDR *(unsigned char*)0x5029
|
||||
#define PI_DDR *(unsigned char*)0x502A
|
||||
#define PI_CR1 *(unsigned char*)0x502B
|
||||
#define PI_CR2 *(unsigned char*)0x502C
|
||||
#endif // STM8S105
|
||||
|
||||
/* GPIO bits */
|
||||
#define GPIO_PIN0 (1 << 0)
|
||||
#define GPIO_PIN1 (1 << 1)
|
||||
#define GPIO_PIN2 (1 << 2)
|
||||
#define GPIO_PIN3 (1 << 3)
|
||||
#define GPIO_PIN4 (1 << 4)
|
||||
#define GPIO_PIN5 (1 << 5)
|
||||
#define GPIO_PIN6 (1 << 6)
|
||||
#define GPIO_PIN7 (1 << 7)
|
||||
|
||||
|
||||
/* CLOCK */
|
||||
#define CLK_ICKR *(unsigned char*)0x50C0
|
||||
#define CLK_ECKR *(unsigned char*)0x50C1
|
||||
#define CLK_CMSR *(unsigned char*)0x50C3
|
||||
#define CLK_SWR *(unsigned char*)0x50C4
|
||||
#define CLK_SWCR *(unsigned char*)0x50C5
|
||||
#define CLK_CKDIVR *(unsigned char*)0x50C6
|
||||
#define CLK_SPCKENR1 *(unsigned char*)0x50C7
|
||||
#define CLK_CSSR *(unsigned char*)0x50C8
|
||||
#define CLK_CCOR *(unsigned char*)0x50C9
|
||||
#define CLK_PCKENR2 *(unsigned char*)0x50CA
|
||||
#define CLK_HSITRIMR *(unsigned char*)0x50CC
|
||||
#define CLK_SWIMCCR *(unsigned char*)0x50CD
|
||||
|
||||
|
||||
|
||||
/* ------------------- UART ------------------- */
|
||||
#ifdef STM8S003
|
||||
#define UART1_SR *(unsigned char*)0x5230
|
||||
#define UART1_DR *(unsigned char*)0x5231
|
||||
#define UART1_BRR1 *(unsigned char*)0x5232
|
||||
#define UART1_BRR2 *(unsigned char*)0x5233
|
||||
#define UART1_CR1 *(unsigned char*)0x5234
|
||||
#define UART1_CR2 *(unsigned char*)0x5235
|
||||
#define UART1_CR3 *(unsigned char*)0x5236
|
||||
#define UART1_CR4 *(unsigned char*)0x5237
|
||||
#define UART1_CR5 *(unsigned char*)0x5238
|
||||
#define UART1_GTR *(unsigned char*)0x5239
|
||||
#define UART1_PSCR *(unsigned char*)0x523A
|
||||
#endif // STM8S003
|
||||
#ifdef STM8S105
|
||||
#define UART2_SR *(unsigned char*)0x5240
|
||||
#define UART2_DR *(unsigned char*)0x5241
|
||||
#define UART2_BRR1 *(unsigned char*)0x5242
|
||||
#define UART2_BRR2 *(unsigned char*)0x5243
|
||||
#define UART2_CR1 *(unsigned char*)0x5244
|
||||
#define UART2_CR2 *(unsigned char*)0x5245
|
||||
#define UART2_CR3 *(unsigned char*)0x5246
|
||||
#define UART2_CR4 *(unsigned char*)0x5247
|
||||
#define UART2_CR5 *(unsigned char*)0x5248
|
||||
#define UART2_CR6 *(unsigned char*)0x5249
|
||||
#define UART2_GTR *(unsigned char*)0x524A
|
||||
#define UART2_PSCR *(unsigned char*)0x524B
|
||||
#endif // STM8S105
|
||||
|
||||
/* UART_CR1 bits */
|
||||
#define UART_CR1_R8 (1 << 7)
|
||||
#define UART_CR1_T8 (1 << 6)
|
||||
#define UART_CR1_UARTD (1 << 5)
|
||||
#define UART_CR1_M (1 << 4)
|
||||
#define UART_CR1_WAKE (1 << 3)
|
||||
#define UART_CR1_PCEN (1 << 2)
|
||||
#define UART_CR1_PS (1 << 1)
|
||||
#define UART_CR1_PIEN (1 << 0)
|
||||
|
||||
/* UART_CR2 bits */
|
||||
#define UART_CR2_TIEN (1 << 7)
|
||||
#define UART_CR2_TCIEN (1 << 6)
|
||||
#define UART_CR2_RIEN (1 << 5)
|
||||
#define UART_CR2_ILIEN (1 << 4)
|
||||
#define UART_CR2_TEN (1 << 3)
|
||||
#define UART_CR2_REN (1 << 2)
|
||||
#define UART_CR2_RWU (1 << 1)
|
||||
#define UART_CR2_SBK (1 << 0)
|
||||
|
||||
/* USART_CR3 bits */
|
||||
#define UART_CR3_LINEN (1 << 6)
|
||||
#define UART_CR3_STOP2 (1 << 5)
|
||||
#define UART_CR3_STOP1 (1 << 4)
|
||||
#define UART_CR3_CLKEN (1 << 3)
|
||||
#define UART_CR3_CPOL (1 << 2)
|
||||
#define UART_CR3_CPHA (1 << 1)
|
||||
#define UART_CR3_LBCL (1 << 0)
|
||||
|
||||
/* UART_SR bits */
|
||||
#define UART_SR_TXE (1 << 7)
|
||||
#define UART_SR_TC (1 << 6)
|
||||
#define UART_SR_RXNE (1 << 5)
|
||||
#define UART_SR_IDLE (1 << 4)
|
||||
#define UART_SR_OR (1 << 3)
|
||||
#define UART_SR_NF (1 << 2)
|
||||
#define UART_SR_FE (1 << 1)
|
||||
#define UART_SR_PE (1 << 0)
|
||||
|
||||
|
||||
/* ------------------- TIMERS ------------------- */
|
||||
/* TIM1 */
|
||||
#define TIM1_CR1 *(unsigned char*)0x5250
|
||||
#define TIM1_CR2 *(unsigned char*)0x5251
|
||||
#define TIM1_SMCR *(unsigned char*)0x5252
|
||||
#define TIM1_ETR *(unsigned char*)0x5253
|
||||
#define TIM1_IER *(unsigned char*)0x5254
|
||||
#define TIM1_SR1 *(unsigned char*)0x5255
|
||||
#define TIM1_SR2 *(unsigned char*)0x5256
|
||||
#define TIM1_EGR *(unsigned char*)0x5257
|
||||
#define TIM1_CCMR1 *(unsigned char*)0x5258
|
||||
#define TIM1_CCMR2 *(unsigned char*)0x5259
|
||||
#define TIM1_CCMR3 *(unsigned char*)0x525A
|
||||
#define TIM1_CCMR4 *(unsigned char*)0x525B
|
||||
#define TIM1_CCER1 *(unsigned char*)0x525C
|
||||
#define TIM1_CCER2 *(unsigned char*)0x525D
|
||||
#define TIM1_CNTRH *(unsigned char*)0x525E
|
||||
#define TIM1_CNTRL *(unsigned char*)0x525F
|
||||
#define TIM1_PSCRH *(unsigned char*)0x5260
|
||||
#define TIM1_PSCRL *(unsigned char*)0x5261
|
||||
#define TIM1_ARRH *(unsigned char*)0x5262
|
||||
#define TIM1_ARRL *(unsigned char*)0x5263
|
||||
#define TIM1_RCR *(unsigned char*)0x5264
|
||||
#define TIM1_CCR1H *(unsigned char*)0x5265
|
||||
#define TIM1_CCR1L *(unsigned char*)0x5266
|
||||
#define TIM1_CCR2H *(unsigned char*)0x5267
|
||||
#define TIM1_CCR2L *(unsigned char*)0x5268
|
||||
#define TIM1_CCR3H *(unsigned char*)0x5269
|
||||
#define TIM1_CCR3L *(unsigned char*)0x526A
|
||||
#define TIM1_CCR4H *(unsigned char*)0x526B
|
||||
#define TIM1_CCR4L *(unsigned char*)0x526C
|
||||
#define TIM1_BKR *(unsigned char*)0x526D
|
||||
#define TIM1_DTR *(unsigned char*)0x526E
|
||||
#define TIM1_OISR *(unsigned char*)0x526F
|
||||
|
||||
|
||||
/* TIM_IER bits */
|
||||
#define TIM_IER_BIE (1 << 7)
|
||||
#define TIM_IER_TIE (1 << 6)
|
||||
#define TIM_IER_COMIE (1 << 5)
|
||||
#define TIM_IER_CC4IE (1 << 4)
|
||||
#define TIM_IER_CC3IE (1 << 3)
|
||||
#define TIM_IER_CC2IE (1 << 2)
|
||||
#define TIM_IER_CC1IE (1 << 1)
|
||||
#define TIM_IER_UIE (1 << 0)
|
||||
|
||||
/* TIM_CR1 bits */
|
||||
#define TIM_CR1_APRE (1 << 7)
|
||||
#define TIM_CR1_CMSH (1 << 6)
|
||||
#define TIM_CR1_CMSL (1 << 5)
|
||||
#define TIM_CR1_DIR (1 << 4)
|
||||
#define TIM_CR1_OPM (1 << 3)
|
||||
#define TIM_CR1_URS (1 << 2)
|
||||
#define TIM_CR1_UDIS (1 << 1)
|
||||
#define TIM_CR1_CEN (1 << 0)
|
||||
|
||||
/* TIM_SR1 bits */
|
||||
#define TIM_SR1_BIF (1 << 7)
|
||||
#define TIM_SR1_TIF (1 << 6)
|
||||
#define TIM_SR1_COMIF (1 << 5)
|
||||
#define TIM_SR1_CC4IF (1 << 4)
|
||||
#define TIM_SR1_CC3IF (1 << 3)
|
||||
#define TIM_SR1_CC2IF (1 << 2)
|
||||
#define TIM_SR1_CC1IF (1 << 1)
|
||||
#define TIM_SR1_UIF (1 << 0)
|
||||
|
||||
/* TIM2 */
|
||||
#define TIM2_CR1 *(unsigned char*)0x5300
|
||||
#define TIM2_IER *(unsigned char*)0x5301
|
||||
#define TIM2_SR1 *(unsigned char*)0x5302
|
||||
#define TIM2_SR2 *(unsigned char*)0x5303
|
||||
#define TIM2_EGR *(unsigned char*)0x5304
|
||||
#define TIM2_CCMR1 *(unsigned char*)0x5305
|
||||
#define TIM2_CCMR2 *(unsigned char*)0x5306
|
||||
#define TIM2_CCMR3 *(unsigned char*)0x5307
|
||||
#define TIM2_CCER1 *(unsigned char*)0x5308
|
||||
#define TIM2_CCER2 *(unsigned char*)0x5309
|
||||
#define TIM2_CNTRH *(unsigned char*)0x530A
|
||||
#define TIM2_CNTRL *(unsigned char*)0x530B
|
||||
#define TIM2_PSCR *(unsigned char*)0x530C
|
||||
#define TIM2_ARRH *(unsigned char*)0x530D
|
||||
#define TIM2_ARRL *(unsigned char*)0x530E
|
||||
#define TIM2_CCR1H *(unsigned char*)0x530F
|
||||
#define TIM2_CCR1L *(unsigned char*)0x5310
|
||||
#define TIM2_CCR2H *(unsigned char*)0x5311
|
||||
#define TIM2_CCR2L *(unsigned char*)0x5312
|
||||
#define TIM2_CCR3H *(unsigned char*)0x5313
|
||||
#define TIM2_CCR3L *(unsigned char*)0x5314
|
||||
|
||||
/* TIM3 */
|
||||
#define TIM3_CR1 *(unsigned char*)0x5320
|
||||
#define TIM3_IER *(unsigned char*)0x5321
|
||||
#define TIM3_SR1 *(unsigned char*)0x5322
|
||||
#define TIM3_SR2 *(unsigned char*)0x5323
|
||||
#define TIM3_EGR *(unsigned char*)0x5324
|
||||
#define TIM3_CCMR1 *(unsigned char*)0x5325
|
||||
#define TIM3_CCMR2 *(unsigned char*)0x5326
|
||||
#define TIM3_CCER1 *(unsigned char*)0x5327
|
||||
#define TIM3_CNTRH *(unsigned char*)0x5328
|
||||
#define TIM3_CNTRL *(unsigned char*)0x5329
|
||||
#define TIM3_PSCR *(unsigned char*)0x532A
|
||||
#define TIM3_ARRH *(unsigned char*)0x532B
|
||||
#define TIM3_ARRL *(unsigned char*)0x532C
|
||||
#define TIM3_CCR1H *(unsigned char*)0x532D
|
||||
#define TIM3_CCR1L *(unsigned char*)0x532E
|
||||
#define TIM3_CCR2H *(unsigned char*)0x532F
|
||||
#define TIM3_CCR2L *(unsigned char*)0x5330
|
||||
|
||||
/* TIM4 */
|
||||
#define TIM4_CR1 *(unsigned char*)0x5340
|
||||
#define TIM4_IER *(unsigned char*)0x5341
|
||||
#define TIM4_SR *(unsigned char*)0x5342
|
||||
#define TIM4_EGR *(unsigned char*)0x5343
|
||||
#define TIM4_CNTR *(unsigned char*)0x5344
|
||||
#define TIM4_PSCR *(unsigned char*)0x5345
|
||||
#define TIM4_ARR *(unsigned char*)0x5346
|
||||
|
||||
/* ------------------- ADC ------------------- */
|
||||
#define ADC_DB0RH *(unsigned char*)0x53E0
|
||||
#define ADC_DB0RL *(unsigned char*)0x53E1
|
||||
#define ADC_DB1RH *(unsigned char*)0x53E2
|
||||
#define ADC_DB1RL *(unsigned char*)0x53E3
|
||||
#define ADC_DB2RH *(unsigned char*)0x53E4
|
||||
#define ADC_DB2RL *(unsigned char*)0x53E5
|
||||
#define ADC_DB3RH *(unsigned char*)0x53E6
|
||||
#define ADC_DB3RL *(unsigned char*)0x53E7
|
||||
#define ADC_DB4RH *(unsigned char*)0x53E8
|
||||
#define ADC_DB4RL *(unsigned char*)0x53E9
|
||||
#define ADC_DB5RH *(unsigned char*)0x53EA
|
||||
#define ADC_DB5RL *(unsigned char*)0x53EB
|
||||
#define ADC_DB6RH *(unsigned char*)0x53EC
|
||||
#define ADC_DB6RL *(unsigned char*)0x53ED
|
||||
#define ADC_DB7RH *(unsigned char*)0x53EE
|
||||
#define ADC_DB7RL *(unsigned char*)0x53EF
|
||||
#define ADC_DB8RH *(unsigned char*)0x53F0
|
||||
#define ADC_DB8RL *(unsigned char*)0x53F1
|
||||
#define ADC_DB9RH *(unsigned char*)0x53F2
|
||||
#define ADC_DB9RL *(unsigned char*)0x53F3
|
||||
#define ADC_CSR *(unsigned char*)0x5400
|
||||
#define ADC_CR1 *(unsigned char*)0x5401
|
||||
#define ADC_CR2 *(unsigned char*)0x5402
|
||||
#define ADC_CR3 *(unsigned char*)0x5403
|
||||
#define ADC_DRH *(unsigned char*)0x5404
|
||||
#define ADC_DRL *(unsigned char*)0x5405
|
||||
#define ADC_TDRH *(unsigned char*)0x5406
|
||||
#define ADC_TDRL *(unsigned char*)0x5407
|
||||
#define ADC_HTRH *(unsigned char*)0x5408
|
||||
#define ADC_HTRL *(unsigned char*)0x5409
|
||||
#define ADC_LTRH *(unsigned char*)0x540A
|
||||
#define ADC_LTRL *(unsigned char*)0x540B
|
||||
#define ADC_AWSRH *(unsigned char*)0x540C
|
||||
#define ADC_AWSRL *(unsigned char*)0x540D
|
||||
#define ADC_AWCRH *(unsigned char*)0x540E
|
||||
#define ADC_AWCRL *(unsigned char*)0x540F
|
||||
|
||||
/* ------------------- swim control ------------------- */
|
||||
#define CFG_GCR *(unsigned char*)0x7F60
|
||||
|
||||
/* -------------------- UNIQUE ID -------------------- */
|
||||
#if defined STM8S105 || defined STM8S103 // maybe some other MCU have this too???
|
||||
#define U_ID00 (unsigned char*)0x48CD
|
||||
#define U_ID01 (unsigned char*)0x48CE
|
||||
#define U_ID02 (unsigned char*)0x48CF
|
||||
#define U_ID03 (unsigned char*)0x48D0
|
||||
#define U_ID04 (unsigned char*)0x48D1
|
||||
#define U_ID05 (unsigned char*)0x48D2
|
||||
#define U_ID06 (unsigned char*)0x48D3
|
||||
#define U_ID07 (unsigned char*)0x48D4
|
||||
#define U_ID08 (unsigned char*)0x48D5
|
||||
#define U_ID09 (unsigned char*)0x48D6
|
||||
#define U_ID10 (unsigned char*)0x48D7
|
||||
#define U_ID11 (unsigned char*)0x48D8
|
||||
#endif // defined STM8S105 || defined STM8S103
|
||||
|
||||
/* -------------------- FLASH/EEPROM -------------------- */
|
||||
#define FLASH_CR1 *(unsigned char*)0x505A
|
||||
#define FLASH_CR2 *(unsigned char*)0x505B
|
||||
#define FLASH_NCR2 *(unsigned char*)0x505C
|
||||
#define FLASH_FPR *(unsigned char*)0x505D
|
||||
#define FLASH_NFPR *(unsigned char*)0x505E
|
||||
#define FLASH_IAPSR *(unsigned char*)0x505F
|
||||
#define FLASH_PUKR *(unsigned char*)0x5062 // progmem unprotection
|
||||
#define FLASH_DUKR *(unsigned char*)0x5064 // EEPROM unprotection
|
||||
|
||||
#define EEPROM_KEY1 0xAE // keys to manage EEPROM's write access
|
||||
#define EEPROM_KEY2 0x56
|
||||
|
||||
/* ------------------- interrupts ------------------- */
|
||||
#define EXTI_CR1 *(unsigned char*)0x50A0
|
||||
#define EXTI_CR2 *(unsigned char*)0x50A1
|
||||
#define INTERRUPT_HANDLER(fn, num) void fn() __interrupt(num)
|
||||
#define INTERRUPT_DEFINITION(fn, num) extern void fn() __interrupt(num)
|
||||
// CCR REGISTER: bits 3&5 should be 1 if you wanna change EXTI_CRx
|
||||
#define CCR *(unsigned char*)0x7F0A
|
||||
|
||||
#endif // __STM8L_H__
|
||||
BIN
zakwire.tgz
Normal file
BIN
zakwire.tgz
Normal file
Binary file not shown.
39
zakwire/Makefile
Normal file
39
zakwire/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
NAME=testproj
|
||||
SDCC=sdcc
|
||||
HEX2BIN=hex2bin
|
||||
|
||||
CCFLAGS=-DSTM8S003 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
|
||||
LDFLAGS= -lstm8 -mstm8 --out-fmt-ihx
|
||||
FLASHFLAGS=-cstlinkv2 -pstm8s003
|
||||
|
||||
SRC=$(wildcard *.c)
|
||||
# ATTENTION: FIRST in list should be file with main()
|
||||
OBJ=$(SRC:%.c=%.rel)
|
||||
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
|
||||
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
|
||||
INDEPENDENT_HEADERS=../stm8l.h Makefile
|
||||
|
||||
all: $(NAME).bin
|
||||
|
||||
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
|
||||
@touch $@
|
||||
@echo $@
|
||||
|
||||
%.h: ;
|
||||
|
||||
clean:
|
||||
rm -f $(TRASH)
|
||||
|
||||
load: $(NAME).bin
|
||||
stm8flash $(FLASHFLAGS) -wf $(NAME).bin
|
||||
|
||||
%.rel: %.c
|
||||
$(SDCC) $(CCFLAGS) -c $<
|
||||
|
||||
$(NAME).ihx: $(OBJ)
|
||||
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
|
||||
|
||||
$(NAME).bin: $(NAME).ihx
|
||||
$(HEX2BIN) -p 00 $<
|
||||
|
||||
.PHONY: all
|
||||
176
zakwire/interrupts.c
Normal file
176
zakwire/interrupts.c
Normal file
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* interrupts.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "interrupts.h"
|
||||
#include "zacwire.h"
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){}
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){}
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){}
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
|
||||
if((PD_IDR & GPIO_PIN3) == 0){ // next bit start
|
||||
// TIM2_SR1 = 0;
|
||||
// TIM2_CR1 = TIM_CR1_OPM | TIM_CR1_CEN;
|
||||
PD_CR2 &= ~GPIO_PIN3;
|
||||
ZW_catch_bit();
|
||||
};
|
||||
}
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
|
||||
if(TIM1_SR1 & TIM_SR1_UIF){ // update interrupt
|
||||
Global_time++; // increase timer
|
||||
}
|
||||
TIM1_SR1 = 0; // clear all interrupt flags
|
||||
}
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){}
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
// store the current counter value and wait for next pulse
|
||||
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
|
||||
/*
|
||||
TIM2_CR1 = 0; // stop timer
|
||||
if(TIM2_SR2){ // overcapture: noice etc.
|
||||
TIM2_SR2 = 0;
|
||||
TIM2_SR1 = 0;
|
||||
ZW_off();
|
||||
return;
|
||||
}
|
||||
ZW_catch_bit();
|
||||
TIM2_SR1 = 0;
|
||||
TIM2_CNTRH = 0;
|
||||
TIM2_CNTRL = 0;
|
||||
*/
|
||||
}
|
||||
/*
|
||||
TIM2_CCMR2 = 1; // IC2 is mapped on TI2FP2
|
||||
TIM2_CCMR1 = 2; // IC1 is mapped on TI2FP1
|
||||
*/
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){}
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){}
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
|
||||
#else
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
|
||||
ADC_value = ADC_DRL; // in right-alignment mode we should first read LSB
|
||||
ADC_value |= ADC_DRH << 8;
|
||||
ADC_CSR &= 0x3f; // clear EOC & AWD flags
|
||||
}
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){}
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}
|
||||
147
zakwire/interrupts.h
Normal file
147
zakwire/interrupts.h
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* interrupts.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __INTERRUPTS_H__
|
||||
#define __INTERRUPTS_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
extern unsigned long Global_time; // global time in ms
|
||||
extern int ADC_value; // value of last ADC measurement
|
||||
|
||||
// Top Level Interrupt
|
||||
INTERRUPT_DEFINITION(TLI_IRQHandler, 0);
|
||||
|
||||
// Auto Wake Up Interrupt
|
||||
INTERRUPT_DEFINITION(AWU_IRQHandler, 1);
|
||||
|
||||
// Clock Controller Interrupt
|
||||
INTERRUPT_DEFINITION(CLK_IRQHandler, 2);
|
||||
|
||||
// External Interrupt PORTA
|
||||
INTERRUPT_DEFINITION(EXTI_PORTA_IRQHandler, 3);
|
||||
|
||||
// External Interrupt PORTB
|
||||
INTERRUPT_DEFINITION(EXTI_PORTB_IRQHandler, 4);
|
||||
|
||||
// External Interrupt PORTC
|
||||
INTERRUPT_DEFINITION(EXTI_PORTC_IRQHandler, 5);
|
||||
|
||||
// External Interrupt PORTD
|
||||
INTERRUPT_DEFINITION(EXTI_PORTD_IRQHandler, 6);
|
||||
|
||||
// External Interrupt PORTE
|
||||
INTERRUPT_DEFINITION(EXTI_PORTE_IRQHandler, 7);
|
||||
|
||||
#ifdef STM8S903
|
||||
// External Interrupt PORTF
|
||||
INTERRUPT_DEFINITION(EXTI_PORTF_IRQHandler, 8);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined (STM8AF52Ax)
|
||||
// CAN RX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_RX_IRQHandler, 8);
|
||||
|
||||
// CAN TX Interrupt routine.
|
||||
INTERRUPT_DEFINITION(CAN_TX_IRQHandler, 9);
|
||||
#endif // STM8S208 || STM8AF52Ax
|
||||
|
||||
// SPI Interrupt routine.
|
||||
INTERRUPT_DEFINITION(SPI_IRQHandler, 10);
|
||||
|
||||
// Timer1 Update/Overflow/Trigger/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11);
|
||||
|
||||
// Timer1 Capture/Compare Interrupt routine.
|
||||
INTERRUPT_DEFINITION(TIM1_CAP_COM_IRQHandler, 12);
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer5 Update/Overflow/Break/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13);
|
||||
|
||||
// Timer5 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM5_CAP_COM_IRQHandler, 14);
|
||||
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
// Timer2 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_UPD_OVF_BRK_IRQHandler, 13);
|
||||
|
||||
// Timer2 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM2_CAP_COM_IRQHandler, 14);
|
||||
#endif // STM8S903
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
|
||||
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
|
||||
// Timer3 Update/Overflow/Break Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_UPD_OVF_BRK_IRQHandler, 15);
|
||||
|
||||
// Timer3 Capture/Compare Interrupt
|
||||
INTERRUPT_DEFINITION(TIM3_CAP_COM_IRQHandler, 16);
|
||||
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
|
||||
|
||||
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
|
||||
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
|
||||
// UART1 TX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_TX_IRQHandler, 17);
|
||||
|
||||
// UART1 RX Interrupt
|
||||
INTERRUPT_DEFINITION(UART1_RX_IRQHandler, 18);
|
||||
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
|
||||
|
||||
// I2C Interrupt
|
||||
INTERRUPT_DEFINITION(I2C_IRQHandler, 19);
|
||||
|
||||
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
|
||||
// UART2 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_TX_IRQHandler, 20);
|
||||
|
||||
// UART2 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART2_RX_IRQHandler, 21);
|
||||
#endif // STM8S105 or STM8AF626x
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// UART3 TX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_TX_IRQHandler, 20);
|
||||
|
||||
// UART3 RX interrupt
|
||||
INTERRUPT_DEFINITION(UART3_RX_IRQHandler, 21);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
|
||||
// ADC2 interrupt
|
||||
INTERRUPT_DEFINITION(ADC2_IRQHandler, 22);
|
||||
#else // STM8S105, STM8S103 or STM8S903 or STM8AF626x
|
||||
// ADC1 interrupt
|
||||
INTERRUPT_DEFINITION(ADC1_IRQHandler, 22);
|
||||
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
|
||||
|
||||
#ifdef STM8S903
|
||||
// Timer6 Update/Overflow/Trigger Interrupt
|
||||
INTERRUPT_DEFINITION(TIM6_UPD_OVF_TRG_IRQHandler, 23);
|
||||
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
|
||||
// Timer4 Update/Overflow Interrupt
|
||||
INTERRUPT_DEFINITION(TIM4_UPD_OVF_IRQHandler, 23);
|
||||
#endif // STM8S903
|
||||
|
||||
// Eeprom EEC Interrupt
|
||||
INTERRUPT_DEFINITION(EEPROM_EEC_IRQHandler, 24);
|
||||
|
||||
#endif // __INTERRUPTS_H__
|
||||
258
zakwire/led.c
Normal file
258
zakwire/led.c
Normal file
@ -0,0 +1,258 @@
|
||||
/*
|
||||
* led.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "led.h"
|
||||
|
||||
/*
|
||||
* bits no 7 6 5 4 3 2 1 0
|
||||
* dec value 128 64 32 16 8 4 2 1
|
||||
*/
|
||||
|
||||
/********** one variant **********/
|
||||
/*
|
||||
* One digit: TABLE:
|
||||
* ***A*** 0 1 2 3 4 5 6 7 8 9 A B C D E F - h
|
||||
* * * (A) PB4 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1
|
||||
* F B (F) PB5 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0
|
||||
* * * (B) PC5 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1
|
||||
* ***G*** (G) PC6 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
|
||||
* * * (C) PC7 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0
|
||||
* E C (E) PD1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0
|
||||
* * * ** (D) PD2 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1
|
||||
* ***D*** *DP* (DP)PD3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
* **
|
||||
*/
|
||||
/*
|
||||
// PB, mask: 0x30, PB4: 0x10, PB5: 0x20
|
||||
#define PB_BLANK 0x30
|
||||
static U8 PB_bits[18] = {0,0x30,0x20,0x20,0x10,0,0,0x20,0,0,0,0x10,0,0x30,0,0,0x30,0x10};
|
||||
// PC, mask: 0xe0, PC5: 0x20, PC6: 0x40, PC7: 0x80
|
||||
#defin PC_BLANK 0xe0
|
||||
static U8 PC_bits[18] = {0x40,0x40,0x80,0,0,0x20,0x20,0x40,0,0,0,0x20,0xe0,0,0xa0,0xa0,0xa0,0x20};
|
||||
// PD, mask: 0x0e, PD1: 0x02, PD2: 0x04, PD3: 0x08
|
||||
#define PD_BLANK 0x0e
|
||||
static U8 PD_bits[18] = {0x08,0x0e,0x08,0x0a,0x0e,0x0a,0x08,0x0e,0x08,0x0a,0x0c,0x8,0x08,0x08,0x08,0x0c,0x0e,0x0c};
|
||||
*/
|
||||
/*
|
||||
* Number of digit on indicator with common anode
|
||||
* digis 0..3: PC3, PC4, PA3, PD4
|
||||
*/
|
||||
|
||||
|
||||
/********** current variant **********/
|
||||
/*
|
||||
* One digit: TABLE:
|
||||
* ***A*** 0 1 2 3 4 5 6 7 8 9 A B C D E F - h
|
||||
* * * (F) PA1 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0
|
||||
* F B (B) PB4 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1
|
||||
* * * (A) PB5 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 1
|
||||
* ***G*** (G) PC3 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
|
||||
* * * (C) PC4 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0
|
||||
* E C (DP)PC5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
* * * ** (D) PC6 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1
|
||||
* ***D*** *DP* (E) PC7 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0
|
||||
* **
|
||||
*/
|
||||
|
||||
/*
|
||||
* Number of digit on indicator with common anode
|
||||
* digis 0..3: PA3, PD6, PD4, PD1
|
||||
*/
|
||||
|
||||
/************* arrays for ports *************/
|
||||
// PA, mask: 0x02, PA1
|
||||
static U8 PA_bits[18] = {0,2,2,2,0,0,0,2,0,0,0,0,0,2,0,0,2,0};
|
||||
#define PA_BLANK 0x02
|
||||
// PB, mask: 0x30, PB4:0x10=16, PB5:0x20=32
|
||||
#define PB_BLANK 0x30
|
||||
static U8 PB_bits[18] = {0,32,0,0,32,16,16,0,0,0,0,48,16,32,16,16,48,48};
|
||||
// PC, mask: 0xF8, PC3:0x08=8, PC4:0x10=16, PC5:0x20=32, PC6:0x40=64, PC7:0x80=128
|
||||
#define PC_BLANK 0xF8
|
||||
static U8 PC_bits[18] = {40,232,48,160,224,160,32,232,32,160,96,32,56,32,48,112,240,96};
|
||||
|
||||
/**
|
||||
* Setup for writing a letter
|
||||
* @param ltr - letter (0..17 for 0..F, - or h | 0x80 for DP, any other value for 'space')
|
||||
*/
|
||||
void write_letter(U8 ltr){
|
||||
U8 L = ltr & 0x7f;
|
||||
// first turn all off
|
||||
PD_ODR &= ~(GPIO_PIN1|GPIO_PIN4|GPIO_PIN6); // turn off other letters
|
||||
PA_ODR &= ~(PA_BLANK | GPIO_PIN3); // light up everything
|
||||
PB_ODR &= ~PB_BLANK;
|
||||
PC_ODR &= ~PC_BLANK;
|
||||
if(L < 18){ // letter
|
||||
PA_ODR |= PA_bits[L];
|
||||
PB_ODR |= PB_bits[L];
|
||||
PC_ODR |= PC_bits[L];
|
||||
}else{ // space - turn all OFF
|
||||
PA_ODR |= PA_BLANK;
|
||||
PB_ODR |= PB_BLANK;
|
||||
PC_ODR |= PC_BLANK;
|
||||
}
|
||||
if(ltr & 0x80){ // DP
|
||||
PC_ODR &= ~GPIO_PIN5;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on anode power for digit N (0..3: PA3, PD6, PD4, PD1 -- A0x08, D0x40, D0x10, D0x02)
|
||||
* @param N - number of digit (0..3), if other - no action (display off)
|
||||
* @return
|
||||
*/
|
||||
void light_up_digit(U8 N){
|
||||
switch(N){
|
||||
case 0:
|
||||
PA_ODR |= 0x08;
|
||||
break;
|
||||
case 1:
|
||||
PD_ODR |= 0x40;
|
||||
break;
|
||||
case 2:
|
||||
PD_ODR |= 0x10;
|
||||
break;
|
||||
case 3:
|
||||
PD_ODR |= 0x02;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static U8 display_buffer[4] = {' ',' ',' ',' '}; // blank by default
|
||||
static U8 N_current = 0; // current digit to display
|
||||
|
||||
/**
|
||||
* fills buffer to display
|
||||
* @param str - string to display, contains "0..f" for digits, " " for space, "." for DP
|
||||
* for example: " 1.22" or "h1ab" (something like "0...abc" equivalent to "0.abc"
|
||||
* register independent!
|
||||
* any other letter would be omitted
|
||||
* if NULL - fill buffer with spaces
|
||||
*/
|
||||
void set_display_buf(char *str){
|
||||
U8 B[4];
|
||||
char ch, M = 0, i;
|
||||
N_current = 0; // refresh current digit number
|
||||
// empty buffer
|
||||
for(i = 0; i < 4; i++)
|
||||
display_buffer[i] = ' ';
|
||||
if(!str) return;
|
||||
i = 0;
|
||||
for(;(ch = *str) && (i < 4); str++){
|
||||
M = 0;
|
||||
if(ch > '/' && ch < ':'){ // digit
|
||||
M = '0';
|
||||
}else if(ch > '`' & ch < 'g'){ // a..f
|
||||
M = 'a' - 10;
|
||||
}else if(ch > '@' & ch < 'G'){ // A..F
|
||||
M = 'A' - 10;
|
||||
}else if(ch == '-'){ // minus
|
||||
M = '-' - 16;
|
||||
}else if(ch == 'h'){ // hex
|
||||
M = 'h' - 17;
|
||||
}else if(ch == 'H'){ // hex
|
||||
M = 'H' - 17;
|
||||
}else if(ch == '.'){ // DP, set it to previous char
|
||||
if(i == 0){ // word starts from '.' - make a space with point
|
||||
B[0] = 0xff;
|
||||
}else{ // set point for previous character
|
||||
B[i-1] |= 0x80;
|
||||
}
|
||||
continue;
|
||||
}else if(ch != ' '){ // bad character - continue
|
||||
continue;
|
||||
}
|
||||
B[i] = ch - M;
|
||||
i++;
|
||||
}
|
||||
// now make align to right
|
||||
ch = 3;
|
||||
for(M = i-1; M > -1; M--, ch--){
|
||||
display_buffer[ch] = B[M];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Nth digit of buffer (function ran by timer)
|
||||
* @param N - number of digit in buffer (0..3)
|
||||
*/
|
||||
void show_buf_digit(U8 N){
|
||||
if(N > 3) return;
|
||||
write_letter(display_buffer[N]);
|
||||
light_up_digit(N);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show next digit - function calls from main() by some system time value amount
|
||||
*/
|
||||
void show_next_digit(){
|
||||
show_buf_digit(N_current++);
|
||||
if(N_current > 3) N_current = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn off current digit: to change display brightness
|
||||
*/
|
||||
void lights_off(){
|
||||
U8 N;
|
||||
if(N_current) N = N_current - 1;
|
||||
else N = 3;
|
||||
light_up_digit(N);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert integer value i into string and display it
|
||||
* @param i - value to display, -999 <= i <= 9999, if wrong, displays "---E"
|
||||
*/
|
||||
void display_int(int I){
|
||||
int rem;
|
||||
char N = 3, sign = 0;
|
||||
if(I < -999 || I > 9999){
|
||||
set_display_buf("---E");
|
||||
return;
|
||||
}
|
||||
set_display_buf(NULL); // empty buffer
|
||||
if(I == 0){ // just show zero
|
||||
display_buffer[3] = 0;
|
||||
return;
|
||||
}
|
||||
if(I < 0){
|
||||
sign = 1;
|
||||
I *= -1;
|
||||
}
|
||||
do{
|
||||
rem = I % 10;
|
||||
display_buffer[N] = rem;
|
||||
I /= 10;
|
||||
}while(--N > -1 && I);
|
||||
if(sign && N > -1) display_buffer[N] = 16; // minus sign
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* displays digital point at position i
|
||||
* @param i - position to display DP, concequent calls can light up many DPs
|
||||
*/
|
||||
void display_DP_at_pos(U8 i){
|
||||
if(i > 3) return;
|
||||
display_buffer[i] |= 0x80;
|
||||
}
|
||||
50
zakwire/led.h
Normal file
50
zakwire/led.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* led.h
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 __LED_H__
|
||||
#define __LED_H__
|
||||
|
||||
#include "stm8l.h"
|
||||
|
||||
void set_display_buf(char *str);
|
||||
void show_buf_digit(U8 N);
|
||||
void show_next_digit();
|
||||
void lights_off();
|
||||
void display_int(int i);
|
||||
void display_DP_at_pos(U8 i);
|
||||
|
||||
/**
|
||||
* Initialize ports
|
||||
* PA3, PB4|5, PC3|4|5|6|7, PD1|2|3|4
|
||||
*
|
||||
#define LED_init() do{ \
|
||||
PA_DDR = 0x08; PB_DDR = 0x30; PC_DDR = 0xf8; PD_DDR = 0x1e; \
|
||||
PA_CR1 = 0x08; PB_CR1 = 0x30; PC_CR1 = 0xf8; PD_CR1 = 0x1e; \
|
||||
}while(0)
|
||||
*/
|
||||
|
||||
// PA1|3, PB4|5, PC3|4|5|6|7, PD1|4|6
|
||||
#define LED_init() do{ \
|
||||
PA_DDR = 0x0a; PB_DDR = 0x30; PC_DDR = 0xf8; PD_DDR = 0x52; \
|
||||
PA_CR1 = 0x0a; PB_CR1 = 0x30; PC_CR1 = 0xf8; PD_CR1 = 0x52; \
|
||||
}while(0)
|
||||
|
||||
#endif // __LED_H__
|
||||
124
zakwire/main.c
Normal file
124
zakwire/main.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* main.c
|
||||
*
|
||||
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 "stm8l.h"
|
||||
#include "interrupts.h"
|
||||
#include "led.h"
|
||||
#include "zacwire.h"
|
||||
|
||||
unsigned long Global_time = 0L; // global time in ms
|
||||
int ADC_value = 0; // value of last ADC measurement
|
||||
U8 LED_delay = 1; // one digit emitting time
|
||||
|
||||
int main() {
|
||||
unsigned long T_LED = 0L; // time of last digit update
|
||||
unsigned long T_time = 0L; // timer
|
||||
U8 dp_err_pos = 0;
|
||||
U8 curbit = 0;
|
||||
// Configure clocking
|
||||
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
|
||||
// Configure pins
|
||||
CFG_GCR |= 1; // disable SWIM
|
||||
LED_init();
|
||||
// configure PD3[TIM2_CH2] as input for zacwire
|
||||
PD_CR1 |= GPIO_PIN3; // weak pullup
|
||||
CCR |= 0x28; // make shure that we are on level 3
|
||||
EXTI_CR1 = 0x80; // PDIS = 10 - falling edge
|
||||
// PA2 is output for zacwire powering
|
||||
PA_DDR |= GPIO_PIN2; // output
|
||||
PA_CR1 |= GPIO_PIN2; // push-pull
|
||||
// Configure Timer1
|
||||
// prescaler = f_{in}/f_{tim1} - 1
|
||||
// set Timer1 to 1MHz: 16/1 - 1 = 15
|
||||
TIM1_PSCRH = 0;
|
||||
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
|
||||
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
|
||||
TIM1_ARRH = 0x03;
|
||||
TIM1_ARRL = 0xE8;
|
||||
// interrupts: update
|
||||
TIM1_IER = TIM_IER_UIE;
|
||||
// auto-reload + interrupt on overflow + enable
|
||||
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
|
||||
// Configure Timer2:
|
||||
// capture/compare channel
|
||||
// channel CC1 (0->1) stores low pulse length,
|
||||
// channel CC2 (1->0) stores time period between two consequent zero-transitions
|
||||
//TIM2_IER = TIM_IER_CC2IE;// |TIM_IER_UIE ;
|
||||
//TIM2_CCER1 = 0x30; // CC2: enable, capture on 1->0; CC1: disable
|
||||
// TIM2 frequency == 16MHz / 2^TIM2_PSCR
|
||||
// main frequency: 1MHz
|
||||
// TIM2_PSCR = 15;
|
||||
/*
|
||||
TIM2_PSCR = 1; // 8MHz
|
||||
TIM2_CCMR2 = 1;
|
||||
TIM2_CCER1 = 0x10; // CC2: enable, capture on 0->1
|
||||
TIM2_IER = TIM_IER_CC2IE;
|
||||
*/
|
||||
/*
|
||||
// configure ADC
|
||||
// select PD2[AIN3] & enable interrupt for EOC
|
||||
ADC_CSR = 0x23;
|
||||
ADC_TDRL = 0x08; // disable Schmitt triger for AIN3
|
||||
// right alignment
|
||||
ADC_CR2 = 0x08; // don't forget: first read ADC_DRL!
|
||||
// f_{ADC} = f/18 & continuous non-buffered conversion & wake it up
|
||||
ADC_CR1 = 0x73;
|
||||
ADC_CR1 = 0x73; // turn on ADC (this needs second write operation)
|
||||
*/
|
||||
// enable all interrupts
|
||||
enableInterrupts();
|
||||
set_display_buf("----"); // on init show ----
|
||||
show_next_digit();
|
||||
// Loop
|
||||
do {
|
||||
if(((unsigned int)(Global_time - T_time) > 1000) || (T_time > Global_time)){ // once per 3 seconds we start measurement
|
||||
T_time = Global_time;
|
||||
if(ZW_data_ready){ // measurement is ready - display results
|
||||
ZW_data_ready = 0;
|
||||
display_int(Temperature_value); // fill display buffer with current temperature
|
||||
display_DP_at_pos(2); // we always show DP here
|
||||
/*display_int((int)ZW_bits[curbit++]);
|
||||
if(curbit == 20){
|
||||
curbit = 0;
|
||||
ZW_data_ready = 0;
|
||||
}
|
||||
display_DP_at_pos(dp_err_pos++); // turn off old DP
|
||||
if(dp_err_pos > 3)
|
||||
dp_err_pos = 0;*/
|
||||
}//else
|
||||
if(!temp_measurement){ // there's no active measurements
|
||||
ZW_on();
|
||||
}else{ // error: no sensor
|
||||
ZW_off();
|
||||
set_display_buf("E 0");
|
||||
display_DP_at_pos(dp_err_pos++); // turn off old DP
|
||||
if(dp_err_pos > 3)
|
||||
dp_err_pos = 0;
|
||||
}
|
||||
}
|
||||
if((U8)(Global_time - T_LED) > LED_delay){
|
||||
T_LED = Global_time;
|
||||
show_next_digit();
|
||||
}
|
||||
} while(1);
|
||||
}
|
||||
|
||||
BIN
zakwire/testproj.bin
Normal file
BIN
zakwire/testproj.bin
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user