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,34 @@
NAME=testproj
SDCC=sdcc
CCFLAGS=-DSTM8S105 -I../ -I/usr/share/sdcc/include -mstm8 --out-fmt-ihx
LDFLAGS= -mstm8 --out-fmt-ihx -lstm8
FLASHFLAGS=-cstlinkv2 -pstm8s105
SRC=$(wildcard *.c)
# ATTENTION: FIRST in list should be file with main()
OBJ=$(SRC:%.c=%.rel)
TRASH=$(OBJ) $(SRC:%.c=%.rst) $(SRC:%.c=%.asm) $(SRC:%.c=%.lst)
TRASH+=$(SRC:%.c=%.sym) $(NAME).ihx $(NAME).lk $(NAME).map
INDEPENDENT_HEADERS=../stm8l.h ports_definition.h Makefile
all: $(NAME).ihx
$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS)
@touch $@
%.h: ;
clean:
rm -f $(TRASH)
load: $(NAME).ihx
stm8flash $(FLASHFLAGS) -w $(NAME).ihx
%.rel: %.c
$(SDCC) $(CCFLAGS) -c $<
$(NAME).ihx: $(OBJ)
$(SDCC) $(LDFLAGS) $(OBJ) -o $(NAME).ihx
.PHONY: all

View File

@@ -0,0 +1,26 @@
This is a simple example of INDEPENDENT management of 3 stepper motors.
You can connect up to 256 devices to common UART line
To work with them use simple protocol:
- each byte have 8 bits of data and nineth control bit
- inactive modules don't read bytes with nineth bit == 0,
only active module reads them
- all modules send data with nineth bit == 0
- to activate module simple send its number with nineth bit == 1
- you can change module number (value will be stored in flash memory) by command 'N'
and get its current number with command 'n'
All motors have independent lines DIR and CLK and common line EN.
Motor selection performed by setting to 1 corresponding EN pin.
Communication with MCU realized through simple USB<->TTL converter.
Just connect lines Rx/Tx of converter to Tx/Rx of evaluation boart,
connect together lines GND and +3.3V.
Communication speed: 57600, proto: 8N1
Comminication with MCU don't need special soft: you can even run screen session
or some terminal client like _com_. Another wariant is a simple client - client-term.
MCU itself can print to terminal a short help about its protocol, just sent letter 'h'
to it.
You can connect up to 4 (5 for motor 0) end-point switches for each motor.
There's an ability to move till certain EP switches value, also you can move
motors infinitely (for now it realized only for all motors simultaneously).

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,259 @@
/*
* client.c - simple terminal client
*
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include <termios.h> // tcsetattr
#include <unistd.h> // tcsetattr, close, read, write
#include <sys/ioctl.h> // ioctl
#include <stdio.h> // printf, getchar, fopen, perror
#include <stdlib.h> // exit
#include <sys/stat.h> // read
#include <fcntl.h> // read
#include <signal.h> // signal
#include <time.h> // time
#include <string.h> // memcpy
#include <stdint.h> // int types
#include <sys/time.h> // gettimeofday
#define CMSPAR 010000000000
double t0; // start time
FILE *fout = NULL; // file for messages duplicating
char *comdev = "/dev/ttyUSB0";
int BAUD_RATE = B57600;
struct termio oldtty, tty; // TTY flags
struct termios oldt, newt; // terminal flags
int comfd; // TTY fd
/**
* function for different purposes that need to know time intervals
* @return double value: time in seconds
*/
double dtime(){
double t;
struct timeval tv;
gettimeofday(&tv, NULL);
t = tv.tv_sec + ((double)tv.tv_usec)/1e6;
return t;
}
/**
* Exit & return terminal to old state
* @param ex_stat - status (return code)
*/
void quit(int ex_stat){
tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state
ioctl(comfd, TCSANOW, &oldtty ); // return TTY to previous state
close(comfd);
if(fout) fclose(fout);
printf("Exit! (%d)\n", ex_stat);
exit(ex_stat);
}
unsigned char crc(unsigned char data){
unsigned char crc = data & 1;
unsigned int i;
for(i = 1; i<8; i++) crc ^= (data >> i) & 1;
return crc;
}
/**
* Open & setup TTY, terminal
*/
void tty_init(){
// terminal without echo
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
if(tcsetattr(STDIN_FILENO, TCSANOW, &newt) < 0) quit(-2);
printf("\nOpen port...\n");
if ((comfd = open(comdev,O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0){
fprintf(stderr,"Can't use port %s\n",comdev);
quit(1);
}
printf(" OK\nGet current settings...\n");
if(ioctl(comfd,TCGETA,&oldtty) < 0) exit(-1); // Get settings
tty = oldtty;
tty.c_lflag = 0; // ~(ICANON | ECHO | ECHOE | ISIG)
tty.c_oflag = 0;
tty.c_iflag = 0;
tty.c_cflag = BAUD_RATE|CS8|CREAD|CLOCAL|PARENB; // we will emulate 9bit by PAR
tty.c_cc[VMIN] = 0; // non-canonical mode
tty.c_cc[VTIME] = 5;
if(ioctl(comfd,TCSETA,&tty) < 0) exit(-1); // set new mode
printf(" OK\n");
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
}
/**
* Read character from console without echo
* @return char readed
*/
int read_console(){
int rb;
struct timeval tv;
int retval;
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(STDIN_FILENO, &rfds);
tv.tv_sec = 0; tv.tv_usec = 10000;
retval = select(1, &rfds, NULL, NULL, &tv);
if(!retval) rb = 0;
else {
if(FD_ISSET(STDIN_FILENO, &rfds)) rb = getchar();
else rb = 0;
}
return rb;
}
/**
* getchar() without echo
* wait until at least one character pressed
* @return character readed
*/
int mygetchar(){ // аналог getchar() без необходимости жать Enter
int ret;
do ret = read_console();
while(ret == 0);
return ret;
}
/**
* Read data from TTY
* @param buff (o) - buffer for data read
* @param length - buffer len
* @return amount of readed bytes
*/
size_t read_tty(uint8_t *buff, size_t length){
ssize_t L = 0;
fd_set rfds;
struct timeval tv;
int retval;
FD_ZERO(&rfds);
FD_SET(comfd, &rfds);
tv.tv_sec = 0; tv.tv_usec = 10000; // wait for 10ms
retval = select(comfd + 1, &rfds, NULL, NULL, &tv);
if (!retval) return 0;
if(FD_ISSET(comfd, &rfds)){
if((L = read(comfd, buff, length)) < 1) return 0;
}
return (size_t)L;
}
void help(){
printf("Use this commands:\n"
"H\tShow this help\n"
"D\tChange device number\n"
"q\tQuit\n"
);
}
#define dup_pr(...) do{printf(__VA_ARGS__); if(fout) fprintf(fout, __VA_ARGS__);}while(0)
/**
* Set/reset nineth bit and send command
* @param
* @return
*/
void send_with_9(unsigned char cmd, int nineth){
if(crc(cmd) ^ nineth) // (ODD CRC) XOR (set nineth) -> odd parity
tty.c_cflag |= PARODD; // odd parity
else
tty.c_cflag &= ~PARODD; // even parity
if(ioctl(comfd, TCSETA, &tty) < 0){
perror("Ioctl");
quit(2);
}
if(write(comfd, &cmd, 1) < 1){
perror("Can't write to port");
quit(2);
}
}
void con_sig(int rb){
if(rb < 1) return;
if(rb == 'q') quit(0); // q == exit
else if(rb == 'H'){ // this program help
help();
return;
}else if(rb == 'D'){ // change device
int N;
printf("device number: ");
tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state
scanf("%d", &N);
tcsetattr(STDIN_FILENO, TCSANOW, &newt); // and again - no echo
if(N < 0 || N > 255){
printf("\nWRONG DEVNUM!\n");
return;
}
send_with_9((unsigned char)N, 1); // send marked byte with new device number
return;
}
send_with_9((unsigned char)rb, 0); // just send command with zero nineth bit
}
/**
* Get integer value from buffer
* @param buff (i) - buffer with int
* @param len - length of data in buffer (could be 2 or 4)
* @return
*/
uint32_t get_int(uint8_t *buff, size_t len){
if(len != 2 && len != 4){
fprintf(stdout, "Bad data length!\n");
return 0xffffffff;
}
uint32_t data = 0;
uint8_t *i8 = (uint8_t*) &data;
if(len == 2) memcpy(i8, buff, 2);
else memcpy(i8, buff, 4);
return data;
}
int main(int argc, char *argv[]){
int rb;
uint8_t buff[128];
size_t L;
if(argc == 2){
fout = fopen(argv[1], "a");
if(!fout){
perror("Can't open output file");
exit(-1);
}
setbuf(fout, NULL);
}
tty_init();
signal(SIGTERM, quit); // kill (-15)
signal(SIGINT, quit); // ctrl+C
signal(SIGQUIT, SIG_IGN); // ctrl+\ .
signal(SIGTSTP, SIG_IGN); // ctrl+Z
setbuf(stdout, NULL);
t0 = dtime();
while(1){
rb = read_console();
if(rb > 0) con_sig(rb);
L = read_tty(buff, 127);
if(L){
buff[L] = 0;
printf("%s", buff);
if(fout) fprintf(fout, "%zd\t%s\n", time(NULL), buff);
}
}
}

View File

@@ -0,0 +1,207 @@
/*
* interrupts.c
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "ports_definition.h"
#include "main.h"
#include "stepper.h"
#define TREG(N, R) TIM##N##_##R
#define STPR_INTR(X) \
if(TREG(X, SR1) & TIM_SR1_UIF){ \
TREG(X, SR1) &= ~TIM_SR1_UIF; \
if(Nsteps[X-1]){ \
if(++usteps[X-1] == USteps){ \
usteps[X-1] = 0; \
if(!StepperInfty) \
if(--Nsteps[X-1] == 0){ \
stop_motor(X-1); \
} \
} \
} \
}
// Top Level Interrupt
INTERRUPT_HANDLER(TLI_IRQHandler, 0){}
// Auto Wake Up Interrupt
INTERRUPT_HANDLER(AWU_IRQHandler, 1){}
// Clock Controller Interrupt
INTERRUPT_HANDLER(CLK_IRQHandler, 2){}
// External Interrupt PORTA
INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3){
check_EP();
}
// External Interrupt PORTB
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4){
check_EP();
}
// External Interrupt PORTC
INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5){
check_EP();
}
// External Interrupt PORTD
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){
check_EP();
}
// External Interrupt PORTE
INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7){
check_EP();
}
#ifdef STM8S903
// External Interrupt PORTF
INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8){}
#endif // STM8S903
#if defined (STM8S208) || defined (STM8AF52Ax)
// CAN RX Interrupt routine.
INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8){}
// CAN TX Interrupt routine.
INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9){}
#endif // STM8S208 || STM8AF52Ax
// SPI Interrupt routine.
INTERRUPT_HANDLER(SPI_IRQHandler, 10){}
// Timer1 Update/Overflow/Trigger/Break Interrupt
INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11){
STPR_INTR(1);
}
// Timer1 Capture/Compare Interrupt routine.
INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12){}
#ifdef STM8S903
// Timer5 Update/Overflow/Break/Trigger Interrupt
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13){}
// Timer5 Capture/Compare Interrupt
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14){}
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
// Timer2 Update/Overflow/Break Interrupt
INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13){ // generate pulses for stepper CLK
STPR_INTR(2);
}
// Timer2 Capture/Compare Interrupt
INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14){
}
#endif // STM8S903
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
defined(STM8S005) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
// Timer3 Update/Overflow/Break Interrupt
INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15){
STPR_INTR(3);
}
// Timer3 Capture/Compare Interrupt
INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16){}
#endif // STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x
#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
defined(STM8S003) || defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
// UART1 TX Interrupt
INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17){}
// UART1 RX Interrupt
INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18){}
#endif // STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax
// I2C Interrupt
INTERRUPT_HANDLER(I2C_IRQHandler, 19){}
#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x)
// UART2 TX interrupt
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20){}
// UART2 RX interrupt
INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21){
U8 rb;
if(UART2_SR & UART_SR_RXNE){ // data received
rb = UART2_DR; // read received byte & clear RXNE flag
//while(!(UART2_SR & UART_SR_TXE));
// get marked byte?
if(UART2_CR1 & UART_CR1_R8){ // Master wanna change device?
if(rb != UART_devNUM){ // another device number
UART_is_our = 0;
UART2_CR2 &= ~UART_CR2_TEN; // disable transmitter
}else{ // our device
UART_is_our = 1;
UART2_CR2 |= UART_CR2_TEN; // enable transmitter
UART_send_byte('*'); // send '*' - we got the command
}
return;
}
if(!UART_is_our) return; // this isn't our business - !marked & !our
UART_send_byte(rb); // echo received symbol
UART_rx[UART_rx_cur_i++] = rb; // put received byte into cycled buffer
if(UART_rx_cur_i == UART_rx_start_i){ // Oops: buffer overflow! Just forget old data
UART_rx_start_i++;
check_UART_pointer(UART_rx_start_i);
}
check_UART_pointer(UART_rx_cur_i);
}
}
#endif // STM8S105 or STM8AF626x
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// UART3 TX interrupt
INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20){}
// UART3 RX interrupt
INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21){}
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
// ADC2 interrupt
INTERRUPT_HANDLER(ADC2_IRQHandler, 22){}
#else
// ADC1 interrupt
INTERRUPT_HANDLER(ADC1_IRQHandler, 22){
}
#endif // STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax
#ifdef STM8S903
// Timer6 Update/Overflow/Trigger Interrupt
INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23){}
#else // STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF52Ax or STM8AF62Ax or STM8AF626x
// Timer4 Update/Overflow Interrupt
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23){
if(TIM4_SR & TIM_SR1_UIF){ // update interrupt
Global_time++; // increase timer
}
TIM4_SR = 0; // clear all interrupt flags
}
#endif // STM8S903
// Eeprom EEC Interrupt
INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24){}

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__

View File

@@ -0,0 +1,392 @@
/*
* blinky.c
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "stm8l.h"
#include "ports_definition.h"
#include "interrupts.h"
#include "main.h"
#include "stepper.h"
/*
* 0 0000
* 1 0001
* 2 0010
* 3 0011
* 4 0100
* 5 0101
* 6 0110
* 7 0111
* 8 1000
* 9 1001
* a 1010
* b 1011
* c 1100
* d 1101
* e 1110
* f 1111
*/
unsigned long Global_time = 0L; // global time in ms
U16 paused_val = 500; // interval between LED flashing
U8 UART_rx[UART_BUF_LEN]; // cycle buffer for received data
U8 UART_rx_start_i = 0; // started index of received data (from which reading starts)
U8 UART_rx_cur_i = 0; // index of current first byte in rx array (to which data will be written)
U8 UART_is_our = 0; // ==1 if we get UART
// ATTENTION! to change global variable in PROGRAM memory, it should be CONST!!!
const U8 UART_devNUM = THIS_DEVICE_NUM; // device number, master sais it
/**
* Send one byte through UART
* @param byte - data to send
*/
void UART_send_byte(U8 byte){
if(!UART_is_our) return; // don't use UART when we have no right!
//UART2_CR2 |= UART_CR2_TEN; // enable transmitter
UART2_DR = byte;
while(!(UART2_SR & UART_SR_TC));
//UART2_CR2 &= ~UART_CR2_TEN; // disable transmitter
}
void uart_write(char *str){
if(!UART_is_our) return; // don't use UART when we have no right!
//UART2_CR2 |= UART_CR2_TEN; // enable transmitter
while(*str){
UART2_DR = *str++;
while(!(UART2_SR & UART_SR_TC));
}
//UART2_CR2 &= ~UART_CR2_TEN; // disable transmitter
}
/**
* Read one byte from Rx buffer
* @param byte - where to store readed data
* @return 1 in case of non-empty buffer
*/
U8 UART_read_byte(U8 *byte){
if(UART_rx_start_i == UART_rx_cur_i) // buffer is empty
return 0;
*byte = UART_rx[UART_rx_start_i++];
check_UART_pointer(UART_rx_start_i);
return 1;
}
void printUint(U8 *val, U8 len){
unsigned long Number = 0;
U8 i = len;
char ch;
U8 decimal_buff[12]; // max len of U32 == 10 + \n + \0
if(len > 4 || len == 3 || len == 0) return;
for(i = 0; i < 12; i++)
decimal_buff[i] = 0;
decimal_buff[10] = '\n';
ch = 9;
switch(len){
case 1:
Number = *((U8*)val);
break;
case 2:
Number = *((U16*)val);
break;
case 4:
Number = *((unsigned long*)val);
break;
}
do{
i = Number % 10L;
decimal_buff[ch--] = i + '0';
Number /= 10L;
}while(Number && ch > -1);
uart_write((char*)&decimal_buff[ch+1]);
}
/*
U8 U8toHEX(U8 val){
val &= 0x0f;
if(val < 10) val += '0';
else val += 'a' - 10;
return val;
}
void printUintHEX(U8 *val, U8 len){
U8 i, V;
uart_write("0x");
for(i = 0; i < len; i++){
V = *val++;
UART_send_byte(U8toHEX(V>>4)); // MSB
UART_send_byte(U8toHEX(V)); // LSB
}
UART_send_byte('\n');
}*/
U8 readInt(int *val){
unsigned long T = Global_time;
unsigned long R = 0;
int readed;
U8 sign = 0, rb, ret = 0, bad = 0;
do{
if(!UART_read_byte(&rb)) continue;
if(rb == '-' && R == 0){ // negative number
sign = 1;
continue;
}
if(rb < '0' || rb > '9') break; // number ends with any non-digit symbol that will be omitted
ret = 1; // there's at least one digit
R = R * 10L + rb - '0';
if(R > 0x7fff){ // bad value
R = 0;
bad = 0;
}
}while(Global_time - T < 10000); // wait no longer than 10s
if(bad || !ret) return 0;
readed = (int) R;
if(sign) readed *= -1;
*val = readed;
return 1;
}
void error_msg(char *msg){
uart_write("\nERROR: ");
uart_write(msg);
UART_send_byte('\n');
}
/**
* read motor number
* @param N - readed Number
* @return 0 in case of error
*/
U8 get_motor_number(U8 *N){
int Ival;
if(readInt(&Ival) && Ival > -1 && Ival < 3){
*N = (U8) Ival;
UART_send_byte('*'); // OK
return 1;
}else{
error_msg("bad motor");
return 0;
}
}
void show_uid(){
uart_write("\nMCU ID:\n");
printUintHEX(U_ID00, 12);
}
/**
* Change variable stored in program memory
* !!! You can change only const values (non-constants are initializes on program start)
* @param addr - variable address
* @param new value
* @return 0 in case of error
*/
U8 change_progmem_value(U8 *addr, U8 val){
// unlock memory
FLASH_PUKR = EEPROM_KEY2;
FLASH_PUKR = EEPROM_KEY1;
// check bit PUL=1 in FLASH_IAPSR
if(!FLASH_IAPSR & 0x02)
return 0;
*addr = val;
// clear PUL to lock write
FLASH_IAPSR &= ~0x02;
return 1;
}
/*
U8 change_eeprom_value(U8 *addr, U8 val){
// unlock memory
FLASH_DUKR = EEPROM_KEY1;
FLASH_DUKR = EEPROM_KEY2;
// check bit DUL=1 in FLASH_IAPSR
if(!FLASH_IAPSR & 0x08)
return 0;
*addr = val;
// clear DUL to lock write
FLASH_IAPSR &= ~0x08;
return 1;
}
*/
int main() {
unsigned long T = 0L;
int Ival;
U8 rb, Num;
CFG_GCR |= 1; // disable SWIM
// Configure clocking
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
// Timer 4 (8 bit) used as system tick timer
// prescaler == 128 (2^7), Tfreq = 125kHz
// period = 1ms, so ARR = 125
TIM4_PSCR = 7;
TIM4_ARR = 125;
// interrupts: update
TIM4_IER = TIM_IER_UIE;
// auto-reload + interrupt on overflow + enable
TIM4_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
// Configure pins
// PC2 - PP output (on-board LED)
PORT(LED_PORT, DDR) |= LED_PIN;
PORT(LED_PORT, CR1) |= LED_PIN;
// PD5 - UART2_TX -- pseudo open-drain output; don't forget an pullup resistor!
PORT(UART_PORT, DDR) |= UART_TX_PIN;
PORT(UART_PORT, ODR) |= UART_TX_PIN; // torn off N push-down
//PORT(UART_PORT, CR1) |= UART_TX_PIN;
// Configure UART
// 9 bit, no parity, 1 stop (UART_CR3 = 0 - reset value)
// 57600 on 16MHz: BRR1=0x11, BRR2=0x06
UART2_BRR1 = 0x11; UART2_BRR2 = 0x06;
UART2_CR1 = UART_CR1_M; // M = 1 -- 9bits
UART2_CR2 = UART_CR2_REN | UART_CR2_RIEN; // Allow RX, generate ints on rx
setup_stepper_pins();
// enable all interrupts
enableInterrupts();
// Loop
do{
if((Global_time - T > paused_val) || (T > Global_time)){
T = Global_time;
PORT(LED_PORT, ODR) ^= LED_PIN; // blink on-board LED
}
if(UART_read_byte(&rb)){ // buffer isn't empty
switch(rb){
case 'h': // help
case 'H':
uart_write("\nPROTO:\n"
"+/-\tLED period\n"
"Ex/ex\tset/get end-switches stored\n"
"p\tget HW end-switches\n"
"Mx\tstop on end-switch\n"
"Sx/sx\tset/get Mspeed\n"
"mx\tget steps\n"
"Px\tpause/resume\n"
"Xx\tstop\n"
"0..2N\tmove xth motor for N steps\n"
"=\tinfinity moving (after 0..2)"
"U/u\tset/get U-stepping\n"
"I\tget serial ID\n"
"N\tchange HW number\n"
"n\tshow HW number\n"
);
break;
case 'I': // get serial id
show_uid();
break;
case '+':
paused_val += 100;
if(paused_val > 10000)
paused_val = 500; // but not more than 10s
break;
case '-':
paused_val -= 100;
if(paused_val < 100) // but not less than 0.1s
paused_val = 500;
break;
case 'E': // set end-switches value
if(get_motor_number(&Num)){
if(readInt(&Ival) && (Ival == (Ival & 0x1f))){
if(Num)
EPs[Num] = Ival & 0x0f; // 4 bits in motors 1&2
else
EPs[0] = Ival; // all 5 bits in motor 0
}else
error_msg("bad EP");
}
break;
case 'e': // get stored end-switches value
if(get_motor_number(&Num)){
printUint(&EPs[Num], 1);
}
break;
case 'p': // get hardware end-switches value
if(get_motor_number(&Num)){
Num = get_ep_value(Num);
printUint(&Num, 1);
}
break;
case 'S': // set stepper speed
if(get_motor_number(&Num)){
if(readInt(&Ival) && Ival > MIN_STEP_LENGTH)
set_stepper_speed(Num, Ival);
else
error_msg("bad speed");
}
break;
case 's': // get stepper speed
if(get_motor_number(&Num))
printUint((U8*)&Stepper_speed[Num], 2);
break;
case 'M': // move till EP, you can call it before starting motor
if(get_motor_number(&Num))
Stop_on_EP[Num] = 1;
break;
case 'm': // how much steps there is to the end of moving
if(get_motor_number(&Num))
printUint((U8*)&Nsteps[Num], 2);
break;
case 'X': // stop
if(get_motor_number(&Num))
stop_motor(Num);
break;
case 'P': // pause/resume
if(get_motor_number(&Num))
pause_resume(Num);
break;
case 'N':
if(readInt(&Ival) && Ival > 0 && Ival < 256)
if(!change_progmem_value(&UART_devNUM, (unsigned int) Ival))
error_msg("can't change val");
break;
case 'n': // show HW num
printUint(&UART_devNUM, 1);
break;
case 'u': // show UStepping
printUint(&USteps, 1);
break;
case 'U': // set UStepping
if(readInt(&Ival) && Ival > 0 && Ival < 256)
USteps = Ival;
break;
case '=': // infinity moving: just don't decrement steps
StepperInfty = 1;
break;
default:
if(rb >= '0' && rb <= '2'){ // run motor
Num = rb - '0';
if(readInt(&Ival) && Ival)
move_motor(Num, Ival);
else{
error_msg("bad Nsteps");
}
}
}
}
}while(1);
}

View File

@@ -0,0 +1,44 @@
/*
* blinky.h
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __MAIN_H__
#define __MAIN_H__
extern unsigned long Global_time; // global time in ms
#define UART_BUF_LEN 8 // max 7 bytes transmited in on operation
#define MIN_STEP_LENGTH 9 // max speed, microseconds for one microstep
#define THIS_DEVICE_NUM 1 // hardware number (0..255) can be changed by writting into EEPROM
extern U8 UART_rx[];
extern U8 UART_rx_start_i;
extern U8 UART_rx_cur_i;
extern U8 UART_is_our; // ==1 if we get UART
extern const U8 UART_devNUM;
void UART_send_byte(U8 byte);
void uart_write(char *str);
void printUint(U8 *val, U8 len);
void error_msg(char *msg);
#define check_UART_pointer(x) if(x == UART_BUF_LEN) x = 0;
#endif // __MAIN_H__

View File

@@ -0,0 +1,90 @@
/*
* ports_definition.h - definition of ports pins & so on
*
* Copyright 2014 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __PORTS_DEFINITION_H__
#define __PORTS_DEFINITION_H__
#include "stm8l.h"
// macro for using in port constructions like PORT(LED_PORT, ODR) = xx
#define CONCAT(a,b) a##_##b
#define PORT(a,b) CONCAT(a,b)
// on-board LED
#define LED_PORT PC
#define LED_PIN GPIO_PIN2
// UART2_TX
#define UART_PORT PD
#define UART_TX_PIN GPIO_PIN5
/***** Stepper motor *****/
// Clocking
#define STP0_CLK_PORT PC
#define STP0_CLK_PIN GPIO_PIN1
#define STP1_CLK_PORT PD
#define STP1_CLK_PIN GPIO_PIN4
#define STP2_CLK_PORT PD
#define STP2_CLK_PIN GPIO_PIN2
// Direction
#define STP0_DIR_PORT PD
#define STP0_DIR_PIN GPIO_PIN0
#define STP1_DIR_PORT PD
#define STP1_DIR_PIN GPIO_PIN7
#define STP2_DIR_PORT PF
#define STP2_DIR_PIN GPIO_PIN4
// Enable
#define STP0_EN_PORT PE
#define STP0_EN_PIN GPIO_PIN5
#define STP1_EN_PORT PD
#define STP1_EN_PIN GPIO_PIN3
#define STP2_EN_PORT PD
#define STP2_EN_PIN GPIO_PIN1
/** sensors for each motor **/
// SETUP (interrupts: only falling edge; inputs: all with weak pull-up)
#define SETUP_EP(x) SET_EP ## x ## UP()
// motor 0: PC3..PC7, 5EPs
#define SET_EP0UP() do{PORT(PC, CR2) |= 0xfc; PORT(PC, CR1) |= 0xfc; EXTI_CR1 |= 0x20;}while(0)
// motor 1: PB0..PB3, 4EPs
#define SET_EP1UP() do{PORT(PB, CR2) |= 0x0f; PORT(PB, CR1) |= 0x0f; EXTI_CR1 |= 0x08;}while(0)
// motor 2: PB4, PB5, PA1, PA2, 4EPs
#define SET_EP2UP() do{PORT(PB, CR2) |= 0x30; PORT(PA, CR2) |= 0x06; \
PORT(PB, CR1) |= 0x30; PORT(PA, CR1) |= 0x06; EXTI_CR1 |= 0x0a; }while(0)
/*
// motor 0: PC3..PC7, 5EPs
#define SET_EP0UP() do{PORT(PC, CR1) |= 0xfc; }while(0)
// motor 1: PB0..PB3, 4EPs
#define SET_EP1UP() do{PORT(PB, CR1) |= 0x0f; }while(0)
// motor 2: PB4, PB5, PA1, PA2, 4EPs
#define SET_EP2UP() do{PORT(PB, CR1) |= 0x30; PORT(PA, CR1) |= 0x06; }while(0)
*/
// GET VALUE
#define READ_EP(x) GET_EP ## x ## _()
#define GET_EP0_() (( PORT(PC, IDR) >> 3 ))
#define GET_EP1_() (( PORT(PB, IDR) & 0x0f ))
#define GET_EP2_() (( ((PORT(PB,IDR) >> 4) & 0x03) | ((PORT(PA,IDR) << 1) & 0x0c) ))
#endif // __PORTS_DEFINITION_H__

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,8 @@
EESchema-DOCLIB Version 2.0 Date: Ср 26 фев 2014 17:45:20
#
$CMP CONN_5_
D Symbole general de connecteur
K CONN
$ENDCMP
#
#End Doc Library

View File

@@ -0,0 +1,253 @@
EESchema-LIBRARY Version 2.3 Date: Пн 03 мар 2014 17:27:22
#encoding utf-8
#
# +3.3V
#
DEF +3.3V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -40 30 H I C CNN
F1 "+3.3V" 0 110 30 H V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
ALIAS +3,3V
DRAW
X +3.3V 1 0 0 0 U 30 30 0 0 W N
C 0 60 20 0 1 0 N
P 3 0 1 0 0 0 0 40 0 40 N
ENDDRAW
ENDDEF
#
# C
#
DEF C C 0 10 N Y 1 F N
F0 "C" 0 100 40 H V L CNN
F1 "C" 6 -85 40 H V L CNN
F2 "~" 38 -150 30 H V C CNN
F3 "~" 0 0 60 H V C CNN
$FPLIST
SM*
C?
C1-1
$ENDFPLIST
DRAW
P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 200 170 D 40 40 1 1 P
X ~ 2 0 -200 170 U 40 40 1 1 P
ENDDRAW
ENDDEF
#
# CONN_14
#
DEF CONN_14 P 0 40 Y N 1 F N
F0 "P" -30 0 60 V V C CNN
F1 "CONN_14" 80 0 60 V V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
DRAW
S -100 700 150 -700 0 1 0 N
X P1 1 -350 650 250 R 50 50 1 1 P I
X P2 2 -350 550 250 R 50 50 1 1 P I
X P3 3 -350 450 250 R 50 50 1 1 P I
X P4 4 -350 350 250 R 50 50 1 1 P I
X P5 5 -350 250 250 R 50 50 1 1 P I
X P6 6 -350 150 250 R 50 50 1 1 P I
X P7 7 -350 50 250 R 50 50 1 1 P I
X P8 8 -350 -50 250 R 50 50 1 1 P I
X P9 9 -350 -150 250 R 50 50 1 1 P I
X P10 10 -350 -250 250 R 50 50 1 1 P I
X P11 11 -350 -350 250 R 50 50 1 1 P I
X P12 12 -350 -450 250 R 50 50 1 1 P I
X P13 13 -350 -550 250 R 50 50 1 1 P I
X P14 14 -350 -650 250 R 50 50 1 1 P I
ENDDRAW
ENDDEF
#
# CONN_3
#
DEF CONN_3 K 0 40 Y N 1 F N
F0 "K" -50 0 50 V V C CNN
F1 "CONN_3" 50 0 40 V V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
DRAW
S -100 150 100 -150 0 1 0 N
X P1 1 -350 100 250 R 60 60 1 1 P I
X PM 2 -350 0 250 R 60 60 1 1 P I
X P3 3 -350 -100 250 R 60 60 1 1 P I
ENDDRAW
ENDDEF
#
# CONN_4
#
DEF CONN_4 P 0 40 Y N 1 F N
F0 "P" -50 0 50 V V C CNN
F1 "CONN_4" 50 0 50 V V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
DRAW
S -100 200 100 -200 0 1 0 N
X P1 1 -350 150 250 R 50 50 1 1 P I
X P2 2 -350 50 250 R 50 50 1 1 P I
X P3 3 -350 -50 250 R 50 50 1 1 P I
X P4 4 -350 -150 250 R 50 50 1 1 P I
ENDDRAW
ENDDEF
#
# CONN_5
#
DEF CONN_5 P 0 40 Y Y 1 F N
F0 "P" -50 0 50 V V C CNN
F1 "CONN_5" 50 0 50 V V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
DRAW
S -100 250 100 -250 0 1 0 f
X ~ 1 -400 200 300 R 60 60 1 1 P I
X ~ 2 -400 100 300 R 60 60 1 1 P I
X ~ 3 -400 0 300 R 60 60 1 1 P I
X ~ 4 -400 -100 300 R 60 60 1 1 P I
X ~ 5 -400 -200 300 R 60 60 1 1 P I
ENDDRAW
ENDDEF
#
# CONN_5_
#
DEF CONN_5_ P 0 40 Y Y 1 F N
F0 "P" 50 -300 50 H V C CNN
F1 "CONN_5_" 150 0 50 V V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
DRAW
S -100 250 200 -250 0 1 0 f
X ~ 1 -400 200 300 R 60 60 1 1 w I
X ~ 2 -400 100 300 R 60 60 1 1 w I
X ~ 3 -400 0 300 R 60 60 1 1 O I
X ~ 4 -400 -100 300 R 60 60 1 1 I I
X ~ 5 -400 -200 300 R 60 60 1 1 w I
ENDDRAW
ENDDEF
#
# GND
#
DEF ~GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 0 30 H I C CNN
F1 "GND" 0 -70 30 H I C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
DRAW
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
X GND 1 0 0 0 U 30 30 1 1 W N
ENDDRAW
ENDDEF
#
# LED
#
DEF LED D 0 40 Y N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "LED" 0 -100 50 H V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
$FPLIST
LED-3MM
LED-5MM
LED-10MM
LED-0603
LED-0805
LED-1206
LEDV
$ENDFPLIST
DRAW
P 2 0 1 0 50 50 50 -50 N
P 3 0 1 0 -50 50 50 0 -50 -50 F
P 3 0 1 0 65 -40 110 -80 105 -55 N
P 3 0 1 0 80 -25 125 -65 120 -40 N
X A 1 -200 0 150 R 40 40 1 1 P
X K 2 200 0 150 L 40 40 1 1 P
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 40 V V C CNN
F1 "R" 7 1 40 V V C CNN
F2 "~" -70 0 30 V V C CNN
F3 "~" 0 0 30 H V C CNN
$FPLIST
R?
SM0603
SM0805
R?-*
SM1206
$ENDFPLIST
DRAW
S -40 150 40 -150 0 1 12 N
X ~ 1 0 250 100 D 60 60 1 1 P
X ~ 2 0 -250 100 U 60 60 1 1 P
ENDDRAW
ENDDEF
#
# STM8S105K4T6C
#
DEF STM8S105K4T6C U 0 40 Y Y 1 F N
F0 "U" 0 1050 60 H V C CNN
F1 "STM8S105K4T6C" 50 -850 60 H V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
ALIAS stm8s105*
$FPLIST
lqfp32*
$ENDFPLIST
DRAW
S -1100 950 1100 -750 0 1 0 N
X NRST 1 -1400 850 300 R 50 50 1 1 I
X OSCIN/PA1 2 -1400 750 300 R 50 50 1 1 T
X OSCOUT/PA2 3 -1400 650 300 R 50 50 1 1 T
X VSS 4 -1400 550 300 R 50 50 1 1 W
X VCAP 5 -1400 450 300 R 50 50 1 1 w
X VDD(3.3-5v) 6 -1400 350 300 R 50 50 1 1 W
X VDDio 7 -1400 250 300 R 50 50 1 1 W
X PF4/AIN12 8 -1400 150 300 R 50 50 1 1 T
X VDDA 9 -1400 50 300 R 50 50 1 1 W
X VSSA 10 -1400 -50 300 R 50 50 1 1 W
X PC3(HS)/TIM1_CH3 20 1400 -350 300 L 50 50 1 1 T
X PD5/UART2_TX 30 1400 650 300 L 50 50 1 1 T
X PB5/AIN5[I2X_SDA] 11 -1400 -150 300 R 50 50 1 1 T
X PC4(HS)/TIM1_CH4 21 1400 -250 300 L 50 50 1 1 T
X PD6/UART2_RX 31 1400 750 300 L 50 50 1 1 T
X PB4/AIN4[I2C_SCL] 12 -1400 -250 300 R 50 50 1 1 T
X PC5(HS)/SPI_SCK 22 1400 -150 300 L 50 50 1 1 T
X PD7/TLI[TIM1_CH4] 32 1400 850 300 L 50 50 1 1 T
X PB3/AIN3[TIM1_ETR] 13 -1400 -350 300 R 50 50 1 1 T
X PC6(HS)/SPI_MOSI 23 1400 -50 300 L 50 50 1 1 T
X PB2/AIN2[TIM1_CH3N] 14 -1400 -450 300 R 50 50 1 1 T
X PC7(HS)/SPI_MISO 24 1400 50 300 L 50 50 1 1 T
X PB1/AIN1_[TIM1_CH2N] 15 -1400 -550 300 R 50 50 1 1 T
X PD0(HS)/TIM3_CH2[TIM1_BKIN][CLK_CCO] 25 1400 150 300 L 50 50 1 1 T
X PB0/AIN0_[TIM1_CH1N] 16 -1400 -650 300 R 50 50 1 1 T
X PD1(HS)/SWIM 26 1400 250 300 L 50 50 1 1 T
X PE5/SPI_NSS 17 1400 -650 300 L 50 50 1 1 T
X PD2(HS)/TIM3_CH1[TIM2_CH3] 27 1400 350 300 L 50 50 1 1 T
X PC1(HS)/TIM1_CH1 18 1400 -550 300 L 50 50 1 1 T
X PD3(HS)/TIM2_CH2[ADC_ETR] 28 1400 450 300 L 50 50 1 1 T
X PC2(HS)/TIM1_CH2 19 1400 -450 300 L 50 50 1 1 T
X PD4(HS)/TIM2_CH1[BEEP] 29 1400 550 300 L 50 50 1 1 T
ENDDRAW
ENDDEF
#
# SW_PUSH
#
DEF SW_PUSH SW 0 40 N N 1 F N
F0 "SW" 150 110 50 H V C CNN
F1 "SW_PUSH" 0 -80 50 H V C CNN
F2 "~" 0 0 60 H V C CNN
F3 "~" 0 0 60 H V C CNN
DRAW
S -170 50 170 60 0 1 0 N
P 4 0 1 0 -40 60 -30 90 30 90 40 60 N
X 1 1 -300 0 200 R 60 60 0 1 P I
X 2 2 300 0 200 L 60 60 0 1 P I
ENDDRAW
ENDDEF
#
#End Library

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,45 @@
update=Ср 26 фев 2014 17:43:07
last_client=eeschema
[eeschema]
version=1
LibDir=
NetFmtName=
RptD_X=0
RptD_Y=100
RptLab=1
LabSize=118
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
LibName31=stm8
LibName32=st-microelectronics
LibName33=stm8s105k4t6c
LibName34=stepper-cache

View File

@@ -0,0 +1,779 @@
EESchema Schematic File Version 2 date Пн 03 мар 2014 17:27:22
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers
LIBS:dsp
LIBS:microchip
LIBS:analog_switches
LIBS:motorola
LIBS:texas
LIBS:intel
LIBS:audio
LIBS:interface
LIBS:digital-audio
LIBS:philips
LIBS:display
LIBS:cypress
LIBS:siliconi
LIBS:opto
LIBS:atmel
LIBS:contrib
LIBS:valves
LIBS:stm8
LIBS:st-microelectronics
LIBS:stm8s105k4t6c
LIBS:stepper-cache
LIBS:stepper-cache
EELAYER 27 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date "3 mar 2014"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L STM8S105K4T6C U1
U 1 1 52FB03A2
P 4400 3100
F 0 "U1" H 4400 4150 60 0000 C CNN
F 1 "STM8S105K4T6C" H 4450 2250 60 0000 C CNN
F 2 "~" H 4400 3100 60 0000 C CNN
F 3 "~" H 4400 3100 60 0000 C CNN
1 4400 3100
1 0 0 -1
$EndComp
$Comp
L GND #PWR01
U 1 1 52FB03EF
P 2750 3200
F 0 "#PWR01" H 2750 3200 30 0001 C CNN
F 1 "GND" H 2750 3130 30 0001 C CNN
F 2 "" H 2750 3200 60 0000 C CNN
F 3 "" H 2750 3200 60 0000 C CNN
1 2750 3200
1 0 0 -1
$EndComp
Wire Wire Line
2750 3200 2750 3150
Wire Wire Line
2750 3150 3000 3150
$Comp
L GND #PWR02
U 1 1 52FB0400
P 2750 2600
F 0 "#PWR02" H 2750 2600 30 0001 C CNN
F 1 "GND" H 2750 2530 30 0001 C CNN
F 2 "" H 2750 2600 60 0000 C CNN
F 3 "" H 2750 2600 60 0000 C CNN
1 2750 2600
1 0 0 -1
$EndComp
Wire Wire Line
2750 2600 2750 2550
Wire Wire Line
2750 2550 3000 2550
$Comp
L C C1
U 1 1 52FB0413
P 2250 2700
F 0 "C1" H 2300 2800 50 0000 L CNN
F 1 "1u" H 2300 2600 50 0000 L CNN
F 2 "" H 2250 2700 60 0000 C CNN
F 3 "" H 2250 2700 60 0000 C CNN
1 2250 2700
0 -1 -1 0
$EndComp
$Comp
L C C2
U 1 1 52FB0426
P 2250 2950
F 0 "C2" H 2300 3050 50 0000 L CNN
F 1 "104" H 2300 2850 50 0000 L CNN
F 2 "" H 2250 2950 60 0000 C CNN
F 3 "" H 2250 2950 60 0000 C CNN
1 2250 2950
0 -1 -1 0
$EndComp
Wire Wire Line
2450 2700 2850 2700
Wire Wire Line
2850 2700 2850 2650
Wire Wire Line
2850 2650 3000 2650
Wire Wire Line
3000 2750 3000 2850
Wire Wire Line
2450 2950 2450 2850
Wire Wire Line
2450 2850 3000 2850
Wire Wire Line
2050 2700 2050 3100
$Comp
L GND #PWR03
U 1 1 52FB0453
P 2050 3100
F 0 "#PWR03" H 2050 3100 30 0001 C CNN
F 1 "GND" H 2050 3030 30 0001 C CNN
F 2 "" H 2050 3100 60 0000 C CNN
F 3 "" H 2050 3100 60 0000 C CNN
1 2050 3100
1 0 0 -1
$EndComp
Connection ~ 2050 2800
Connection ~ 2050 2950
Text Label 3000 2250 2 60 ~ 0
NRST
Text Label 3000 2350 2 60 ~ 0
OSC1IN/PA1
Text Label 3000 2450 2 60 ~ 0
OSC2IN/PA2
Text Label 3000 2950 2 60 ~ 0
PF4
Text Label 3000 3250 2 60 ~ 0
PB5
Text Label 3000 3350 2 60 ~ 0
PB4
Text Label 3000 3450 2 60 ~ 0
PB3
Text Label 3000 3550 2 60 ~ 0
PB2
Text Label 3000 3650 2 60 ~ 0
PB1
Text Label 3000 3750 2 60 ~ 0
PB0
Text Label 5800 3750 0 60 ~ 0
PE5
Text Label 5800 3650 0 60 ~ 0
PC1
Text Label 5800 3550 0 60 ~ 0
PC2
Text Label 5800 3450 0 60 ~ 0
PC3
Text Label 5800 3350 0 60 ~ 0
PC4
Text Label 5800 3250 0 60 ~ 0
PC5
Text Label 5800 3150 0 60 ~ 0
PC6
Text Label 5800 3050 0 60 ~ 0
PC7
Text Label 5800 2950 0 60 ~ 0
PD0
Text Label 5800 2850 0 60 ~ 0
SWIM/PD1
Text Label 5800 2750 0 60 ~ 0
PD2
Text Label 5800 2650 0 60 ~ 0
PD3
Text Label 5800 2550 0 60 ~ 0
PD4
Text Label 5800 2450 0 60 ~ 0
PD5
Text Label 5800 2350 0 60 ~ 0
PD6
Text Label 5800 2250 0 60 ~ 0
PD7
$Comp
L CONN_4 P2
U 1 1 52FB0A49
P 4350 1000
F 0 "P2" V 4300 1000 50 0000 C CNN
F 1 "CONN_4" V 4400 1000 50 0000 C CNN
F 2 "" H 4350 1000 60 0000 C CNN
F 3 "" H 4350 1000 60 0000 C CNN
1 4350 1000
1 0 0 -1
$EndComp
$Comp
L CONN_14 P1
U 1 1 52FB0A6A
P 1250 1500
F 0 "P1" V 1220 1500 60 0000 C CNN
F 1 "CONN_14" V 1330 1500 60 0000 C CNN
F 2 "" H 1250 1500 60 0000 C CNN
F 3 "" H 1250 1500 60 0000 C CNN
1 1250 1500
-1 0 0 -1
$EndComp
$Comp
L CONN_14 P3
U 1 1 52FB0A79
P 7100 1500
F 0 "P3" V 7070 1500 60 0000 C CNN
F 1 "CONN_14" V 7180 1500 60 0000 C CNN
F 2 "" H 7100 1500 60 0000 C CNN
F 3 "" H 7100 1500 60 0000 C CNN
1 7100 1500
1 0 0 -1
$EndComp
Text Label 1600 1150 0 60 ~ 0
OSC1IN/PA1
Text Label 1600 1250 0 60 ~ 0
OSC2IN/PA2
Text Label 1600 1350 0 60 ~ 0
PF4
Text Label 1600 1450 0 60 ~ 0
PB5
Text Label 1600 1550 0 60 ~ 0
PB4
Text Label 1600 1650 0 60 ~ 0
PB3
Text Label 1600 1750 0 60 ~ 0
PB2
Text Label 1600 1850 0 60 ~ 0
PB1
Text Label 1600 1950 0 60 ~ 0
PB0
Text Label 1600 2050 0 60 ~ 0
PE5
Text Label 1600 2150 0 60 ~ 0
PC1
Text Label 1600 1050 0 60 ~ 0
NRST
Text Label 4000 950 2 60 ~ 0
SWIM/PD1
Text Label 4000 1050 2 60 ~ 0
NRST
Text Label 6750 850 2 60 ~ 0
PD7
Text Label 6750 950 2 60 ~ 0
PD6
Text Label 6750 1050 2 60 ~ 0
PD5
Text Label 6750 1150 2 60 ~ 0
PD4
Text Label 6750 1250 2 60 ~ 0
PD3
Text Label 6750 1350 2 60 ~ 0
PD2
Text Label 6750 1450 2 60 ~ 0
SWIM/PD1
Text Label 6750 1550 2 60 ~ 0
PD0
Text Label 6750 1650 2 60 ~ 0
PC7
Text Label 6750 1750 2 60 ~ 0
PC6
Text Label 6750 1850 2 60 ~ 0
PC5
Text Label 6750 1950 2 60 ~ 0
PC4
Text Label 6750 2050 2 60 ~ 0
PC3
Text Label 6750 2150 2 60 ~ 0
PC2
$Comp
L +3.3V #PWR04
U 1 1 52FB0DC4
P 950 2800
F 0 "#PWR04" H 950 2760 30 0001 C CNN
F 1 "+3.3V" H 950 2910 30 0000 C CNN
F 2 "" H 950 2800 60 0000 C CNN
F 3 "" H 950 2800 60 0000 C CNN
1 950 2800
1 0 0 -1
$EndComp
$Comp
L LED D1
U 1 1 52FB0DD3
P 950 3100
F 0 "D1" H 950 3200 50 0000 C CNN
F 1 "LED" H 950 3000 50 0000 C CNN
F 2 "" H 950 3100 60 0000 C CNN
F 3 "" H 950 3100 60 0000 C CNN
1 950 3100
0 1 1 0
$EndComp
$Comp
L R R1
U 1 1 52FB0DE2
P 950 3600
F 0 "R1" V 1030 3600 50 0000 C CNN
F 1 "1k" V 950 3600 50 0000 C CNN
F 2 "" H 950 3600 60 0000 C CNN
F 3 "" H 950 3600 60 0000 C CNN
1 950 3600
1 0 0 -1
$EndComp
Wire Wire Line
950 2800 950 2900
Wire Wire Line
950 3300 950 3350
Wire Wire Line
950 3850 950 3950
$Comp
L +3.3V #PWR05
U 1 1 52FB0EC7
P 1300 2800
F 0 "#PWR05" H 1300 2760 30 0001 C CNN
F 1 "+3.3V" H 1300 2910 30 0000 C CNN
F 2 "" H 1300 2800 60 0000 C CNN
F 3 "" H 1300 2800 60 0000 C CNN
1 1300 2800
1 0 0 -1
$EndComp
$Comp
L LED D2
U 1 1 52FB0ECD
P 1300 3100
F 0 "D2" H 1300 3200 50 0000 C CNN
F 1 "LED" H 1300 3000 50 0000 C CNN
F 2 "" H 1300 3100 60 0000 C CNN
F 3 "" H 1300 3100 60 0000 C CNN
1 1300 3100
0 1 1 0
$EndComp
$Comp
L R R2
U 1 1 52FB0ED3
P 1300 3600
F 0 "R2" V 1380 3600 50 0000 C CNN
F 1 "1k" V 1300 3600 50 0000 C CNN
F 2 "" H 1300 3600 60 0000 C CNN
F 3 "" H 1300 3600 60 0000 C CNN
1 1300 3600
1 0 0 -1
$EndComp
$Comp
L GND #PWR06
U 1 1 52FB0ED9
P 1300 3950
F 0 "#PWR06" H 1300 3950 30 0001 C CNN
F 1 "GND" H 1300 3880 30 0001 C CNN
F 2 "" H 1300 3950 60 0000 C CNN
F 3 "" H 1300 3950 60 0000 C CNN
1 1300 3950
1 0 0 -1
$EndComp
Wire Wire Line
1300 2800 1300 2900
Wire Wire Line
1300 3300 1300 3350
Wire Wire Line
1300 3850 1300 3950
Text Label 950 3950 2 60 ~ 0
PC2
$Comp
L +3.3V #PWR07
U 1 1 52FB0EF1
P 6500 2550
F 0 "#PWR07" H 6500 2510 30 0001 C CNN
F 1 "+3.3V" H 6500 2660 30 0000 C CNN
F 2 "" H 6500 2550 60 0000 C CNN
F 3 "" H 6500 2550 60 0000 C CNN
1 6500 2550
1 0 0 -1
$EndComp
$Comp
L R R3
U 1 1 52FB0EFD
P 6500 2900
F 0 "R3" V 6580 2900 50 0000 C CNN
F 1 "10k" V 6500 2900 50 0000 C CNN
F 2 "" H 6500 2900 60 0000 C CNN
F 3 "" H 6500 2900 60 0000 C CNN
1 6500 2900
1 0 0 -1
$EndComp
$Comp
L GND #PWR08
U 1 1 52FB0F03
P 6500 4050
F 0 "#PWR08" H 6500 4050 30 0001 C CNN
F 1 "GND" H 6500 3980 30 0001 C CNN
F 2 "" H 6500 4050 60 0000 C CNN
F 3 "" H 6500 4050 60 0000 C CNN
1 6500 4050
1 0 0 -1
$EndComp
Wire Wire Line
6500 2550 6500 2650
Wire Wire Line
6500 3850 6500 4050
$Comp
L SW_PUSH SW1
U 1 1 52FB0F3B
P 6500 3550
F 0 "SW1" H 6650 3660 50 0000 C CNN
F 1 "SW_PUSH" H 6500 3470 50 0000 C CNN
F 2 "" H 6500 3550 60 0000 C CNN
F 3 "" H 6500 3550 60 0000 C CNN
1 6500 3550
0 -1 -1 0
$EndComp
Wire Wire Line
6500 3250 6500 3150
$Comp
L C C3
U 1 1 52FB0F99
P 6900 3550
F 0 "C3" H 6950 3650 50 0000 L CNN
F 1 "104" H 6950 3450 50 0000 L CNN
F 2 "" H 6900 3550 60 0000 C CNN
F 3 "" H 6900 3550 60 0000 C CNN
1 6900 3550
1 0 0 -1
$EndComp
Wire Wire Line
6900 3200 6900 3350
Wire Wire Line
6900 3750 6900 3900
Wire Wire Line
6900 3900 6500 3900
Connection ~ 6500 3900
Wire Wire Line
6500 3200 6900 3200
Connection ~ 6500 3200
Text Label 6500 3200 2 60 ~ 0
NRST
$Comp
L +3.3V #PWR09
U 1 1 52FB2273
P 2150 850
F 0 "#PWR09" H 2150 810 30 0001 C CNN
F 1 "+3.3V" H 2150 960 30 0000 C CNN
F 2 "" H 2150 850 60 0000 C CNN
F 3 "" H 2150 850 60 0000 C CNN
1 2150 850
1 0 0 -1
$EndComp
Wire Wire Line
1600 850 2150 850
$Comp
L GND #PWR010
U 1 1 52FB2296
P 2150 1000
F 0 "#PWR010" H 2150 1000 30 0001 C CNN
F 1 "GND" H 2150 930 30 0001 C CNN
F 2 "" H 2150 1000 60 0000 C CNN
F 3 "" H 2150 1000 60 0000 C CNN
1 2150 1000
1 0 0 -1
$EndComp
Wire Wire Line
1600 950 2150 950
Wire Wire Line
2150 950 2150 1000
Wire Wire Line
2600 3050 3000 3050
Wire Wire Line
2750 3050 2750 2850
Connection ~ 2750 2850
$Comp
L +3.3V #PWR011
U 1 1 52FB26FA
P 2600 3000
F 0 "#PWR011" H 2600 2960 30 0001 C CNN
F 1 "+3.3V" H 2600 3110 30 0000 C CNN
F 2 "" H 2600 3000 60 0000 C CNN
F 3 "" H 2600 3000 60 0000 C CNN
1 2600 3000
1 0 0 -1
$EndComp
Wire Wire Line
2600 3000 2600 3050
Connection ~ 2750 3050
$Comp
L +3.3V #PWR012
U 1 1 52FB286D
P 4000 750
F 0 "#PWR012" H 4000 710 30 0001 C CNN
F 1 "+3.3V" H 4000 860 30 0000 C CNN
F 2 "" H 4000 750 60 0000 C CNN
F 3 "" H 4000 750 60 0000 C CNN
1 4000 750
1 0 0 -1
$EndComp
$Comp
L GND #PWR013
U 1 1 52FB287C
P 4000 1300
F 0 "#PWR013" H 4000 1300 30 0001 C CNN
F 1 "GND" H 4000 1230 30 0001 C CNN
F 2 "" H 4000 1300 60 0000 C CNN
F 3 "" H 4000 1300 60 0000 C CNN
1 4000 1300
1 0 0 -1
$EndComp
Wire Wire Line
4000 1300 4000 1150
Wire Wire Line
4000 850 4000 750
Wire Notes Line
600 500 600 4200
Wire Notes Line
600 4200 7500 4200
Wire Notes Line
7500 4200 7500 500
Wire Notes Line
7500 500 600 500
Text Notes 4800 750 0 118 ~ 0
STM8 board
Text Notes 7950 950 0 118 ~ 0
USB <-> TTL
Text Label 9000 1150 0 61 ~ 0
GND
Text Label 9000 1250 0 61 ~ 0
RXD
Text Label 9000 1350 0 61 ~ 0
TXD
Text Label 9000 1450 0 61 ~ 0
5.0V
Text Label 9000 1550 0 61 ~ 0
3.3V
$Comp
L GND #PWR014
U 1 1 52FB4CEF
P 10000 1250
F 0 "#PWR014" H 10000 1250 30 0001 C CNN
F 1 "GND" H 10000 1180 30 0001 C CNN
F 2 "" H 10000 1250 60 0000 C CNN
F 3 "" H 10000 1250 60 0000 C CNN
1 10000 1250
1 0 0 -1
$EndComp
Wire Wire Line
9000 1150 10000 1150
Wire Wire Line
10000 1150 10000 1250
Wire Wire Line
9000 1250 9600 1250
Wire Wire Line
9600 1250 9600 850
Wire Wire Line
9000 1350 10200 1350
Wire Wire Line
10200 1350 10200 850
$Comp
L +3.3V #PWR015
U 1 1 52FB4EDC
P 10400 1450
F 0 "#PWR015" H 10400 1410 30 0001 C CNN
F 1 "+3.3V" H 10400 1560 30 0000 C CNN
F 2 "" H 10400 1450 60 0000 C CNN
F 3 "" H 10400 1450 60 0000 C CNN
1 10400 1450
1 0 0 -1
$EndComp
Wire Wire Line
9000 1550 10400 1550
Wire Wire Line
10400 1550 10400 1450
NoConn ~ 9000 1450
Text Label 9600 850 0 61 ~ 0
PD5
Text Label 10200 850 0 61 ~ 0
PD6
$Comp
L CONN_3 K1
U 1 1 530DEDA9
P 950 5150
F 0 "K1" V 900 5150 50 0000 C CNN
F 1 "CONN_3" V 1000 5150 40 0000 C CNN
F 2 "" H 950 5150 60 0000 C CNN
F 3 "" H 950 5150 60 0000 C CNN
1 950 5150
-1 0 0 1
$EndComp
Wire Wire Line
1300 5050 1600 5050
Wire Wire Line
1300 5150 1600 5150
Wire Wire Line
1300 5250 1600 5250
Text Label 1600 5050 0 60 ~ 0
PD0
Text Label 1600 5150 0 60 ~ 0
PE5
Text Label 1600 5250 0 60 ~ 0
PC1
$Comp
L CONN_3 K2
U 1 1 530DEE90
P 950 5750
F 0 "K2" V 900 5750 50 0000 C CNN
F 1 "CONN_3" V 1000 5750 40 0000 C CNN
F 2 "" H 950 5750 60 0000 C CNN
F 3 "" H 950 5750 60 0000 C CNN
1 950 5750
-1 0 0 1
$EndComp
Wire Wire Line
1300 5650 1600 5650
Wire Wire Line
1300 5750 1600 5750
Wire Wire Line
1300 5850 1600 5850
Text Label 1600 5650 0 60 ~ 0
PD7
Text Label 1600 5750 0 60 ~ 0
PD3
Text Label 1600 5850 0 60 ~ 0
PD4
$Comp
L CONN_3 K3
U 1 1 530DEE9C
P 950 6350
F 0 "K3" V 900 6350 50 0000 C CNN
F 1 "CONN_3" V 1000 6350 40 0000 C CNN
F 2 "" H 950 6350 60 0000 C CNN
F 3 "" H 950 6350 60 0000 C CNN
1 950 6350
-1 0 0 1
$EndComp
Wire Wire Line
1300 6250 1600 6250
Wire Wire Line
1300 6350 1600 6350
Wire Wire Line
1300 6450 1600 6450
Text Label 1600 6250 0 60 ~ 0
PF4
Text Label 1600 6350 0 60 ~ 0
SWIM/PD1
Text Label 1600 6450 0 60 ~ 0
PD2
Text Notes 850 4900 0 98 ~ 0
Motor 0
Text Notes 850 5500 0 98 ~ 0
Motor 1
Text Notes 850 6100 0 98 ~ 0
Motor 2
Text Notes 700 4650 0 118 ~ 0
MOTOR management
Text Notes 3700 4650 0 118 ~ 0
End-switches (EPs)
$Comp
L CONN_5 P4
U 1 1 530DF06A
P 3750 5200
F 0 "P4" H 3800 5500 50 0000 C CNN
F 1 "CONN_5" V 3900 5200 50 0000 C CNN
F 2 "" H 3750 5200 60 0000 C CNN
F 3 "" H 3750 5200 60 0000 C CNN
1 3750 5200
-1 0 0 1
$EndComp
$Comp
L CONN_5_ P7
U 1 1 530DF308
P 8600 1350
F 0 "P7" H 8650 1050 50 0000 C CNN
F 1 "CONN_5_" V 8750 1350 50 0000 C CNN
F 2 "" H 8600 1350 60 0000 C CNN
F 3 "" H 8600 1350 60 0000 C CNN
1 8600 1350
-1 0 0 1
$EndComp
Wire Wire Line
4150 5000 4700 5000
Wire Wire Line
4150 5200 4700 5200
Wire Wire Line
4150 5400 4700 5400
Wire Wire Line
4150 5100 4450 5100
Wire Wire Line
4150 5300 4450 5300
Text Notes 3500 4850 0 98 ~ 0
Motor 0
Text Label 4700 5000 0 59 ~ 0
PC7
Text Label 4450 5100 0 59 ~ 0
PC6
Text Label 4700 5200 0 59 ~ 0
PC5
Text Label 4450 5300 0 59 ~ 0
PC4
Text Label 4700 5400 0 59 ~ 0
PC3
$Comp
L CONN_5 P5
U 1 1 530DF803
P 3750 6100
F 0 "P5" H 3800 6400 50 0000 C CNN
F 1 "CONN_5" V 3900 6100 50 0000 C CNN
F 2 "" H 3750 6100 60 0000 C CNN
F 3 "" H 3750 6100 60 0000 C CNN
1 3750 6100
-1 0 0 1
$EndComp
Wire Wire Line
4150 6100 4700 6100
Wire Wire Line
4150 6300 4700 6300
Wire Wire Line
4150 6000 4450 6000
Wire Wire Line
4150 6200 4450 6200
Text Notes 3500 5750 0 98 ~ 0
Motor 1
Text Label 4450 6000 0 59 ~ 0
PB3
Text Label 4700 6100 0 59 ~ 0
PB2
Text Label 4450 6200 0 59 ~ 0
PB1
Text Label 4700 6300 0 59 ~ 0
PB0
NoConn ~ 4150 5900
$Comp
L CONN_5 P6
U 1 1 530DF8E3
P 3750 7000
F 0 "P6" H 3800 7300 50 0000 C CNN
F 1 "CONN_5" V 3900 7000 50 0000 C CNN
F 2 "" H 3750 7000 60 0000 C CNN
F 3 "" H 3750 7000 60 0000 C CNN
1 3750 7000
-1 0 0 1
$EndComp
Wire Wire Line
4150 7000 4700 7000
Wire Wire Line
4150 7200 4700 7200
Wire Wire Line
4150 6900 4450 6900
Wire Wire Line
4150 7100 4450 7100
Text Notes 3500 6650 0 98 ~ 0
Motor 2
Text Label 4450 6900 0 59 ~ 0
OSC2IN/PA2
Text Label 4700 7000 0 59 ~ 0
OSC1IN/PA1
Text Label 4450 7100 0 59 ~ 0
PB5
Text Label 4700 7200 0 59 ~ 0
PB4
NoConn ~ 4150 6800
Text Notes 1300 5050 0 59 ~ 0
DIR\nEN\nCLK
Text Notes 1300 5650 0 59 ~ 0
DIR\nEN\nCLK
Text Notes 1300 6250 0 59 ~ 0
DIR\nEN\nCLK
Text Notes 4150 5000 0 63 ~ 0
4\n3\n2\n1\n0
Text Notes 4150 5900 0 63 ~ 0
4\n3\n2\n1\n0
Text Notes 4150 6800 0 63 ~ 0
4\n3\n2\n1\n0
$EndSCHEMATC

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,242 @@
/*
* stepper.c
*
* Copyright 2014 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "ports_definition.h"
#include "stepper.h"
volatile int Nsteps[3]={0,0,0}; // Number of steps
volatile int usteps[3] = {0,0,0};// microstepping counters
U8 Motor_number = 5; // Number of motor to move, 5 -- not moving
U16 Stepper_speed[3] = {1000,1000,1000}; // length of one MICROstep in us
U8* Timers[3] = {0x5250, 0x5300, 0x5320}; // {&TIM1_CR1, &TIM2_CR1, &TIM3_CR1}
U8 EPs[3] = {0,0,0}; // value of conditional stop-on-EP terminals status
U8 Stop_on_EP[3] = {0,0,0}; // boolean: whether motor should freely move or stop on EPs
U8 USteps = 16; // amount of microsteps on each step
U8 StepperInfty = 0; // infinity moving
#define pause_motor(N) *Timers[N] &= ~TIM_CR1_CEN
#define resume_motor(N) *Timers[N] |= TIM_CR1_CEN
#define check_motor(N) *Timers[N] & TIM_CR1_CEN
#define PPOUT(P, PIN) do{PORT(P, DDR) |= PIN; PORT(P, CR1) |= PIN;}while(0)
#define _MTR(X, N) PPOUT(STP ## N ## _ ## X ## _PORT, STP ## N ## _ ## X ## _PIN)
#define SETUP_MOTOR_PORT(X) do{_MTR(X,0); _MTR(X,1); _MTR(X,2);}while(0)
#define TMR(a, b) CONCAT(a , b)
#define TIMER_CONF(reg, val) do{TMR(TIM1, reg) = val; TMR(TIM2, reg) = val; TMR(TIM3, reg) = val;}while(0)
/**
* Setup pins of stepper motor (all - PP out) & timers
*/
void setup_stepper_pins(){
// CLK
SETUP_MOTOR_PORT(CLK);
// DIR
SETUP_MOTOR_PORT(DIR);
// EN
SETUP_MOTOR_PORT(EN);
// End point switches:
SETUP_EP(0);
SETUP_EP(1);
SETUP_EP(2);
/**** TIMERS (all - 1MHz, default speed - 1000 Hz) ****/
// Motor x - timer x+1
TIM1_PSCRH = 0; // this timer have 16 bit prescaler
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
TIM2_PSCR = 4;
TIM3_PSCR = 4;
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
TIMER_CONF(ARRH, 0x03);
TIMER_CONF(ARRL, 0xE8);
// 50% duty cycle: TIM_CCR = 500 = 0x01F4
TIMER_CONF(CCR1H, 0x01);
TIMER_CONF(CCR1L, 0xF4);
// channel 1 generates PWM pulses
TIMER_CONF(CCMR1, 0x60); // OC1M = 110b - PWM mode 1 ( 1 -> 0)
TIMER_CONF(CCER1, 1); // Channel 1 is on. Active is high
// interrupts: update
TIMER_CONF(IER, TIM_IER_UIE);
// auto-reload + interrupt on overflow
TIMER_CONF(CR1, TIM_CR1_APRE | TIM_CR1_URS);
// enable PWM output for timer1
TIM1_BKR |= 0x80; // MOE
// Turn off EN
PORT(STP0_EN_PORT, ODR) |= STP0_EN_PIN;
PORT(STP1_EN_PORT, ODR) |= STP1_EN_PIN;
PORT(STP2_EN_PORT, ODR) |= STP2_EN_PIN;
}
/**
* Set speed of stepper motor
* @param N - number of motor
* @param Sps - period (in us) of one MICROstep
*/
void set_stepper_speed(U8 N, U16 SpS){
U8 AH, AL, CH, CL;
if(N > 2) return;
Stepper_speed[N] = SpS;
AH = SpS >> 8;
AL = SpS & 0xff;
SpS >>= 1; // divide to 2 - 50% duty cycle
CH = SpS >> 8;
CL = SpS & 0xff;
switch(N){
case 0:
TIM1_ARRH = AH;
TIM1_ARRL = AL;
TIM1_CCR1H = CH;
TIM1_CCR1L = CL;
break;
case 1:
TIM2_ARRH = AH;
TIM2_ARRL = AL;
TIM2_CCR1H = CH;
TIM2_CCR1L = CL;
break;
case 2:
TIM3_ARRH = AH;
TIM3_ARRL = AL;
TIM3_CCR1H = CH;
TIM3_CCR1L = CL;
break;
}
}
/**
* Move motor N for 'Steps' amount of steps
* @param N - number of motor
* @param Steps - number of steps to move (negative value means to move CCV)
*/
void move_motor(U8 N, int Steps){
if(N > 2) return;
pause_motor(N);
if(Steps < 0){// dir to left
switch(N){
case 0:
PORT(STP0_DIR_PORT, ODR) |= STP0_DIR_PIN;
break;
case 1:
PORT(STP1_DIR_PORT, ODR) |= STP1_DIR_PIN;
break;
case 2:
PORT(STP2_DIR_PORT, ODR) |= STP2_DIR_PIN;
break;
}
Steps *= -1;
}
// turn on EN
switch(N){
case 0:
PORT(STP0_EN_PORT, ODR) &= ~STP0_EN_PIN;
break;
case 1:
PORT(STP1_EN_PORT, ODR) &= ~STP1_EN_PIN;
break;
case 2:
PORT(STP2_EN_PORT, ODR) &= ~STP2_EN_PIN;
break;
}
Nsteps[N] = Steps;
resume_motor(N);
uart_write("move");
printUint(&N, 1);
}
/**
* Stop motor N
* @param N - number of motor
*/
void stop_motor(U8 N){
if(N > 2) return;
pause_motor(N);
switch(N){ // turn off DIR & EN
case 0:
PORT(STP0_DIR_PORT, ODR) &= ~STP0_DIR_PIN;
PORT(STP0_EN_PORT, ODR) |= STP0_EN_PIN;
break;
case 1:
PORT(STP1_DIR_PORT, ODR) &= ~STP1_DIR_PIN;
PORT(STP1_EN_PORT, ODR) |= STP1_EN_PIN;
break;
case 2:
PORT(STP2_DIR_PORT, ODR) &= ~STP2_DIR_PIN;
PORT(STP2_EN_PORT, ODR) |= STP2_EN_PIN;
break;
}
StepperInfty = 0; // clear infinity flag
Nsteps[N] = 0;
usteps[N] = 0;
uart_write("stop");
printUint(&N, 1);
}
/**
* Pause or resume motor N
* @param N - number of motor
*/
void pause_resume(U8 N){
if(N > 2) return;
if(Nsteps[N] == 0) return; // motor is stopped
if(check_motor(N)){ // motor is running - pause
pause_motor(N);
uart_write("pause");
}else{ // resume
resume_motor(N);
uart_write("resume");
}
printUint(&N, 1);
}
/**
* Get current value of EP switches
* @param N - number of motor
* @return value of EPs
*/
U8 get_ep_value(U8 N){
U8 val = 0;
switch(N){
case 0:
val = READ_EP(0);
break;
case 1:
val = READ_EP(1);
break;
case 2:
val = READ_EP(2);
break;
}
return val;
}
/**
* Checks for "stop-on-EP" condition
* @param
* @return
*/
void check_EP(){
U8 i;
for(i = 0; i < 3; i++){
if(Stop_on_EP[i] == 0) continue;
if(EPs[i] == get_ep_value(i)){
stop_motor(i);
uart_write("endpoint\n");
// Stop_on_EP[i] = 0; // reset off-condition
}
}
}

View File

@@ -0,0 +1,47 @@
/*
* stepper.h
*
* Copyright 2014 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#pragma once
#ifndef __STEPPER_H__
#define __STEPPER_H__
#include "ports_definition.h"
#include "main.h"
extern volatile int Nsteps[];
extern volatile int usteps[];
extern U16 Stepper_speed[];
extern U8 EPs[];
extern U8 Stop_on_EP[];
extern U8 USteps;
extern U8 StepperInfty;
void setup_stepper_pins();
void set_stepper_speed(U8 N, U16 SpS);
void move_motor(U8 N, int Steps);
void stop_motor(U8 N);
void pause_resume(U8 N);
U8 get_ep_value(U8 N);
void check_EP();
#endif // __STEPPER_H__

Binary file not shown.