Added alpha-version of schematic + beginning of code (drill)

This commit is contained in:
eddyem 2014-08-17 23:57:11 +04:00
parent c83210631f
commit 359cae8bbd
26 changed files with 4676 additions and 1 deletions

34
microdrill/Makefile Normal file
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).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

186
microdrill/interrupts.c Normal file
View File

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

144
microdrill/interrupts.h Normal file
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__

263
microdrill/main.c Normal file
View File

@ -0,0 +1,263 @@
/*
* blinky.c
*
* Copyright 2014 Edward V. Emelianoff <eddy@sao.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "ports_definition.h"
#include "interrupts.h"
#include "main.h"
#include "stepper.h"
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)
/*
* 0 0000
* 1 0001
* 2 0010
* 3 0011
* 4 0100
* 5 0101
* 6 0110
* 7 0111
* 8 1000
* 9 1001
*10 1010
*11 1011
*12 1100
*13 1101
*14 1110
*15 1111
*/
// microsteps: DCBA = 1000, 1100, 0100, 0110, 0010, 0011, 0001, 1001 -- for ULN
// what a shit is this > DCBA = 0001, 0010, 0110, 1010, 1001, 1000, 0100, 0000 - bipolar
// 1000, 1010, 0010, 0110, 0100, 0101, 0001, 1001 - half-step
// 1010, 0110, 0101, 1001 - full step
char usteps[8] =
#ifdef MOTOR_TYPE_UNIPOLAR
{8, 12, 4, 6, 2, 3, 1, 9}; // ULN - unipolar
#elif defined MOTOR_TYPE_BIPOLAR
{8, 10, 2, 6, 4, 5, 1, 9}; // bipolar
#else
#error Define MOTOR_TYPE_UNIPOLAR or MOTOR_TYPE_BIPOLAR
#endif
/**
* Send one byte through UART
* @param byte - data to send
*/
void UART_send_byte(U8 byte){
while(!(UART2_SR & UART_SR_TXE)); // wait until previous byte transmitted
UART2_DR = byte;
}
void uart_write(char *str){
while(*str){
while(!(UART2_SR & UART_SR_TXE));
UART2_CR2 |= UART_CR2_TEN;
UART2_DR = *str++;
}
}
/**
* Read one byte from Rx buffer
* @param byte - where to store readed data
* @return 1 in case of non-empty buffer
*/
U8 UART_read_byte(U8 *byte){
if(UART_rx_start_i == UART_rx_cur_i) // buffer is empty
return 0;
*byte = UART_rx[UART_rx_start_i++];
check_UART_pointer(UART_rx_start_i);
return 1;
}
void printUint(U8 *val, U8 len){
unsigned long Number = 0;
U8 i = len;
char ch;
U8 decimal_buff[12]; // max len of U32 == 10 + \n + \0
if(len > 4 || len == 3 || len == 0) return;
for(i = 0; i < 12; i++)
decimal_buff[i] = 0;
decimal_buff[10] = '\n';
ch = 9;
switch(len){
case 1:
Number = *((U8*)val);
break;
case 2:
Number = *((U16*)val);
break;
case 4:
Number = *((unsigned long*)val);
break;
}
do{
i = Number % 10L;
decimal_buff[ch--] = i + '0';
Number /= 10L;
}while(Number && ch > -1);
uart_write((char*)&decimal_buff[ch+1]);
}
U8 readInt(int *val){
unsigned long T = Global_time;
unsigned long R = 0;
int readed;
U8 sign = 0, rb, ret = 0, bad = 0;
do{
if(!UART_read_byte(&rb)) continue;
if(rb == '-' && R == 0){ // negative number
sign = 1;
continue;
}
if(rb < '0' || rb > '9') break; // number ends with any non-digit symbol that will be omitted
ret = 1; // there's at least one digit
R = R * 10L + rb - '0';
if(R > 0x7fff){ // bad value
R = 0;
bad = 0;
}
}while(Global_time - T < 10000); // wait no longer than 10s
if(bad || !ret) return 0;
readed = (int) R;
if(sign) readed *= -1;
*val = readed;
return 1;
}
void error_msg(char *msg){
uart_write("\nERROR: ");
uart_write(msg);
UART_send_byte('\n');
}
int main() {
unsigned long T = 0L;
int Ival;
U8 rb;
CFG_GCR |= 1; // disable SWIM
// Configure clocking
CLK_CKDIVR = 0; // F_HSI = 16MHz, f_CPU = 16MHz
// Configure timer 1 - systick
// prescaler = f_{in}/f_{tim1} - 1
// set Timer1 to 1MHz: 1/1 - 1 = 15
TIM1_PSCRH = 0;
TIM1_PSCRL = 15; // LSB should be written last as it updates prescaler
// auto-reload each 1ms: TIM_ARR = 1000 = 0x03E8
TIM1_ARRH = 0x03;
TIM1_ARRL = 0xE8;
// interrupts: update
TIM1_IER = TIM_IER_UIE;
// auto-reload + interrupt on overflow + enable
TIM1_CR1 = TIM_CR1_APRE | TIM_CR1_URS | TIM_CR1_CEN;
// Configure pins
// PC2 - PP output (on-board LED)
PORT(LED_PORT, DDR) |= LED_PIN;
PORT(LED_PORT, CR1) |= LED_PIN;
// PD5 - UART2_TX
PORT(UART_PORT, DDR) |= UART_TX_PIN;
PORT(UART_PORT, CR1) |= UART_TX_PIN;
// Configure UART
// 8 bit, no parity, 1 stop (UART_CR1/3 = 0 - reset value)
// 57600 on 16MHz: BRR1=0x11, BRR2=0x06
UART2_BRR1 = 0x11; UART2_BRR2 = 0x06;
UART2_CR2 = UART_CR2_TEN | UART_CR2_REN | UART_CR2_RIEN; // Allow RX/TX, generate ints on rx
// enable all interrupts
enableInterrupts();
set_stepper_speed(1000);
setup_stepper_pins();
// Loop
do{
if((Global_time - T > paused_val) || (T > Global_time)){
T = Global_time;
PORT(LED_PORT, ODR) ^= LED_PIN; // blink on-board LED
}
if(UART_read_byte(&rb)){ // buffer isn't empty
switch(rb){
case 'h': // help
case 'H':
uart_write("\nPROTO:\n+/-\tLED period\nS/s\tset/get Mspeed\n"
"m\tget steps\nx\tstop\np\tpause/resume\nM\tmove motor\na\tadd Nstps\n"
"u\tunipolar motor\nb\tbipolar motor\n");
break;
case '+':
paused_val += 100;
if(paused_val > 10000)
paused_val = 500; // but not more than 10s
break;
case '-':
paused_val -= 100;
if(paused_val < 100) // but not less than 0.1s
paused_val = 500;
break;
case 'S': // set stepper speed
if(readInt(&Ival) && Ival > MIN_STEP_LENGTH)
set_stepper_speed(Ival);
else
error_msg("bad speed");
break;
case 's': // get stepper speed
printUint((U8*)&Stepper_speed, 2);
break;
case 'm': // how much steps there is to the end of moving
printUint((U8*)&Nsteps, 4);
break;
case 'M': // move motor
if(Nsteps){
error_msg("moving!");
break;
}
if(readInt(&Ival) && Ival)
move_motor(Ival);
else{
error_msg("bad Nsteps");
}
break;
case 'x': // stop
stop_motor();
break;
case 'p': // pause/resume
pause_resume();
break;
case 'a': // add N steps
if(readInt(&Ival) && Ival){
add_steps(Ival);
}else{
error_msg("bad value");
}
break;
}
}
}while(1);
}

43
microdrill/main.h Normal file
View File

@ -0,0 +1,43 @@
/*
* 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
extern char usteps[]; // current array for microsteps
#define UART_BUF_LEN 8 // max 7 bytes transmited in on operation
#define MIN_STEP_LENGTH 125 // max speed == 1/(125us*16) = 500 steps per second
extern U8 UART_rx[];
extern U8 UART_rx_start_i;
extern U8 UART_rx_cur_i;
void UART_send_byte(U8 byte);
void uart_write(char *str);
void printUint(U8 *val, U8 len);
void error_msg(char *msg);
#define check_UART_pointer(x) if(x == UART_BUF_LEN) x = 0;
#endif // __MAIN_H__

View File

@ -0,0 +1,65 @@
/*
* 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"
/*
* Stepper Motor type:
* MOTOR_TYPE_UNIPOLAR for 5-wires unipolar motors with darlington array as driver
* MOTOR_TYPE_BIPOLAR for 4-wires bipolar motor with L9110-like H-bridges
*/
#define MOTOR_TYPE_BIPOLAR
// macro for using in port constructions like PORT(LED_PORT, ODR) = xx
#define CONCAT(a, b) a ## _ ## b
#define PORT(a, b) CONCAT(a , b)
// on-board LED
#define LED_PORT PC
#define LED_PIN GPIO_PIN2
// UART2_TX
#define UART_PORT PD
#define UART_TX_PIN GPIO_PIN5
/***** Stepper motor *****/
// Clocking
#define STP_PORT PB // PB0..3 -- pins A..D of stepper
#endif // __PORTS_DEFINITION_H__
/*
* PORTS:
* DRILL
* PC1 - PWM (TIM1_CH1)
* PF4 - Sence (AIN12)
* PC4 - Pedal switch
* Stepper motor
* PB0, PB1, PB2, PB3 - phases of motor
* Slider (tray) motor
* PB4, PB5 - rotation direction
* PC2 - down end-switch
* PC3 - up end-switch
*/

View File

@ -0,0 +1,30 @@
EESchema-LIBRARY Version 2.3 Date: Вс 17 авг 2014 22:02:27
#encoding utf-8
#
# L9110
#
DEF L9110 DA 0 40 Y Y 1 F N
F0 "DA" 0 -300 50 H V C CNN
F1 "L9110" 0 300 50 H V C CNN
F2 "~" 0 0 50 H I C CNN
F3 "~" 0 0 50 H I C CNN
$FPLIST
DIP8*
DIP-8*
SOP8*
SOP-8*
$ENDFPLIST
DRAW
S -300 250 300 -250 0 1 0 N
X OA 1 -600 150 300 R 50 50 1 1 O
X VCC 2 -600 50 300 R 50 50 1 1 W
X VCC 3 -600 -50 300 R 50 50 1 1 W
X OB 4 -600 -150 300 R 50 50 1 1 O
X GND 5 600 -150 300 L 50 50 1 1 W
X IA 6 600 -50 300 L 50 50 1 1 I
X IB 7 600 50 300 L 50 50 1 1 I
X GND 8 600 150 300 L 50 50 1 1 W
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1,23 @@
EESchema-LIBRARY Version 2.3 Date: Вт 15 июл 2014 17:36:10
#encoding utf-8
#
# LM1117MPX-3.3
#
DEF LM1117MPX-3.3 U 0 40 Y Y 1 F N
F0 "U" -200 200 40 H V C CNN
F1 "LM1117MPX-3.3" 0 200 40 H V L CNN
F2 "SOT223" 0 100 30 H I C CIN
F3 "~" 0 0 60 H V C CNN
ALIAS LM317AEMP
$FPLIST
SOT223*
$ENDFPLIST
DRAW
S -250 150 250 -150 0 1 10 f
X GND 1 0 -250 100 U 40 40 1 1 W
X OUT 2 400 50 150 L 40 40 1 1 w
X IN 3 -400 50 150 R 40 40 1 1 W
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1,206 @@
Cmp-Mod V01 Created by CvPcb (2013-may-18)-stable date = Вс 17 авг 2014 22:58:37
BeginCmp
TimeStamp = /52FB0413;
Reference = C1;
ValeurCmp = 1u;
IdModule = SM1206;
EndCmp
BeginCmp
TimeStamp = /52FB0426;
Reference = C2;
ValeurCmp = 104;
IdModule = SM0603_Capa;
EndCmp
BeginCmp
TimeStamp = /52FB0F99;
Reference = C3;
ValeurCmp = 104;
IdModule = SM0603_Capa;
EndCmp
BeginCmp
TimeStamp = /53F0F83E;
Reference = C4;
ValeurCmp = 0.1u;
IdModule = SM0603;
EndCmp
BeginCmp
TimeStamp = /53F0F88C;
Reference = C5;
ValeurCmp = 47u;
IdModule = SM1206;
EndCmp
BeginCmp
TimeStamp = /52FB0DD3;
Reference = D1;
ValeurCmp = LED;
IdModule = LED-0603;
EndCmp
BeginCmp
TimeStamp = /52FB0ECD;
Reference = D2;
ValeurCmp = LED;
IdModule = LED-0603;
EndCmp
BeginCmp
TimeStamp = /53EF036E/53E68EA1;
Reference = D3;
ValeurCmp = DIODESCH;
IdModule = D4;
EndCmp
BeginCmp
TimeStamp = /53F0EE9F;
Reference = DA1;
ValeurCmp = L9110;
IdModule = SOP8;
EndCmp
BeginCmp
TimeStamp = /53F0EF24;
Reference = DA2;
ValeurCmp = L9110;
IdModule = SOP8;
EndCmp
BeginCmp
TimeStamp = /53F0EF3C;
Reference = DA3;
ValeurCmp = L9110;
IdModule = SOP8;
EndCmp
BeginCmp
TimeStamp = /53F0FD67;
Reference = K1;
ValeurCmp = POWER;
IdModule = PIN_ARRAY_3X1;
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 = /53F0F09A;
Reference = P3;
ValeurCmp = Stepper;
IdModule = SIL-4;
EndCmp
BeginCmp
TimeStamp = /53F1169C;
Reference = P4;
ValeurCmp = Slide;
IdModule = SIL-2;
EndCmp
BeginCmp
TimeStamp = /52FB0A79;
Reference = P5;
ValeurCmp = CONN_14;
IdModule = SIL-14;
EndCmp
BeginCmp
TimeStamp = /52FB4AA7;
Reference = P6;
ValeurCmp = CONN_5;
IdModule = SIL-5;
EndCmp
BeginCmp
TimeStamp = /53EF036E/53E67E05;
Reference = P7;
ValeurCmp = CONN_2;
IdModule = SIL-2;
EndCmp
BeginCmp
TimeStamp = /53EF036E/53E67E1E;
Reference = Q1;
ValeurCmp = MOS_N;
IdModule = ;
EndCmp
BeginCmp
TimeStamp = /52FB0DE2;
Reference = R1;
ValeurCmp = 1k;
IdModule = SM0603;
EndCmp
BeginCmp
TimeStamp = /52FB0ED3;
Reference = R2;
ValeurCmp = 1k;
IdModule = SM0603;
EndCmp
BeginCmp
TimeStamp = /52FB0EFD;
Reference = R3;
ValeurCmp = 10k;
IdModule = SM0603;
EndCmp
BeginCmp
TimeStamp = /53EF036E/53E680EF;
Reference = R4;
ValeurCmp = 1k;
IdModule = SM0603;
EndCmp
BeginCmp
TimeStamp = /53EF036E/53E67E8A;
Reference = R5;
ValeurCmp = 1R;
IdModule = R4;
EndCmp
BeginCmp
TimeStamp = /53EF036E/53E67E9C;
Reference = R6;
ValeurCmp = 1R;
IdModule = R4;
EndCmp
BeginCmp
TimeStamp = /52FB0F3B;
Reference = SW1;
ValeurCmp = SW_PUSH;
IdModule = 2PIN_6mm;
EndCmp
BeginCmp
TimeStamp = /52FB03A2;
Reference = U1;
ValeurCmp = STM8S105K4T6C;
IdModule = ;
EndCmp
BeginCmp
TimeStamp = /53F0F811;
Reference = U2;
ValeurCmp = LM1117MPX-3.3;
IdModule = SOT223;
EndCmp
EndListe

View File

@ -0,0 +1,101 @@
(kicad_pcb (version 3) (host pcbnew "(2013-may-18)-stable")
(general
(links 0)
(no_connects 0)
(area 0 0 0 0)
(thickness 1.6)
(drawings 0)
(tracks 0)
(zones 0)
(modules 0)
(nets 1)
)
(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.1)
(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.5 1.5)
(mod_edge_width 0.15)
(mod_text_size 1 1)
(mod_text_width 0.15)
(pad_size 1.5 1.5)
(pad_drill 0.6)
(pad_to_mask_clearance 0)
(aux_axis_origin 0 0)
(visible_elements FFFFFBBF)
(pcbplotparams
(layerselection 3178497)
(usegerberextensions true)
(excludeedgelayer true)
(linewidth 0.150000)
(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_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 "")
)
)

View File

@ -0,0 +1,572 @@
(export (version D)
(design
(source /sdh/Data/documents/00__Electronics/STM8/microdrill/schematics/MCU_module.sch)
(date "Вс 17 авг 2014 22:34:25")
(tool "eeschema (2013-may-18)-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 P5)
(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 P6)
(value CONN_5)
(libsource (lib conn) (part CONN_5))
(sheetpath (names /) (tstamps /))
(tstamp 52FB4AA7))
(comp (ref DA1)
(value L9110)
(libsource (lib L9110) (part L9110))
(sheetpath (names /) (tstamps /))
(tstamp 53F0EE9F))
(comp (ref DA2)
(value L9110)
(libsource (lib L9110) (part L9110))
(sheetpath (names /) (tstamps /))
(tstamp 53F0EF24))
(comp (ref DA3)
(value L9110)
(libsource (lib L9110) (part L9110))
(sheetpath (names /) (tstamps /))
(tstamp 53F0EF3C))
(comp (ref P3)
(value Stepper)
(libsource (lib conn) (part CONN_4))
(sheetpath (names /) (tstamps /))
(tstamp 53F0F09A))
(comp (ref U2)
(value LM1117MPX-3.3)
(footprint SOT223)
(libsource (lib LM1117) (part LM1117MPX-3.3))
(sheetpath (names /) (tstamps /))
(tstamp 53F0F811))
(comp (ref C4)
(value 0.1u)
(footprint SM0603)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 53F0F83E))
(comp (ref C5)
(value 47u)
(footprint SM1206)
(libsource (lib device) (part CP1))
(sheetpath (names /) (tstamps /))
(tstamp 53F0F88C))
(comp (ref K1)
(value POWER)
(libsource (lib conn) (part CONN_3))
(sheetpath (names /) (tstamps /))
(tstamp 53F0FD67))
(comp (ref P4)
(value Slide)
(libsource (lib conn) (part CONN_2))
(sheetpath (names /) (tstamps /))
(tstamp 53F1169C))
(comp (ref P7)
(value CONN_2)
(libsource (lib conn) (part CONN_2))
(sheetpath (names "/Drill motor/") (tstamps /53EF036E/))
(tstamp 53E67E05))
(comp (ref Q1)
(value MOS_N)
(libsource (lib device) (part MOS_N))
(sheetpath (names "/Drill motor/") (tstamps /53EF036E/))
(tstamp 53E67E1E))
(comp (ref R5)
(value 1R)
(libsource (lib device) (part R))
(sheetpath (names "/Drill motor/") (tstamps /53EF036E/))
(tstamp 53E67E8A))
(comp (ref R6)
(value 1R)
(libsource (lib device) (part R))
(sheetpath (names "/Drill motor/") (tstamps /53EF036E/))
(tstamp 53E67E9C))
(comp (ref R4)
(value 1k)
(libsource (lib device) (part R))
(sheetpath (names "/Drill motor/") (tstamps /53EF036E/))
(tstamp 53E680EF))
(comp (ref D3)
(value DIODESCH)
(libsource (lib device) (part DIODESCH))
(sheetpath (names "/Drill motor/") (tstamps /53EF036E/))
(tstamp 53E68EA1)))
(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 CP1)
(description "Condensateur polarise")
(footprints
(fp CP*)
(fp SM*))
(fields
(field (name Reference) C)
(field (name Value) CP1)
(field (name Footprint) ~)
(field (name Datasheet) ~))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib device) (part DIODESCH)
(description "Diode schottky")
(footprints
(fp D?)
(fp S*))
(fields
(field (name Reference) D)
(field (name Value) DIODESCH)
(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 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 MOS_N)
(docs transistors/mos/*.*)
(fields
(field (name Reference) Q)
(field (name Value) MOS_N)
(field (name Footprint) ~)
(field (name Datasheet) ~))
(pins
(pin (num D) (name D) (type passive))
(pin (num G) (name G) (type input))
(pin (num S) (name S) (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_2)
(description "Symbole general de connecteur")
(fields
(field (name Reference) P)
(field (name Value) CONN_2))
(pins
(pin (num 1) (name P1) (type passive))
(pin (num 2) (name PM) (type passive))))
(libpart (lib conn) (part CONN_3)
(description "Symbole general de connecteur")
(fields
(field (name Reference) K)
(field (name Value) CONN_3))
(pins
(pin (num 1) (name P1) (type passive))
(pin (num 2) (name PM) (type passive))
(pin (num 3) (name P3) (type passive))))
(libpart (lib conn) (part CONN_4)
(description "Symbole general de connecteur")
(fields
(field (name Reference) P)
(field (name Value) CONN_4))
(pins
(pin (num 1) (name P1) (type passive))
(pin (num 2) (name P2) (type passive))
(pin (num 3) (name P3) (type passive))
(pin (num 4) (name P4) (type passive))))
(libpart (lib conn) (part CONN_5)
(description "Symbole general de connecteur")
(fields
(field (name Reference) P)
(field (name Value) CONN_5))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))
(pin (num 3) (name ~) (type passive))
(pin (num 4) (name ~) (type passive))
(pin (num 5) (name ~) (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 LM1117) (part LM1117MPX-3.3)
(footprints
(fp SOT223*))
(fields
(field (name Reference) U)
(field (name Value) LM1117MPX-3.3)
(field (name Footprint) SOT223)
(field (name Datasheet) ~))
(pins
(pin (num 1) (name GND) (type power_in))
(pin (num 2) (name OUT) (type power_out))
(pin (num 3) (name IN) (type power_in))))
(libpart (lib L9110) (part L9110)
(footprints
(fp DIP8*)
(fp DIP-8*)
(fp SOP8*)
(fp SOP-8*))
(fields
(field (name Reference) DA)
(field (name Value) L9110))
(pins
(pin (num 1) (name OA) (type output))
(pin (num 2) (name VCC) (type power_in))
(pin (num 3) (name VCC) (type power_in))
(pin (num 4) (name OB) (type output))
(pin (num 5) (name GND) (type power_in))
(pin (num 6) (name IA) (type input))
(pin (num 7) (name IB) (type input))
(pin (num 8) (name GND) (type power_in)))))
(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))
(library (logical L9110)
(uri L9110.lib))
(library (logical LM1117)
(uri LM1117.lib)))
(nets
(net (code 1) (name "")
(node (ref DA2) (pin 4))
(node (ref P3) (pin 4)))
(net (code 2) (name "")
(node (ref DA2) (pin 1))
(node (ref P3) (pin 3)))
(net (code 3) (name /PB1)
(node (ref P1) (pin 11))
(node (ref U1) (pin 15))
(node (ref DA1) (pin 7)))
(net (code 4) (name /PB0)
(node (ref DA1) (pin 6))
(node (ref P1) (pin 12))
(node (ref U1) (pin 16)))
(net (code 5) (name /PB2)
(node (ref U1) (pin 14))
(node (ref P1) (pin 10))
(node (ref DA2) (pin 6)))
(net (code 6) (name "")
(node (ref P3) (pin 1))
(node (ref DA1) (pin 1)))
(net (code 7) (name "/Drill motor/Sence")
(node (ref U1) (pin 8))
(node (ref P1) (pin 6))
(node (ref R4) (pin 1)))
(net (code 8) (name "/Drill motor/PWM_in")
(node (ref P1) (pin 14))
(node (ref Q1) (pin G))
(node (ref U1) (pin 18)))
(net (code 9) (name "")
(node (ref DA1) (pin 4))
(node (ref P3) (pin 2)))
(net (code 10) (name /PB5)
(node (ref U1) (pin 11))
(node (ref P1) (pin 7))
(node (ref DA3) (pin 7)))
(net (code 11) (name /PB4)
(node (ref U1) (pin 12))
(node (ref P1) (pin 8))
(node (ref DA3) (pin 6)))
(net (code 12) (name /PB3)
(node (ref U1) (pin 13))
(node (ref DA2) (pin 7))
(node (ref P1) (pin 9)))
(net (code 13) (name /5.0V)
(node (ref P6) (pin 2)))
(net (code 14) (name GND)
(node (ref C5) (pin 2))
(node (ref U2) (pin 1))
(node (ref C4) (pin 2))
(node (ref K1) (pin 1))
(node (ref R2) (pin 2))
(node (ref SW1) (pin 1))
(node (ref C3) (pin 2))
(node (ref R5) (pin 2))
(node (ref R6) (pin 2))
(node (ref C2) (pin 1))
(node (ref P1) (pin 2))
(node (ref P2) (pin 4))
(node (ref U1) (pin 10))
(node (ref U1) (pin 4))
(node (ref C1) (pin 1))
(node (ref DA3) (pin 8))
(node (ref DA2) (pin 8))
(node (ref DA1) (pin 8))
(node (ref DA2) (pin 5))
(node (ref P6) (pin 5))
(node (ref DA1) (pin 5))
(node (ref DA3) (pin 5)))
(net (code 15) (name +3.3V)
(node (ref D1) (pin 1))
(node (ref R3) (pin 1))
(node (ref P2) (pin 1))
(node (ref P1) (pin 1))
(node (ref D2) (pin 1))
(node (ref C2) (pin 2))
(node (ref U1) (pin 6))
(node (ref U1) (pin 7))
(node (ref U1) (pin 9))
(node (ref C5) (pin 1))
(node (ref U2) (pin 2))
(node (ref P6) (pin 1)))
(net (code 16) (name /PD6)
(node (ref P6) (pin 3))
(node (ref U1) (pin 31))
(node (ref P5) (pin 2)))
(net (code 17) (name /PD5)
(node (ref P6) (pin 4))
(node (ref P5) (pin 3))
(node (ref U1) (pin 30)))
(net (code 18) (name "")
(node (ref DA3) (pin 1))
(node (ref P4) (pin 1)))
(net (code 19) (name "")
(node (ref P4) (pin 2))
(node (ref DA3) (pin 4)))
(net (code 20) (name +12V)
(node (ref P7) (pin 1))
(node (ref K1) (pin 3))
(node (ref D3) (pin 2)))
(net (code 21) (name +5V)
(node (ref DA1) (pin 3))
(node (ref DA3) (pin 3))
(node (ref DA3) (pin 2))
(node (ref DA2) (pin 2))
(node (ref DA2) (pin 3))
(node (ref DA1) (pin 2))
(node (ref K1) (pin 2))
(node (ref C4) (pin 1))
(node (ref U2) (pin 3)))
(net (code 22) (name /NRST)
(node (ref P2) (pin 3))
(node (ref SW1) (pin 2))
(node (ref R3) (pin 2))
(node (ref C3) (pin 1))
(node (ref P1) (pin 3))
(node (ref U1) (pin 1)))
(net (code 23) (name "")
(node (ref C1) (pin 2))
(node (ref U1) (pin 5)))
(net (code 24) (name /PC7)
(node (ref U1) (pin 24))
(node (ref P5) (pin 9)))
(net (code 25) (name /PC6)
(node (ref U1) (pin 23))
(node (ref P5) (pin 10)))
(net (code 26) (name /PD7)
(node (ref U1) (pin 32))
(node (ref P5) (pin 1)))
(net (code 27) (name /PC5)
(node (ref P5) (pin 11))
(node (ref U1) (pin 22)))
(net (code 28) (name /PC4)
(node (ref P5) (pin 12))
(node (ref U1) (pin 21)))
(net (code 29) (name /PD0)
(node (ref P5) (pin 8))
(node (ref U1) (pin 25)))
(net (code 30) (name /PC3)
(node (ref U1) (pin 20))
(node (ref P5) (pin 13)))
(net (code 31) (name /OSC2IN)
(node (ref P1) (pin 5))
(node (ref U1) (pin 3)))
(net (code 32) (name /OSC1IN)
(node (ref P1) (pin 4))
(node (ref U1) (pin 2)))
(net (code 33) (name /PD4)
(node (ref U1) (pin 29))
(node (ref P5) (pin 4)))
(net (code 34) (name /PC2)
(node (ref R1) (pin 2))
(node (ref P5) (pin 14))
(node (ref U1) (pin 19)))
(net (code 35) (name /PD3)
(node (ref P5) (pin 5))
(node (ref U1) (pin 28)))
(net (code 36) (name /PD2)
(node (ref P5) (pin 6))
(node (ref U1) (pin 27)))
(net (code 37) (name /PE5)
(node (ref U1) (pin 17))
(node (ref P1) (pin 13)))
(net (code 38) (name /SWIM/PD1)
(node (ref U1) (pin 26))
(node (ref P2) (pin 2))
(node (ref P5) (pin 7)))
(net (code 39) (name "")
(node (ref R2) (pin 1))
(node (ref D2) (pin 2)))
(net (code 40) (name "")
(node (ref D1) (pin 2))
(node (ref R1) (pin 1)))
(net (code 41) (name "")
(node (ref P7) (pin 2))
(node (ref Q1) (pin D))
(node (ref D3) (pin 1)))
(net (code 42) (name "")
(node (ref Q1) (pin S))
(node (ref R5) (pin 1))
(node (ref R6) (pin 1))
(node (ref R4) (pin 2)))))

View File

@ -0,0 +1,88 @@
update=Вс 17 авг 2014 23:25:44
last_client=eeschema
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=" 0.600000"
PadDrillOvalY=" 0.600000"
PadSizeH=" 1.500000"
PadSizeV=" 1.500000"
PcbTextSizeV=" 1.500000"
PcbTextSizeH=" 1.500000"
PcbTextThickness=" 0.300000"
ModuleTextSizeV=" 1.000000"
ModuleTextSizeH=" 1.000000"
ModuleTextSizeThickness=" 0.150000"
SolderMaskClearance=" 0.000000"
SolderMaskMinWidth=" 0.000000"
DrawSegmentWidth=" 0.200000"
BoardOutlineThickness=" 0.100000"
ModuleOutlineThickness=" 0.150000"
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=smd_capacitors
LibName7=smd_resistors
LibName8=smd_crystal&oscillator
LibName9=smd_dil
LibName10=smd_transistors
LibName11=libcms
LibName12=display
LibName13=led
LibName14=dip_sockets
LibName15=pga_sockets
LibName16=valves
LibName17=SOP8
[eeschema]
version=1
LibDir=
NetFmtName=
RptD_X=0
RptD_Y=100
RptLab=1
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
LibName31=stm8s105k4t6c
LibName32=L9110
LibName33=LM1117
LibName34=s8205a

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
PCBNEW-LibModule-V1
$INDEX
SOP8
$EndINDEX
$MODULE SOP8
Po 0 0 0 15 0 0 ~~
Li SOP8
Sc 0
Op 0 0 0
T0 0 0 600 600 0 120 N V 21 "Test"
T1 0 0 600 600 0 120 N V 21 "VAL**"
DS -2125 -2125 2125 -2125 78 21
DS 2125 -2125 2125 2125 78 21
DS -2125 2125 2125 2125 78 21
DS -2125 -2125 -2125 2125 78 21
DS -1838 2759 -1161 2759 78 21
DS -1838 3838 -1161 3838 78 21
DS -1838 2759 -1838 3838 78 21
$PAD
Sh "1" R 598 999 0 0 1800
Dr 0 0 0
At SMD N 00888000
Po -1499 3299
$EndPAD
$PAD
Sh "2" R 598 999 0 0 1800
Dr 0 0 0
At SMD N 00888000
Po -499 3299
$EndPAD
$PAD
Sh "3" R 598 999 0 0 1800
Dr 0 0 0
At SMD N 00888000
Po 499 3299
$EndPAD
$PAD
Sh "4" R 598 999 0 0 1800
Dr 0 0 0
At SMD N 00888000
Po 1499 3299
$EndPAD
$PAD
Sh "5" R 598 999 0 0 0
Dr 0 0 0
At SMD N 00888000
Po 1499 -3299
$EndPAD
$PAD
Sh "6" R 598 999 0 0 0
Dr 0 0 0
At SMD N 00888000
Po 499 -3299
$EndPAD
$PAD
Sh "7" R 598 999 0 0 0
Dr 0 0 0
At SMD N 00888000
Po -499 -3299
$EndPAD
$PAD
Sh "8" R 598 999 0 0 0
Dr 0 0 0
At SMD N 00888000
Po -1499 -3299
$EndPAD
$EndMODULE Test
$EndLIBRARY

View File

@ -0,0 +1,342 @@
EESchema Schematic File Version 2
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:texas
LIBS:contrib
LIBS:drill-cache
EELAYER 27 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date "9 aug 2014"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L LM555N U1
U 1 1 53E67DCE
P 3600 2600
F 0 "U1" H 3600 2700 70 0000 C CNN
F 1 "LM555N" H 3600 2500 70 0000 C CNN
F 2 "" H 3600 2600 60 0000 C CNN
F 3 "" H 3600 2600 60 0000 C CNN
1 3600 2600
1 0 0 -1
$EndComp
$Comp
L CONN_2 P1
U 1 1 53E67E05
P 5600 1900
F 0 "P1" V 5550 1900 40 0000 C CNN
F 1 "CONN_2" V 5650 1900 40 0000 C CNN
F 2 "" H 5600 1900 60 0000 C CNN
F 3 "" H 5600 1900 60 0000 C CNN
1 5600 1900
1 0 0 -1
$EndComp
Text Notes 5400 1650 0 60 ~ 0
Motor
$Comp
L MOS_N Q1
U 1 1 53E67E1E
P 5150 2400
F 0 "Q1" H 5160 2570 60 0000 R CNN
F 1 "MOS_N" H 5160 2250 60 0000 R CNN
F 2 "" H 5150 2400 60 0000 C CNN
F 3 "" H 5150 2400 60 0000 C CNN
1 5150 2400
1 0 0 -1
$EndComp
$Comp
L GND #PWR01
U 1 1 53E67E30
P 5250 3300
F 0 "#PWR01" H 5250 3300 30 0001 C CNN
F 1 "GND" H 5250 3230 30 0001 C CNN
F 2 "" H 5250 3300 60 0000 C CNN
F 3 "" H 5250 3300 60 0000 C CNN
1 5250 3300
1 0 0 -1
$EndComp
$Comp
L R R3
U 1 1 53E67E8A
P 5150 2950
F 0 "R3" V 5230 2950 50 0000 C CNN
F 1 "1R" V 5150 2950 50 0000 C CNN
F 2 "" H 5150 2950 60 0000 C CNN
F 3 "" H 5150 2950 60 0000 C CNN
1 5150 2950
1 0 0 -1
$EndComp
$Comp
L R R4
U 1 1 53E67E9C
P 5350 2950
F 0 "R4" V 5430 2950 50 0000 C CNN
F 1 "1R" V 5350 2950 50 0000 C CNN
F 2 "" H 5350 2950 60 0000 C CNN
F 3 "" H 5350 2950 60 0000 C CNN
1 5350 2950
1 0 0 -1
$EndComp
$Comp
L GND #PWR02
U 1 1 53E67ED3
P 1600 1750
F 0 "#PWR02" H 1600 1750 30 0001 C CNN
F 1 "GND" H 1600 1680 30 0001 C CNN
F 2 "" H 1600 1750 60 0000 C CNN
F 3 "" H 1600 1750 60 0000 C CNN
1 1600 1750
1 0 0 -1
$EndComp
Text Label 1600 1650 0 60 ~ 0
GND
$Comp
L VCC #PWR03
U 1 1 53E67EEC
P 1500 1400
F 0 "#PWR03" H 1500 1500 30 0001 C CNN
F 1 "VCC" H 1500 1500 30 0000 C CNN
F 2 "" H 1500 1400 60 0000 C CNN
F 3 "" H 1500 1400 60 0000 C CNN
1 1500 1400
-1 0 0 -1
$EndComp
Text Label 1600 1400 0 60 ~ 0
VCC
$Comp
L +12V #PWR04
U 1 1 53E67FAE
P 5250 1700
F 0 "#PWR04" H 5250 1650 20 0001 C CNN
F 1 "+12V" H 5250 1800 30 0000 C CNN
F 2 "" H 5250 1700 60 0000 C CNN
F 3 "" H 5250 1700 60 0000 C CNN
1 5250 1700
1 0 0 -1
$EndComp
$Comp
L C C1
U 1 1 53E68028
P 2550 2100
F 0 "C1" H 2600 2200 50 0000 L CNN
F 1 "1u" H 2600 2000 50 0000 L CNN
F 2 "" H 2550 2100 60 0000 C CNN
F 3 "" H 2550 2100 60 0000 C CNN
1 2550 2100
0 -1 -1 0
$EndComp
Text Label 2850 2900 2 60 ~ 0
VCC
$Comp
L GND #PWR05
U 1 1 53E680A2
P 2350 2200
F 0 "#PWR05" H 2350 2200 30 0001 C CNN
F 1 "GND" H 2350 2130 30 0001 C CNN
F 2 "" H 2350 2200 60 0000 C CNN
F 3 "" H 2350 2200 60 0000 C CNN
1 2350 2200
1 0 0 -1
$EndComp
$Comp
L R R1
U 1 1 53E680EF
P 4800 2700
F 0 "R1" V 4880 2700 50 0000 C CNN
F 1 "1k" V 4800 2700 50 0000 C CNN
F 2 "" H 4800 2700 60 0000 C CNN
F 3 "" H 4800 2700 60 0000 C CNN
1 4800 2700
0 -1 -1 0
$EndComp
$Comp
L POT RV1
U 1 1 53E682A8
P 2650 3250
F 0 "RV1" H 2650 3150 50 0000 C CNN
F 1 "POT" H 2650 3250 50 0000 C CNN
F 2 "" H 2650 3250 60 0000 C CNN
F 3 "" H 2650 3250 60 0000 C CNN
1 2650 3250
1 0 0 -1
$EndComp
$Comp
L GND #PWR06
U 1 1 53E682E7
P 2400 3350
F 0 "#PWR06" H 2400 3350 30 0001 C CNN
F 1 "GND" H 2400 3280 30 0001 C CNN
F 2 "" H 2400 3350 60 0000 C CNN
F 3 "" H 2400 3350 60 0000 C CNN
1 2400 3350
1 0 0 -1
$EndComp
$Comp
L PWR_FLAG #FLG07
U 1 1 53E68640
P 1300 1400
F 0 "#FLG07" H 1300 1495 30 0001 C CNN
F 1 "PWR_FLAG" H 1300 1580 30 0000 C CNN
F 2 "" H 1300 1400 60 0000 C CNN
F 3 "" H 1300 1400 60 0000 C CNN
1 1300 1400
-1 0 0 -1
$EndComp
$Comp
L PWR_FLAG #FLG08
U 1 1 53E68677
P 1500 1650
F 0 "#FLG08" H 1500 1745 30 0001 C CNN
F 1 "PWR_FLAG" H 1500 1830 30 0000 C CNN
F 2 "" H 1500 1650 60 0000 C CNN
F 3 "" H 1500 1650 60 0000 C CNN
1 1500 1650
1 0 0 -1
$EndComp
$Comp
L PWR_FLAG #FLG09
U 1 1 53E68727
P 1350 2100
F 0 "#FLG09" H 1350 2195 30 0001 C CNN
F 1 "PWR_FLAG" H 1350 2280 30 0000 C CNN
F 2 "" H 1350 2100 60 0000 C CNN
F 3 "" H 1350 2100 60 0000 C CNN
1 1350 2100
1 0 0 -1
$EndComp
$Comp
L CONN_2 P2
U 1 1 53E688FF
P 950 1500
F 0 "P2" V 900 1500 40 0000 C CNN
F 1 "CONN_2" V 1000 1500 40 0000 C CNN
F 2 "" H 950 1500 60 0000 C CNN
F 3 "" H 950 1500 60 0000 C CNN
1 950 1500
-1 0 0 1
$EndComp
$Comp
L CONN_2 P3
U 1 1 53E68B01
P 900 2200
F 0 "P3" V 850 2200 40 0000 C CNN
F 1 "CONN_2" V 950 2200 40 0000 C CNN
F 2 "" H 900 2200 60 0000 C CNN
F 3 "" H 900 2200 60 0000 C CNN
1 900 2200
-1 0 0 1
$EndComp
$Comp
L GND #PWR010
U 1 1 53E68B07
P 1350 2400
F 0 "#PWR010" H 1350 2400 30 0001 C CNN
F 1 "GND" H 1350 2330 30 0001 C CNN
F 2 "" H 1350 2400 60 0000 C CNN
F 3 "" H 1350 2400 60 0000 C CNN
1 1350 2400
1 0 0 -1
$EndComp
$Comp
L +12V #PWR011
U 1 1 53E68B3E
P 1500 2100
F 0 "#PWR011" H 1500 2050 20 0001 C CNN
F 1 "+12V" H 1500 2200 30 0000 C CNN
F 2 "" H 1500 2100 60 0000 C CNN
F 3 "" H 1500 2100 60 0000 C CNN
1 1500 2100
1 0 0 -1
$EndComp
Wire Wire Line
5250 3300 5250 3200
Wire Wire Line
1600 1650 1600 1750
Wire Wire Line
4300 2400 4950 2400
Wire Wire Line
5250 1700 5250 1800
Wire Wire Line
2650 2650 2900 2650
Wire Wire Line
2850 2900 2900 2900
Wire Wire Line
2350 2200 2350 2100
Wire Wire Line
2400 3350 2400 3250
Wire Wire Line
2900 2400 2900 2100
Wire Wire Line
2900 3250 2900 3100
Wire Wire Line
2900 3100 2650 3100
Wire Wire Line
2650 3100 2650 2650
Connection ~ 2650 3100
Wire Wire Line
1300 1400 1600 1400
Wire Wire Line
1300 1650 1600 1650
Wire Wire Line
1300 1650 1300 1600
Connection ~ 1500 1650
Connection ~ 1500 1400
Wire Wire Line
1350 2400 1350 2300
Wire Wire Line
1350 2300 1250 2300
Wire Wire Line
1250 2100 1500 2100
Connection ~ 1350 2100
Connection ~ 1300 1400
Wire Wire Line
5050 2700 5350 2700
Wire Wire Line
5250 2600 5250 2700
Connection ~ 5250 2700
Wire Wire Line
5150 3200 5350 3200
Connection ~ 5250 3200
Connection ~ 5150 2700
Wire Wire Line
5250 2000 5250 2200
$Comp
L DIODESCH D1
U 1 1 53E68EA1
P 5050 1900
F 0 "D1" H 5050 2000 40 0000 C CNN
F 1 "DIODESCH" H 5050 1800 40 0000 C CNN
F 2 "" H 5050 1900 60 0000 C CNN
F 3 "" H 5050 1900 60 0000 C CNN
1 5050 1900
0 -1 -1 0
$EndComp
Wire Wire Line
5050 1700 5250 1700
Connection ~ 5250 1700
Wire Wire Line
5050 2100 5250 2100
Connection ~ 5250 2100
Wire Wire Line
4550 2800 4300 2800
Wire Wire Line
4550 2100 4550 2800
Wire Wire Line
2750 2100 4550 2100
Connection ~ 4550 2700
Connection ~ 2900 2100
NoConn ~ 4300 2600
$EndSCHEMATC

View File

@ -0,0 +1,87 @@
Cmp-Mod V01 Created by CvPcb (2013-may-18)-stable date = Вс 10 авг 2014 01:04:15
BeginCmp
TimeStamp = /53E68028;
Reference = C1;
ValeurCmp = 1u;
IdModule = C1;
EndCmp
BeginCmp
TimeStamp = /53E68EA1;
Reference = D1;
ValeurCmp = DIODESCH;
IdModule = D5;
EndCmp
BeginCmp
TimeStamp = /53E67E05;
Reference = P1;
ValeurCmp = CONN_2;
IdModule = SIL-2;
EndCmp
BeginCmp
TimeStamp = /53E688FF;
Reference = P2;
ValeurCmp = CONN_2;
IdModule = SIL-2;
EndCmp
BeginCmp
TimeStamp = /53E68B01;
Reference = P3;
ValeurCmp = CONN_2;
IdModule = SIL-2;
EndCmp
BeginCmp
TimeStamp = /53E67E1E;
Reference = Q1;
ValeurCmp = MOS_N;
IdModule = TO220;
EndCmp
BeginCmp
TimeStamp = /53E680EF;
Reference = R1;
ValeurCmp = 10k;
IdModule = SM0805;
EndCmp
BeginCmp
TimeStamp = /53E680BB;
Reference = R2;
ValeurCmp = 1k;
IdModule = SM0805;
EndCmp
BeginCmp
TimeStamp = /53E67E8A;
Reference = R3;
ValeurCmp = 1R;
IdModule = R3;
EndCmp
BeginCmp
TimeStamp = /53E67E9C;
Reference = R4;
ValeurCmp = 1R;
IdModule = R3;
EndCmp
BeginCmp
TimeStamp = /53E682A8;
Reference = RV1;
ValeurCmp = POT;
IdModule = PIN_ARRAY_3X1;
EndCmp
BeginCmp
TimeStamp = /53E67DCE;
Reference = U1;
ValeurCmp = LM555N;
IdModule = DIP-8__300;
EndCmp
EndListe

View File

@ -0,0 +1,490 @@
(kicad_pcb (version 3) (host pcbnew "(2013-may-18)-stable")
(general
(links 18)
(no_connects 18)
(area 0 0 0 0)
(thickness 1.6)
(drawings 0)
(tracks 0)
(zones 0)
(modules 11)
(nets 10)
)
(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.1)
(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.5 1.5)
(mod_edge_width 0.15)
(mod_text_size 1 1)
(mod_text_width 0.15)
(pad_size 1.5 1.5)
(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 0.150000)
(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 +12V)
(net 2 GND)
(net 3 N-000001)
(net 4 N-000004)
(net 5 N-000006)
(net 6 N-000007)
(net 7 N-000008)
(net 8 N-000009)
(net 9 VCC)
(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 +12V)
(add_net GND)
(add_net N-000001)
(add_net N-000004)
(add_net N-000006)
(add_net N-000007)
(add_net N-000008)
(add_net N-000009)
(add_net VCC)
)
(module TO220 (layer F.Cu) (tedit 200000) (tstamp 53E68525)
(at 135.636 19.431)
(descr "Transistor TO 220")
(tags "TR TO220 DEV")
(path /53E67E1E)
(fp_text reference Q1 (at 6.985 0 90) (layer F.SilkS)
(effects (font (size 1.016 1.016) (thickness 0.2032)))
)
(fp_text value MOS_N (at 10.795 0 90) (layer F.SilkS)
(effects (font (size 1.016 1.016) (thickness 0.2032)))
)
(fp_line (start 0 -2.54) (end 5.08 -2.54) (layer F.SilkS) (width 0.3048))
(fp_line (start 0 0) (end 5.08 0) (layer F.SilkS) (width 0.3048))
(fp_line (start 0 2.54) (end 5.08 2.54) (layer F.SilkS) (width 0.3048))
(fp_line (start 5.08 5.08) (end 20.32 5.08) (layer F.SilkS) (width 0.3048))
(fp_line (start 20.32 5.08) (end 20.32 -5.08) (layer F.SilkS) (width 0.3048))
(fp_line (start 20.32 -5.08) (end 5.08 -5.08) (layer F.SilkS) (width 0.3048))
(fp_line (start 5.08 -5.08) (end 5.08 5.08) (layer F.SilkS) (width 0.3048))
(fp_line (start 12.7 3.81) (end 12.7 -5.08) (layer F.SilkS) (width 0.3048))
(fp_line (start 12.7 3.81) (end 12.7 5.08) (layer F.SilkS) (width 0.3048))
(pad 1 thru_hole rect (at 0 2.54) (size 1.778 1.778) (drill 1.143)
(layers *.Cu *.Mask F.SilkS)
)
(pad 2 thru_hole circle (at 0 -2.54) (size 1.778 1.778) (drill 1.143)
(layers *.Cu *.Mask F.SilkS)
)
(pad 3 thru_hole circle (at 0 0) (size 1.778 1.778) (drill 1.143)
(layers *.Cu *.Mask F.SilkS)
)
(pad 4 thru_hole rect (at 16.51 0) (size 8.89 8.89) (drill 3.048)
(layers *.Cu *.SilkS *.Mask)
)
(model discret/to220_horiz.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
(module SM0805 (layer F.Cu) (tedit 42806E04) (tstamp 53E68532)
(at 152.781 29.718)
(path /53E680BB)
(attr smd)
(fp_text reference R2 (at 0 0) (layer F.SilkS)
(effects (font (size 0.635 0.635) (thickness 0.127)))
)
(fp_text value 1k (at 0 0) (layer F.SilkS) hide
(effects (font (size 0.635 0.635) (thickness 0.127)))
)
(fp_circle (center -1.651 0.762) (end -1.651 0.635) (layer F.SilkS) (width 0.127))
(fp_line (start -0.508 0.762) (end -1.524 0.762) (layer F.SilkS) (width 0.127))
(fp_line (start -1.524 0.762) (end -1.524 -0.762) (layer F.SilkS) (width 0.127))
(fp_line (start -1.524 -0.762) (end -0.508 -0.762) (layer F.SilkS) (width 0.127))
(fp_line (start 0.508 -0.762) (end 1.524 -0.762) (layer F.SilkS) (width 0.127))
(fp_line (start 1.524 -0.762) (end 1.524 0.762) (layer F.SilkS) (width 0.127))
(fp_line (start 1.524 0.762) (end 0.508 0.762) (layer F.SilkS) (width 0.127))
(pad 1 smd rect (at -0.9525 0) (size 0.889 1.397)
(layers F.Cu F.Paste F.Mask)
(net 4 N-000004)
)
(pad 2 smd rect (at 0.9525 0) (size 0.889 1.397)
(layers F.Cu F.Paste F.Mask)
(net 3 N-000001)
)
(model smd/chip_cms.wrl
(at (xyz 0 0 0))
(scale (xyz 0.1 0.1 0.1))
(rotate (xyz 0 0 0))
)
)
(module SM0805 (layer F.Cu) (tedit 42806E04) (tstamp 53E6853F)
(at 156.464 29.718)
(path /53E680EF)
(attr smd)
(fp_text reference R1 (at 0 0) (layer F.SilkS)
(effects (font (size 0.635 0.635) (thickness 0.127)))
)
(fp_text value 10k (at 0 0) (layer F.SilkS) hide
(effects (font (size 0.635 0.635) (thickness 0.127)))
)
(fp_circle (center -1.651 0.762) (end -1.651 0.635) (layer F.SilkS) (width 0.127))
(fp_line (start -0.508 0.762) (end -1.524 0.762) (layer F.SilkS) (width 0.127))
(fp_line (start -1.524 0.762) (end -1.524 -0.762) (layer F.SilkS) (width 0.127))
(fp_line (start -1.524 -0.762) (end -0.508 -0.762) (layer F.SilkS) (width 0.127))
(fp_line (start 0.508 -0.762) (end 1.524 -0.762) (layer F.SilkS) (width 0.127))
(fp_line (start 1.524 -0.762) (end 1.524 0.762) (layer F.SilkS) (width 0.127))
(fp_line (start 1.524 0.762) (end 0.508 0.762) (layer F.SilkS) (width 0.127))
(pad 1 smd rect (at -0.9525 0) (size 0.889 1.397)
(layers F.Cu F.Paste F.Mask)
(net 9 VCC)
)
(pad 2 smd rect (at 0.9525 0) (size 0.889 1.397)
(layers F.Cu F.Paste F.Mask)
(net 3 N-000001)
)
(model smd/chip_cms.wrl
(at (xyz 0 0 0))
(scale (xyz 0.1 0.1 0.1))
(rotate (xyz 0 0 0))
)
)
(module R3 (layer F.Cu) (tedit 4E4C0E65) (tstamp 53E6854D)
(at 146.812 27.051)
(descr "Resitance 3 pas")
(tags R)
(path /53E67E8A)
(autoplace_cost180 10)
(fp_text reference R3 (at 0 0.127) (layer F.SilkS) hide
(effects (font (size 1.397 1.27) (thickness 0.2032)))
)
(fp_text value 1R (at 0 0.127) (layer F.SilkS)
(effects (font (size 1.397 1.27) (thickness 0.2032)))
)
(fp_line (start -3.81 0) (end -3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.81 0) (end 3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 1.016) (end 3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer F.SilkS) (width 0.2032))
(pad 1 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 5 N-000006)
)
(pad 2 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 6 N-000007)
)
(model discret/resistor.wrl
(at (xyz 0 0 0))
(scale (xyz 0.3 0.3 0.3))
(rotate (xyz 0 0 0))
)
)
(module R3 (layer F.Cu) (tedit 4E4C0E65) (tstamp 53E6855B)
(at 155.956 27.051)
(descr "Resitance 3 pas")
(tags R)
(path /53E67E9C)
(autoplace_cost180 10)
(fp_text reference R4 (at 0 0.127) (layer F.SilkS) hide
(effects (font (size 1.397 1.27) (thickness 0.2032)))
)
(fp_text value 1R (at 0 0.127) (layer F.SilkS)
(effects (font (size 1.397 1.27) (thickness 0.2032)))
)
(fp_line (start -3.81 0) (end -3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.81 0) (end 3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer F.SilkS) (width 0.2032))
(fp_line (start 3.302 1.016) (end 3.302 0) (layer F.SilkS) (width 0.2032))
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer F.SilkS) (width 0.2032))
(pad 1 thru_hole circle (at -3.81 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 5 N-000006)
)
(pad 2 thru_hole circle (at 3.81 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 6 N-000007)
)
(model discret/resistor.wrl
(at (xyz 0 0 0))
(scale (xyz 0.3 0.3 0.3))
(rotate (xyz 0 0 0))
)
)
(module DIP-8__300 (layer F.Cu) (tedit 43A7F843) (tstamp 53E6856E)
(at 163.703 17.78)
(descr "8 pins DIL package, round pads")
(tags DIL)
(path /53E67DCE)
(fp_text reference U1 (at -6.35 0 90) (layer F.SilkS)
(effects (font (size 1.27 1.143) (thickness 0.2032)))
)
(fp_text value LM555N (at 0 0) (layer F.SilkS)
(effects (font (size 1.27 1.016) (thickness 0.2032)))
)
(fp_line (start -5.08 -1.27) (end -3.81 -1.27) (layer F.SilkS) (width 0.254))
(fp_line (start -3.81 -1.27) (end -3.81 1.27) (layer F.SilkS) (width 0.254))
(fp_line (start -3.81 1.27) (end -5.08 1.27) (layer F.SilkS) (width 0.254))
(fp_line (start -5.08 -2.54) (end 5.08 -2.54) (layer F.SilkS) (width 0.254))
(fp_line (start 5.08 -2.54) (end 5.08 2.54) (layer F.SilkS) (width 0.254))
(fp_line (start 5.08 2.54) (end -5.08 2.54) (layer F.SilkS) (width 0.254))
(fp_line (start -5.08 2.54) (end -5.08 -2.54) (layer F.SilkS) (width 0.254))
(pad 1 thru_hole rect (at -3.81 3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 2 GND)
)
(pad 2 thru_hole circle (at -1.27 3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 5 N-000006)
)
(pad 3 thru_hole circle (at 1.27 3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 8 N-000009)
)
(pad 4 thru_hole circle (at 3.81 3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 9 VCC)
)
(pad 5 thru_hole circle (at 3.81 -3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 7 N-000008)
)
(pad 6 thru_hole circle (at 1.27 -3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 5 N-000006)
)
(pad 7 thru_hole circle (at -1.27 -3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 4 N-000004)
)
(pad 8 thru_hole circle (at -3.81 -3.81) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 9 VCC)
)
(model dil/dil_8.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
(module C1 (layer F.Cu) (tedit 3F92C496) (tstamp 53E68579)
(at 163.195 27.305)
(descr "Condensateur e = 1 pas")
(tags C)
(path /53E68028)
(fp_text reference C1 (at 0.254 -2.286) (layer F.SilkS)
(effects (font (size 1.016 1.016) (thickness 0.2032)))
)
(fp_text value 1u (at 0 -2.286) (layer F.SilkS) hide
(effects (font (size 1.016 1.016) (thickness 0.2032)))
)
(fp_line (start -2.4892 -1.27) (end 2.54 -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))
(fp_line (start 2.54 1.27) (end -2.54 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))
(fp_line (start -2.54 -0.635) (end -1.905 -1.27) (layer F.SilkS) (width 0.3048))
(pad 1 thru_hole circle (at -1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 3 N-000001)
)
(pad 2 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 2 GND)
)
(model discret/capa_1_pas.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
(module SIL-2 (layer F.Cu) (tedit 200000) (tstamp 53E6858E)
(at 137.033 30.353)
(descr "Connecteurs 2 pins")
(tags "CONN DEV")
(path /53E67E05)
(fp_text reference P1 (at 0 -2.54) (layer F.SilkS)
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
)
(fp_text value CONN_2 (at 0 -2.54) (layer F.SilkS) hide
(effects (font (size 1.524 1.016) (thickness 0.3048)))
)
(fp_line (start -2.54 1.27) (end -2.54 -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))
(fp_line (start 2.54 -1.27) (end 2.54 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 -1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 1 +12V)
)
(pad 2 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 5 N-000006)
)
)
(module SIL-2 (layer F.Cu) (tedit 200000) (tstamp 53E68611)
(at 142.621 30.353)
(descr "Connecteurs 2 pins")
(tags "CONN DEV")
(path /53E688FF)
(fp_text reference P2 (at 0 -2.54) (layer F.SilkS)
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
)
(fp_text value CONN_2 (at 0 -2.54) (layer F.SilkS) hide
(effects (font (size 1.524 1.016) (thickness 0.3048)))
)
(fp_line (start -2.54 1.27) (end -2.54 -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))
(fp_line (start 2.54 -1.27) (end 2.54 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 -1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 2 GND)
)
(pad 2 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 9 VCC)
)
)
(module SIL-2 (layer F.Cu) (tedit 200000) (tstamp 53E68622)
(at 148.082 30.353)
(descr "Connecteurs 2 pins")
(tags "CONN DEV")
(path /53E68B01)
(fp_text reference P3 (at 0 -2.54) (layer F.SilkS)
(effects (font (size 1.72974 1.08712) (thickness 0.3048)))
)
(fp_text value CONN_2 (at 0 -2.54) (layer F.SilkS) hide
(effects (font (size 1.524 1.016) (thickness 0.3048)))
)
(fp_line (start -2.54 1.27) (end -2.54 -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))
(fp_line (start 2.54 -1.27) (end 2.54 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 -1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 2 GND)
)
(pad 2 thru_hole circle (at 1.27 0) (size 1.397 1.397) (drill 0.8128)
(layers *.Cu *.Mask F.SilkS)
(net 1 +12V)
)
)
(module PIN_ARRAY_3X1 (layer F.Cu) (tedit 4C1130E0) (tstamp 53E68584)
(at 138.303 27.305)
(descr "Connecteur 3 pins")
(tags "CONN DEV")
(path /53E682A8)
(fp_text reference RV1 (at 0.254 -2.159) (layer F.SilkS)
(effects (font (size 1.016 1.016) (thickness 0.1524)))
)
(fp_text value POT (at 0 -2.159) (layer F.SilkS) hide
(effects (font (size 1.016 1.016) (thickness 0.1524)))
)
(fp_line (start -3.81 1.27) (end -3.81 -1.27) (layer F.SilkS) (width 0.1524))
(fp_line (start -3.81 -1.27) (end 3.81 -1.27) (layer F.SilkS) (width 0.1524))
(fp_line (start 3.81 -1.27) (end 3.81 1.27) (layer F.SilkS) (width 0.1524))
(fp_line (start 3.81 1.27) (end -3.81 1.27) (layer F.SilkS) (width 0.1524))
(fp_line (start -1.27 -1.27) (end -1.27 1.27) (layer F.SilkS) (width 0.1524))
(pad 1 thru_hole rect (at -2.54 0) (size 1.524 1.524) (drill 1.016)
(layers *.Cu *.Mask F.SilkS)
(net 2 GND)
)
(pad 2 thru_hole circle (at 0 0) (size 1.524 1.524) (drill 1.016)
(layers *.Cu *.Mask F.SilkS)
(net 7 N-000008)
)
(pad 3 thru_hole circle (at 2.54 0) (size 1.524 1.524) (drill 1.016)
(layers *.Cu *.Mask F.SilkS)
(net 7 N-000008)
)
(model pin_array/pins_array_3x1.wrl
(at (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)
)

View File

@ -0,0 +1,193 @@
(export (version D)
(design
(source /home/eddy/Docs/ELECTRONICS/STM8/STM8_samples/microdrill/schematics/drill.sch)
(date "Вс 10 авг 2014 01:04:08")
(tool "eeschema (2013-may-18)-stable"))
(components
(comp (ref U1)
(value LM555N)
(libsource (lib linear) (part LM555N))
(sheetpath (names /) (tstamps /))
(tstamp 53E67DCE))
(comp (ref P1)
(value CONN_2)
(libsource (lib conn) (part CONN_2))
(sheetpath (names /) (tstamps /))
(tstamp 53E67E05))
(comp (ref Q1)
(value MOS_N)
(libsource (lib device) (part MOS_N))
(sheetpath (names /) (tstamps /))
(tstamp 53E67E1E))
(comp (ref R3)
(value 1R)
(libsource (lib device) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 53E67E8A))
(comp (ref R4)
(value 1R)
(libsource (lib device) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 53E67E9C))
(comp (ref C1)
(value 1u)
(libsource (lib device) (part C))
(sheetpath (names /) (tstamps /))
(tstamp 53E68028))
(comp (ref R2)
(value 1k)
(libsource (lib device) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 53E680BB))
(comp (ref R1)
(value 10k)
(libsource (lib device) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 53E680EF))
(comp (ref RV1)
(value POT)
(libsource (lib device) (part POT))
(sheetpath (names /) (tstamps /))
(tstamp 53E682A8))
(comp (ref P2)
(value CONN_2)
(libsource (lib conn) (part CONN_2))
(sheetpath (names /) (tstamps /))
(tstamp 53E688FF))
(comp (ref P3)
(value CONN_2)
(libsource (lib conn) (part CONN_2))
(sheetpath (names /) (tstamps /))
(tstamp 53E68B01))
(comp (ref D1)
(value DIODESCH)
(libsource (lib device) (part DIODESCH))
(sheetpath (names /) (tstamps /))
(tstamp 53E68EA1)))
(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))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib device) (part DIODESCH)
(description "Diode schottky")
(footprints
(fp D?)
(fp S*))
(fields
(field (name Reference) D)
(field (name Value) DIODESCH))
(pins
(pin (num 1) (name A) (type passive))
(pin (num 2) (name K) (type passive))))
(libpart (lib device) (part MOS_N)
(docs transistors/mos/*.*)
(fields
(field (name Reference) Q)
(field (name Value) MOS_N))
(pins
(pin (num D) (name D) (type passive))
(pin (num G) (name G) (type input))
(pin (num S) (name S) (type passive))))
(libpart (lib device) (part POT)
(description Potentionmetre)
(fields
(field (name Reference) RV)
(field (name Value) POT))
(pins
(pin (num 1) (name 1) (type passive))
(pin (num 2) (name 2) (type passive))
(pin (num 3) (name 3) (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))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib conn) (part CONN_2)
(description "Symbole general de connecteur")
(fields
(field (name Reference) P)
(field (name Value) CONN_2))
(pins
(pin (num 1) (name P1) (type passive))
(pin (num 2) (name PM) (type passive))))
(libpart (lib linear) (part LM555N)
(docs ns/lm555.pdf)
(fields
(field (name Reference) U)
(field (name Value) LM555N))
(pins
(pin (num 1) (name GND) (type power_in))
(pin (num 2) (name TR) (type input))
(pin (num 3) (name Q) (type output))
(pin (num 4) (name R) (type input))
(pin (num 5) (name CV) (type input))
(pin (num 6) (name THR) (type input))
(pin (num 7) (name DIS) (type input))
(pin (num 8) (name VCC) (type power_in)))))
(libraries
(library (logical device)
(uri /usr/share/kicad/library/device.lib))
(library (logical linear)
(uri /usr/share/kicad/library/linear.lib))
(library (logical conn)
(uri /usr/share/kicad/library/conn.lib)))
(nets
(net (code 1) (name "")
(node (ref U1) (pin 7))
(node (ref R2) (pin 1)))
(net (code 2) (name "")
(node (ref U1) (pin 5))
(node (ref RV1) (pin 3))
(node (ref RV1) (pin 2)))
(net (code 3) (name "")
(node (ref Q1) (pin G))
(node (ref U1) (pin 3)))
(net (code 4) (name "")
(node (ref Q1) (pin D))
(node (ref D1) (pin 1))
(node (ref P1) (pin 2)))
(net (code 5) (name GND)
(node (ref R3) (pin 2))
(node (ref R4) (pin 2))
(node (ref P3) (pin 1))
(node (ref P2) (pin 1))
(node (ref RV1) (pin 1))
(node (ref U1) (pin 1))
(node (ref C1) (pin 2)))
(net (code 6) (name VCC)
(node (ref U1) (pin 4))
(node (ref U1) (pin 8))
(node (ref P2) (pin 2)))
(net (code 7) (name "")
(node (ref R1) (pin 2))
(node (ref Q1) (pin S))
(node (ref R4) (pin 1))
(node (ref R3) (pin 1)))
(net (code 8) (name +12V)
(node (ref D1) (pin 2))
(node (ref P3) (pin 2))
(node (ref P1) (pin 1)))
(net (code 9) (name "")
(node (ref C1) (pin 1))
(node (ref R2) (pin 2))
(node (ref R1) (pin 1))
(node (ref U1) (pin 2))
(node (ref U1) (pin 6)))))

View File

@ -0,0 +1,63 @@
update=Вс 10 авг 2014 00:29:49
version=1
last_client=cvpcb
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[pcbnew/libraries]
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=smd_capacitors
LibName7=smd_resistors
LibName8=smd_dil
LibName9=smd_transistors
LibName10=libcms
LibName11=display
LibName12=led
LibName13=dip_sockets
LibName14=pga_sockets
LibName15=valves
LibDir=
[general]
version=1
[eeschema]
version=1
LibDir=
NetFmtName=PcbnewAdvanced
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=texas
LibName8=contrib
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms

View File

@ -0,0 +1,214 @@
EESchema Schematic File Version 2
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers
LIBS:dsp
LIBS:microchip
LIBS:analog_switches
LIBS:motorola
LIBS:texas
LIBS:intel
LIBS:audio
LIBS:interface
LIBS:digital-audio
LIBS:philips
LIBS:display
LIBS:cypress
LIBS:siliconi
LIBS:opto
LIBS:atmel
LIBS:contrib
LIBS:valves
LIBS:stm8s105k4t6c
LIBS:L9110
LIBS:LM1117
LIBS:s8205a
LIBS:MCU_module-cache
EELAYER 27 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 2 2
Title ""
Date "17 aug 2014"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L CONN_2 P7
U 1 1 53E67E05
P 5725 3400
F 0 "P7" V 5675 3400 40 0000 C CNN
F 1 "CONN_2" V 5775 3400 40 0000 C CNN
F 2 "" H 5725 3400 60 0000 C CNN
F 3 "" H 5725 3400 60 0000 C CNN
1 5725 3400
1 0 0 -1
$EndComp
Text Notes 5525 3150 0 60 ~ 0
Motor
$Comp
L GND #PWR028
U 1 1 53E67E30
P 4800 5700
F 0 "#PWR028" H 4800 5700 30 0001 C CNN
F 1 "GND" H 4800 5630 30 0001 C CNN
F 2 "" H 4800 5700 60 0000 C CNN
F 3 "" H 4800 5700 60 0000 C CNN
1 4800 5700
1 0 0 -1
$EndComp
$Comp
L R R5
U 1 1 53E67E8A
P 4700 5350
F 0 "R5" V 4780 5350 50 0000 C CNN
F 1 "1R" V 4700 5350 50 0000 C CNN
F 2 "" H 4700 5350 60 0000 C CNN
F 3 "" H 4700 5350 60 0000 C CNN
1 4700 5350
1 0 0 -1
$EndComp
$Comp
L R R6
U 1 1 53E67E9C
P 4900 5350
F 0 "R6" V 4980 5350 50 0000 C CNN
F 1 "1R" V 4900 5350 50 0000 C CNN
F 2 "" H 4900 5350 60 0000 C CNN
F 3 "" H 4900 5350 60 0000 C CNN
1 4900 5350
1 0 0 -1
$EndComp
$Comp
L +12V #PWR029
U 1 1 53E67FAE
P 5375 3200
F 0 "#PWR029" H 5375 3150 20 0001 C CNN
F 1 "+12V" H 5375 3300 30 0000 C CNN
F 2 "" H 5375 3200 60 0000 C CNN
F 3 "" H 5375 3200 60 0000 C CNN
1 5375 3200
1 0 0 -1
$EndComp
$Comp
L R R4
U 1 1 53E680EF
P 4350 5100
F 0 "R4" V 4430 5100 50 0000 C CNN
F 1 "1k" V 4350 5100 50 0000 C CNN
F 2 "" H 4350 5100 60 0000 C CNN
F 3 "" H 4350 5100 60 0000 C CNN
1 4350 5100
0 -1 -1 0
$EndComp
Wire Wire Line
4800 5700 4800 5600
Wire Wire Line
5375 3200 5375 3300
Wire Wire Line
4600 5100 5100 5100
Wire Wire Line
4800 5000 4800 5100
Connection ~ 4800 5100
Wire Wire Line
4700 5600 5100 5600
Connection ~ 4800 5600
Connection ~ 4700 5100
Wire Wire Line
5375 3500 5375 3700
$Comp
L DIODESCH D3
U 1 1 53E68EA1
P 5175 3400
F 0 "D3" H 5175 3500 40 0000 C CNN
F 1 "DIODESCH" H 5175 3300 40 0000 C CNN
F 2 "" H 5175 3400 60 0000 C CNN
F 3 "" H 5175 3400 60 0000 C CNN
1 5175 3400
0 -1 -1 0
$EndComp
Wire Wire Line
5175 3200 5375 3200
Connection ~ 5375 3200
Wire Wire Line
5175 3600 5375 3600
Connection ~ 5375 3600
Text HLabel 3200 4350 0 60 Input ~ 0
PWM_in
Text HLabel 3150 5100 0 60 Output ~ 0
Sence
Wire Wire Line
3150 5100 4100 5100
Wire Wire Line
4550 4350 3200 4350
$Comp
L S8205A VT?
U 1 1 53F123C0
P 5300 4150
F 0 "VT?" H 5375 3775 60 0000 R CNN
F 1 "S8205A" H 5450 4500 60 0000 R CNN
F 2 "TSSOP-8" H 5250 3850 60 0001 C CNN
F 3 "~" H 5450 4150 60 0000 C CNN
1 5300 4150
1 0 0 -1
$EndComp
Connection ~ 4550 4350
Wire Wire Line
4550 4350 4550 4600
Wire Wire Line
4550 4600 6050 4600
Wire Wire Line
6050 4600 6050 4350
$Comp
L R R?
U 1 1 53F123DF
P 5100 5350
F 0 "R?" V 5180 5350 50 0000 C CNN
F 1 "1R" V 5100 5350 50 0000 C CNN
F 2 "" H 5100 5350 60 0000 C CNN
F 3 "" H 5100 5350 60 0000 C CNN
1 5100 5350
1 0 0 -1
$EndComp
Connection ~ 4900 5600
Connection ~ 4900 5100
Wire Wire Line
4550 4075 4550 4225
Wire Wire Line
6050 4225 6050 4075
Wire Wire Line
4475 5000 6175 5000
Wire Wire Line
4475 5000 4475 4225
Wire Wire Line
4475 4225 4550 4225
Wire Wire Line
6175 5000 6175 4225
Wire Wire Line
6175 4225 6050 4225
Connection ~ 4800 5000
Connection ~ 6050 4225
Connection ~ 4550 4225
Wire Wire Line
4550 3950 4550 3700
Wire Wire Line
4550 3700 6050 3700
Wire Wire Line
6050 3700 6050 3950
Connection ~ 5375 3700
$EndSCHEMATC

View File

@ -0,0 +1,65 @@
EESchema-LIBRARY Version 2.3 Date: Вс 17 авг 2014 23:25:12
#encoding utf-8
#
# S8205A
#
DEF S8205A VT 0 0 N Y 1 F N
F0 "VT" 75 -375 60 H V R CNN
F1 "S8205A" 150 350 60 H V R CNN
F2 "TSSOP-8" -50 -300 60 H I C CNN
F3 "~" 150 0 60 H V C CNN
$FPLIST
TSSOP8*
TSSOP-8*
$ENDFPLIST
DRAW
C -200 0 180 0 1 12 N
C 200 0 180 0 1 12 N
S -450 300 450 -300 0 1 12 N
P 2 0 1 0 -315 65 -265 65 N
P 2 0 1 0 -290 -100 -250 -100 N
P 2 0 1 0 -290 100 -290 -100 N
P 2 0 1 6 -290 100 -290 200 N
P 2 0 1 0 -290 100 -250 100 N
P 2 0 1 0 -250 -100 -150 -100 N
P 2 0 1 0 -250 100 -150 100 N
P 2 0 1 12 -150 -60 -150 -140 N
P 2 0 1 12 -150 40 -150 -40 N
P 2 0 1 12 -150 140 -150 60 N
P 2 0 1 8 -100 -100 -100 100 N
P 2 0 1 8 100 -100 100 100 N
P 2 0 1 12 150 -60 150 -140 N
P 2 0 1 12 150 40 150 -40 N
P 2 0 1 12 150 140 150 60 N
P 2 0 1 0 250 -100 150 -100 N
P 2 0 1 0 250 100 150 100 N
P 2 0 1 0 250 100 290 100 N
P 2 0 1 0 265 65 315 65 N
P 2 0 1 0 290 -100 250 -100 N
P 2 0 1 0 290 100 290 -100 N
P 2 0 1 6 290 100 290 200 N
P 2 0 1 6 450 200 -450 200 N
P 3 0 1 8 -290 -100 -410 -100 -410 -75 N
P 3 0 1 8 -250 -100 -250 0 -200 0 N
P 3 0 1 8 250 -100 250 0 200 0 N
P 3 0 1 8 410 -75 410 -100 290 -100 N
P 4 0 1 8 -450 -200 -25 -200 -25 -100 -100 -100 N
P 4 0 1 8 -450 75 -410 75 -410 -75 -450 -75 N
P 4 0 1 0 -290 65 -315 25 -265 25 -290 65 F
P 4 0 1 0 290 65 265 25 315 25 290 65 F
P 4 0 1 8 450 -200 25 -200 25 -100 100 -100 N
P 4 0 1 8 450 -75 410 -75 410 75 450 75 N
P 5 0 1 8 -200 30 -200 -30 -150 0 -200 30 -200 30 F
P 5 0 1 8 200 30 200 -30 150 0 200 30 200 30 F
X D 1 -750 200 300 R 50 50 1 1 P
X S1 2 -750 75 300 R 50 50 1 1 P
X S1 3 -750 -75 300 R 50 50 1 1 P
X G1 4 -750 -200 300 R 50 50 1 1 P
X G2 5 750 -200 300 L 50 50 1 1 P
X S2 5 750 -75 300 L 50 50 1 1 P
X S2 7 750 75 300 L 50 50 1 1 P
X D 8 750 200 300 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End 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

99
microdrill/stepper.c Normal file
View File

@ -0,0 +1,99 @@
/*
* 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 long Nsteps = 0; // Number of steps
volatile char Dir = 0; // direction of moving: 0/1
U16 Stepper_speed = 0; // length of one MICROstep in us
/**
* Setup pins of stepper motor (all - PP out)
*/
void setup_stepper_pins(){
// PB0..3
PORT(STP_PORT, DDR) |= 0x0f;
PORT(STP_PORT, CR1) |= 0x0f;
}
/**
* Set speed of stepper motor
* @param Sps - period (in us) of one MICROstep
*/
void set_stepper_speed(U16 SpS){
Stepper_speed = SpS;
// Configure timer 2 to generate signals for CLK
TIM2_PSCR = 4; // 1MHz
TIM2_ARRH = SpS >> 8; // set speed
TIM2_ARRL = SpS & 0xff;
TIM2_IER = TIM_IER_UIE; // update interrupt enable
TIM2_CR1 |= TIM_CR1_APRE | TIM_CR1_URS; // auto reload + interrupt on overflow & RUN
}
void move_motor(int Steps){
if(Steps < 0){
Dir = 1;
Steps *= -1;
}else
Dir = 0;
Nsteps = (long)Steps; // multiply by 3 (to get number of full steps)
TIM2_CR1 |= TIM_CR1_CEN; // turn on timer
}
void stop_motor(){
TIM2_CR1 &= ~TIM_CR1_CEN; // Turn off timer
Nsteps = 0;
PORT(STP_PORT, ODR) &= 0xf0; // turn off power
uart_write("stop\n");
}
void pause_resume(){
if(Nsteps == 0) return; // motor is stopped
if(TIM2_CR1 & TIM_CR1_CEN){ // pause
TIM2_CR1 &= ~TIM_CR1_CEN;
uart_write("pause\n");
}else{ // resume
TIM2_CR1 |= TIM_CR1_CEN;
uart_write("resume\n");
}
}
void add_steps(int Steps){
long S;
// pause
TIM2_CR1 &= ~TIM_CR1_CEN;
if(Nsteps == 0){ // motor is stopped - just move it
move_motor(Steps);
return;
}
S = (long)Steps;
Nsteps += S;
// now change direction
if(Nsteps < 0){
uart_write("reverce\n");
Dir = !Dir; // invert direction
Nsteps *= -1L;
}
// resume if Nsteps != 0
if(Nsteps)
TIM2_CR1 |= TIM_CR1_CEN;
}

40
microdrill/stepper.h Normal file
View File

@ -0,0 +1,40 @@
/*
* 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 long Nsteps;
extern U16 Stepper_speed;
extern volatile char Dir;
void setup_stepper_pins();
void set_stepper_speed(U16 SpS);
void move_motor(int Steps);
void stop_motor();
void pause_resume();
void add_steps(int Steps);
#endif // __STEPPER_H__

94
microdrill/testproj.ihx Normal file
View File

@ -0,0 +1,94 @@
:2080A000AE5007F6AA0FF7AE5008F6AA0FF7815202160590CF000EAE530CA604F7909E0F21
:2080C00001AE530DF74FAE530E909FF7AE5301A601F7AE5300F6AA84F75B02811E03A300B8
:2080E000002E0B3501000D1E03501F032004725F000D16035F905D2A015A90CF000BCF004C
:20810000097210530081AE5300F6A4FEF7725F000C725F000B725F000A725F0009AE5005FF
:20812000F6A4F0F7AE81E589CD83475B0281CE000B2607CE0009272C2000AE5300F695A52B
:20814000012711A4FEAE5300F7AE81EB89CD83475B0220109EAA01AE5300F7AE81F289CDCD
:2081600083475B028172115300CE000B260FCE0009260A1E0389CD80DC5B02206716035F3D
:20818000905D2A015A72B9000B9FC9000A979EC900099590CF000BCF0009CE000BA300006B
:2081A000C6000AA200C60009A2002E2AAE81FA89CD83475B02C6000DA0014F49C7000D906E
:2081C000CE000B90504FC2000A974FC200099590CF000BCF0009CE000B2605CE000927043D
:2081E000721053008173746F700A0070617573650A00726573756D650A007265766572630F
:03820000650A000C
:078ADD000000000000000092
:20820300808080808080808080AE5255F644241B90CE001472A90001C60013A90097C600A0
:2082230012A9009590CF0014CF0012AE52557F80805202AE5302F66B027B02442503CC82D2
:20824300D07B02A4FEAE5302F7AE5005F6A4F06B01AE001A9FCB0011979EA90095F61A0172
:20826300AE5005F7725D000D272C725C0011C60011A1072D4B725F001190CE000B72A2009D
:2082830001C6000AA20097C60009A2009590CF000BCF0009202A725A0011C60011A1002EBC
:2082A3001F3507001190CE000B72A20001C6000AA20097C60009A2009590CF000BCF000980
:2082C300CE000B2608CE00092603CD81065B028080808080805204AE5240F66B047B04A5C4
:2082E30020274DAE5241F66B017B04A4804D27FDAE52417B01F7AE00011F02C6001997C670
:2083030000194CC700194F9572FB027B01F7C60018C10019260FC600184CC70018A108268A
:1683230004725F0018C60019A1082604725F00195B04808080805C
:028AE400000090
:20800000820080838200000082008203820082048200820582008206820082078200820820
:20802000820082098200820A82000000820000008200820B8200820C820082338200823493
:20804000820082D3820082D4820082D58200000082000000820082D6820082D7820082D803
:208060008200833682008337820083388200000082000000820000008200000082000000C2
:1D808300AE00082707724F00005A26F9AE00192709D68ADCD700085A26F7CC80806D
:03808000CC857D2F
:20833900AE5240F64824F9AE52417B03F781160390F64D2718AE5240F64824F9AE5245F651
:20835900AA08F790F6905CAE5241F720E3815202C60019C1001826034F20271605AE000198
:208379001F01C6001897C600184CC700184F9572FB01F690F7C60018A1082604725F0018DD
:20839900A6015B0281521C5F1F101F0E7B21A1042303CC84747B21A1032603CC84740D2190
:2083B9002603CC8474965C1F124F5F9772FB127F4CA10C25F51E121C000AA60AF77B21A104
:2083D90001270E7B21A102271C7B21A104272120301E1FF66B1C5F0F191F0F7B1C6B117BF6
:2083F900196B0E201C161F90FE5F17101F0E20111E1FE6036B18E602FE6B101F0E7B186BBA
:2084190011A6096B0D4B0A5F894B001E14891E1489CD88585B089F887B0E6B15840A0D5FD3
:20843900417B144172FB12AB30F74B0A5F894B001E14891E1489CD88D55B081F10170E1EC4
:208459001026041E0E27067B0DA1FF2CB87B0D4C5F9772FB1289CD83475B025B1C81521A3A
:20847900CE00141F03CE00121F015F1F0D1F0B0F080F060F05961C000789CD83675B024D47
:208499002603CC851B7B07A12D260E1E0D260A1E0B2606A6016B0820697B07A1302403CC11
:2084B900853D7B07A1392303CC853DA6016B061E0D891E0D894B0A5F894B00CD89745B089C
:2084D9001F1917177B070F155F90977B15909572F9199F1918979E19179572A200309FA269
:2084F900006B109EA200170D6B0B7B106B0CAE7FFF130D4F120C4F120B24075F1F0D1F0B07
:208519000F0590CE001472F203C60013120295C6001212019790A327109EA2009FA2002442
:2085390003CC848E0D0526040D0626034F201A7B0D887B0F6B0B846B090D0827051E095080
:208559001F091E1D1609FFA6015B1A81AE87A189CD83475B021E0389CD83475B024B0ACDD1
:2085790083398481520C5F1F031F0172107F60AE50C67FAE52607FAE5261A60FF7AE526230
:20859900A603F7AE5263A6E8F7AE5254A601F7AE5250A685F7AE500CF6AA04F7AE500DF630
:2085B900AA04F7AE5011F6AA20F7AE5012F6AA20F7AE5242A611F7AE5243A606F7AE524555
:2085D900A62CF79A4BE84B03CD80AF5B02CD80A0CE001472F0031F0AC6001312026B09C6C1
:2085F90000121201CE0016905F88130B909F120A909E12015B012511CE00141303C60013D5
:208619001202C6001212012411CE00141F03CE00121F01AE500AF6A804F7961C000589CD5B
:2086390083675B024D27A97B056B0C7B0CA12B27637B0CA12D2603CC86C97B0CA148274871
:208659007B0CA14D2603CC872C7B0CA1532603CC86E57B0CA1612603CC87767B0CA16827D7
:20867900277B0CA16D2603CC871E7B0CA1702603CC87707B0CA1732603CC87107B0CA17840
:208699002603CC876ACC85E9AE87AA89CD83475B02CC85E9CE00161C0064CF0016A32710E8
:2086B9002203CC85E935F4001735010016CC85E9CE00161D0064CF0016A300642503CC85B2
:2086D900E935F4001735010016CC85E9961C000689CD84775B024D27121E06A3007D2D0B6A
:2086F9001E0689CD80AF5B02CC85E9AE883189CD85655B02CC85E9AE000E4B0289CD839E63
:208719005B03CC85E9AE00094B0489CD839E5B03CC85E9CE000B2605CE0009270CAE883B14
:2087390089CD85655B02CC85E9961C000689CD84775B024D270F1E06270B1E0689CD80DC34
:208759005B02CC85E9AE884389CD85655B02CC85E9CD8106CC85E9CD812ECC85E9961C0023
:208779000689CD84775B024D270F1E06270B1E0689CD81655B02CC85E9AE884E89CD856598
:208799005B02CC85E95B0C810A4552524F523A20000A50524F544F3A0A2B2F2D094C45440C
:2087B90020706572696F640A532F73097365742F676574204D73706565640A6D09676574FC
:2087D9002073746570730A780973746F700A700970617573652F726573756D650A4D096DB2
:2087F9006F7665206D6F746F720A6109616464204E737470730A7509756E69706F6C6172FE
:20881900206D6F746F720A62096269706F6C6172206D6F746F720A00626164207370656541
:1F88390064006D6F76696E672100626164204E7374657073006261642076616C756500E3
:108AE6000000000001F40000080A0206040501095E
:2088580052040F040F017B0B484F494D262E160D1E0B905859170D1F0B1E09130D7B0812C9
:208878000C7B07120B240D160D1E0B549056170D1F0B20080C017B016B0420CA7B046B0339
:208898001E09130D7B08120C7B07120B2513160972F20D7B08120C977B07120B9517091FC6
:2088B80007160D1E0B549056170D1F0B7B036B020A030D0226CA1E0916075B048152125FE7
:2088D8001F051F03A6206B027B15484F496B0116171E1590585917171F157B036B0B1E0412
:2088F800887B076B0F84080E59090B1F047B0E6B067B0B6B030D01271A7B06AA016B127B51
:20891800056B117B046B107B036B0F16111705160F17031E05131B7B04121A7B0312192580
:208938002B160572F21B7B04121A6B087B03121917056B037B086B047B18AA0190977B1720
:2089580090957B16977B159517171F150A020D022703CC88E01E1716155B128152409096AC
:20897800905C961C00431F091E09E603961C00471F0B1E0B1F111E111F131E1388E60197B2
:20899800844290FF72A900021E09E6031E0B1F3F1E3F1F0D1E0D1F0F1E0F88E603978442D9
:2089B80090FF965C1F151E15F66B1B1E09F697160B90E603429F1B1B1E15F71E15F66B1CFC
:2089D8001E09E60197160B90E602429F1B1C1E15F79096905C93FE1F1D1E09E6011E0B1FCA
:2089F8001F1E1F1F211E211F231E2388E60397844272FB1D90FF93FE1F251E09E6021E0B0D
:208A18001F271E271F291E291F2B1E2B88E60297844272FB2590FF16091E09E6021E0B1F2D
:208A38002F1E2F1F311E311F331E3388E6019784429F90F71E095C1F351E09E60290971E43
:208A58000BE60390421E35FF160B1E09E6031E0B1F371E371F3D1E3D88F69784429F90F729
:208A78001E0B5C1F2D1E09E60390971E0BE60290421E2DFF1E0B1C00037F1E091C00037F1D
:208A9800965CE6036B08E6026B07E6016B06F616431739164572F9071719887B07193B6B59
:208AB800198419396B171619EF021617FFE603E602FE16491E4772F9199F1918979E191795
:058AD80095515B408197
:00000001FF

View File

@ -118,7 +118,7 @@ int read_console(){
* wait until at least one character pressed
* @return character readed
*/
int mygetchar(){ // аналог getchar() без необходимости жать Enter
int mygetchar(){ // ÁÎÁÌÏÇ getchar() ÂÅÚ ÎÅÏÂÈÏÄÉÍÏÓÔÉ ÖÁÔØ Enter
int ret;
do ret = read_console();
while(ret == 0);