This commit is contained in:
Eddy
2014-03-19 00:38:10 +04:00
commit 7919850a6d
103 changed files with 15718 additions and 0 deletions

View 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

View 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 !!!

View 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)

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

View 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){}

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

View 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__

View 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__

View 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))
)
)
)

View 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

View 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

View 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

View 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)))))

View 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

View 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

View 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

View 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

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

View 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__

Binary file not shown.