/programy/PIC_C/motory/DC/regulator_letadlo/main.BAK |
---|
0,0 → 1,14 |
#include "D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h" |
void main() |
{ |
while (true) |
{ |
output_high(pin_A1); |
Delay_us(50); |
output_low(pin_A1); |
Delay_us(500); |
} |
} |
/programy/PIC_C/motory/DC/regulator_letadlo/main.HEX |
---|
0,0 → 1,7 |
:1000000000308A000428000084011F308305831615 |
:1000100085108312851403308C008C0B0D288316F9 |
:1000200085108312851031308C008C0B1528000050 |
:0600300000000728630038 |
:02400E00F93F78 |
:00000001FF |
;PIC16F84 |
/programy/PIC_C/motory/DC/regulator_letadlo/main.LST |
---|
0,0 → 1,62 |
CCS PCW C Compiler, Version 3.110, 15448 |
Filename: d:\@kaklik\programy\pic_c\motory\dc\regulator_letadlo\main.LST |
ROM used: 27 (3%) |
Largest free fragment is 997 |
RAM used: 2 (3%) at main() level |
2 (3%) worst case |
Stack: 0 locations |
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 004 |
0003: NOP |
.................... #include "D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h" |
.................... #include <16F84.h> |
.................... //////// Standard Header file for the PIC16F84 device //////////////// |
.................... #device PIC16F84 |
.................... #list |
.................... |
.................... #use delay(clock=4000000) |
.................... #fuses XT,NOWDT |
.................... |
.................... |
.................... |
.................... |
.................... void main() |
.................... { |
0004: CLRF 04 |
0005: MOVLW 1F |
0006: ANDWF 03,F |
.................... while (true) |
.................... { |
.................... |
.................... output_high(pin_A1); |
0007: BSF 03.5 |
0008: BCF 05.1 |
0009: BCF 03.5 |
000A: BSF 05.1 |
.................... Delay_us(10); |
000B: MOVLW 03 |
000C: MOVWF 0C |
000D: DECFSZ 0C,F |
000E: GOTO 00D |
.................... output_low(pin_A1); |
000F: BSF 03.5 |
0010: BCF 05.1 |
0011: BCF 03.5 |
0012: BCF 05.1 |
.................... Delay_us(150); |
0013: MOVLW 31 |
0014: MOVWF 0C |
0015: DECFSZ 0C,F |
0016: GOTO 015 |
0017: NOP |
0018: NOP |
.................... } |
0019: GOTO 007 |
.................... } |
.................... |
001A: SLEEP |
/programy/PIC_C/motory/DC/regulator_letadlo/main.PJT |
---|
0,0 → 1,32 |
[PROJECT] |
Target=main.HEX |
Development_Mode= |
Processor=0x684A |
ToolSuite=CCS |
[Directories] |
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr |
Library= |
LinkerScript= |
[Target Data] |
FileList=main.c; |
BuildTool=C-COMPILER |
OptionString=+FM |
AdditionalOptionString= |
BuildRequired=1 |
[main.c] |
Type=4 |
Path= |
FileList= |
BuildTool= |
OptionString= |
AdditionalOptionString= |
[mru-list] |
1=main.c |
[Windows] |
0=0000 main.c 0 0 796 451 3 0 |
/programy/PIC_C/motory/DC/regulator_letadlo/main.SYM |
---|
0,0 → 1,12 |
00C @SCRATCH |
00D @SCRATCH |
00D _RETURN_ |
delay_ms.P1 |
delay_us.P2 |
0004 main |
Project Files: |
d:\@kaklik\programy\pic_c\motory\dc\regulator_letadlo\main.c |
D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h |
C:\PROGRAM FILES\PICC\devices\16F84.h |
/programy/PIC_C/motory/DC/regulator_letadlo/main.c |
---|
0,0 → 1,14 |
#include "D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h" |
void main() |
{ |
while (true) |
{ |
output_high(pin_A1); |
Delay_us(10); |
output_low(pin_A1); |
Delay_us(150); |
} |
} |
/programy/PIC_C/motory/DC/regulator_letadlo/main.cod |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/PIC_C/motory/DC/regulator_letadlo/main.err |
---|
0,0 → 1,0 |
No Errors |
/programy/PIC_C/motory/DC/regulator_letadlo/main.h |
---|
0,0 → 1,4 |
#include <16F84.h> |
#use delay(clock=4000000) |
#fuses XT,NOWDT |
/programy/PIC_C/motory/DC/regulator_letadlo/main.sta |
---|
0,0 → 1,27 |
ROM used: 27 (3%) |
997 (97%) including unused fragments |
0 Average locations per line |
4 Average locations per statement |
RAM used: 2 (3%) at main() level |
2 (3%) worst case |
Lines Stmts % Files |
----- ----- --- ----- |
15 6 100 d:\@kaklik\programy\pic_c\motory\dc\regulator_letadlo\main.c |
5 0 0 D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h |
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h |
----- ----- |
262 12 Total |
Page ROM % RAM Functions: |
---- --- --- --- ---------- |
0 23 85 0 main |
Segment Used Free |
--------- ---- ---- |
0000-0003 4 0 |
0004-03FF 23 997 |
/programy/PIC_C/motory/DC/regulator_letadlo/main.tre |
---|
0,0 → 1,3 |
ÀÄmain |
ÀÄmain 0/23 Ram=0 |
ÀÄ??0?? |
/programy/PIC_C/motory/DC/regulator_letadlo/prg.bat |
---|
0,0 → 1,6 |
call picpgr stop |
call picpgr erase pic16f84 |
call picpgr program main.hex hex pic16f84 |
call picpgr run |
pause |
call picpgr stop |
/programy/PIC_C/motory/DC/regulator_letadlo/vssver.scc |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/PIC_C/motory/hodinovy/Run.BAT |
---|
0,0 → 1,8 |
@echo off |
:loop |
picpgr reset PIC16F84 |
picpgr run |
pause |
picpgr stop |
pause |
goto loop |
/programy/PIC_C/motory/hodinovy/main.BAK |
---|
0,0 → 1,22 |
#include "D:\@Kaklik\programy\PIC_C\motory\main.h" |
void main() |
{ |
while (true) |
{ |
Delay_ms(15); |
output_high(pin_A0); |
output_low(pin_A1); |
// output_high(pin_A2); |
// Delay_ms(10); |
// output_low(pin_A2); |
Delay_ms(15); |
output_low(pin_A0); |
output_high(pin_A1); |
} |
} |
/programy/PIC_C/motory/hodinovy/main.HEX |
---|
0,0 → 1,10 |
:1000000000308A00192800000F308400000803190E |
:10001000182801308D008C018C0B0C288D0B0B28BF |
:100020004A308C008C0B122800000000800B09283D |
:10003000003484011F30830519308F00042083169B |
:10004000051083120514831685108312851019304C |
:100050008F00042083160510831205108316851067 |
:08006000831285141C286300C3 |
:02400E00FD3F74 |
:00000001FF |
;PIC16F84 |
/programy/PIC_C/motory/hodinovy/main.LST |
---|
0,0 → 1,95 |
CCS PCW C Compiler, Version 3.110, 15448 |
Filename: d:\@kaklik\programy\pic_c\motory\main.LST |
ROM used: 52 (5%) |
Largest free fragment is 972 |
RAM used: 2 (3%) at main() level |
3 (4%) worst case |
Stack: 1 locations |
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 019 |
0003: NOP |
.................... #include "D:\@Kaklik\programy\PIC_C\motory\main.h" |
.................... #include <16F84.h> |
.................... //////// Standard Header file for the PIC16F84 device //////////////// |
.................... #device PIC16F84 |
.................... #list |
.................... |
.................... #use delay(clock=4000000) |
0004: MOVLW 0F |
0005: MOVWF 04 |
0006: MOVF 00,W |
0007: BTFSC 03.2 |
0008: GOTO 018 |
0009: MOVLW 01 |
000A: MOVWF 0D |
000B: CLRF 0C |
000C: DECFSZ 0C,F |
000D: GOTO 00C |
000E: DECFSZ 0D,F |
000F: GOTO 00B |
0010: MOVLW 4A |
0011: MOVWF 0C |
0012: DECFSZ 0C,F |
0013: GOTO 012 |
0014: NOP |
0015: NOP |
0016: DECFSZ 00,F |
0017: GOTO 009 |
0018: RETLW 00 |
.................... #fuses XT,WDT |
.................... |
.................... |
.................... |
.................... |
.................... void main() |
.................... { |
0019: CLRF 04 |
001A: MOVLW 1F |
001B: ANDWF 03,F |
.................... while (true) |
.................... { |
.................... |
.................... Delay_ms(25); |
001C: MOVLW 19 |
001D: MOVWF 0F |
001E: CALL 004 |
.................... |
.................... output_high(pin_A0); |
001F: BSF 03.5 |
0020: BCF 05.0 |
0021: BCF 03.5 |
0022: BSF 05.0 |
.................... output_low(pin_A1); |
0023: BSF 03.5 |
0024: BCF 05.1 |
0025: BCF 03.5 |
0026: BCF 05.1 |
.................... |
.................... // output_high(pin_A2); |
.................... // Delay_ms(10); |
.................... // output_low(pin_A2); |
.................... Delay_ms(25); |
0027: MOVLW 19 |
0028: MOVWF 0F |
0029: CALL 004 |
.................... |
.................... output_low(pin_A0); |
002A: BSF 03.5 |
002B: BCF 05.0 |
002C: BCF 03.5 |
002D: BCF 05.0 |
.................... output_high(pin_A1); |
002E: BSF 03.5 |
002F: BCF 05.1 |
0030: BCF 03.5 |
0031: BSF 05.1 |
.................... } |
0032: GOTO 01C |
.................... } |
.................... |
0033: SLEEP |
/programy/PIC_C/motory/hodinovy/main.PJT |
---|
0,0 → 1,32 |
[PROJECT] |
Target=main.HEX |
Development_Mode= |
Processor=0x684A |
ToolSuite=CCS |
[Directories] |
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr |
Library= |
LinkerScript= |
[Target Data] |
FileList=main.c; |
BuildTool=C-COMPILER |
OptionString=+FM |
AdditionalOptionString= |
BuildRequired=1 |
[main.c] |
Type=4 |
Path= |
FileList= |
BuildTool= |
OptionString= |
AdditionalOptionString= |
[mru-list] |
1=main.c |
[Windows] |
0=0000 main.c 0 0 796 451 3 0 |
/programy/PIC_C/motory/hodinovy/main.SYM |
---|
0,0 → 1,14 |
00C @SCRATCH |
00D @SCRATCH |
00D _RETURN_ |
00F delay_ms.P1 |
delay_us.P1 |
0004 delay_ms |
0019 main |
0040 @cinit |
Project Files: |
d:\@kaklik\programy\pic_c\motory\main.c |
D:\@Kaklik\programy\PIC_C\motory\main.h |
C:\PROGRAM FILES\PICC\devices\16F84.h |
/programy/PIC_C/motory/hodinovy/main.c |
---|
0,0 → 1,22 |
#include "D:\@Kaklik\programy\PIC_C\motory\main.h" |
void main() |
{ |
while (true) |
{ |
Delay_ms(25); |
output_high(pin_A0); |
output_low(pin_A1); |
// output_high(pin_A2); |
// Delay_ms(10); |
// output_low(pin_A2); |
Delay_ms(25); |
output_low(pin_A0); |
output_high(pin_A1); |
} |
} |
/programy/PIC_C/motory/hodinovy/main.cod |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/PIC_C/motory/hodinovy/main.err |
---|
0,0 → 1,0 |
No Errors |
/programy/PIC_C/motory/hodinovy/main.h |
---|
0,0 → 1,4 |
#include <16F84.h> |
#use delay(clock=4000000) |
#fuses XT,WDT |
/programy/PIC_C/motory/hodinovy/main.sta |
---|
0,0 → 1,28 |
ROM used: 52 (5%) |
972 (95%) including unused fragments |
0 Average locations per line |
6 Average locations per statement |
RAM used: 2 (3%) at main() level |
3 (4%) worst case |
Lines Stmts % Files |
----- ----- --- ----- |
23 8 100 d:\@kaklik\programy\pic_c\motory\main.c |
5 0 0 D:\@Kaklik\programy\PIC_C\motory\main.h |
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h |
----- ----- |
278 16 Total |
Page ROM % RAM Functions: |
---- --- --- --- ---------- |
0 21 40 1 delay_ms |
0 27 52 0 main |
Segment Used Free |
--------- ---- ---- |
0000-0003 4 0 |
0004-03FF 48 972 |
/programy/PIC_C/motory/hodinovy/main.tre |
---|
0,0 → 1,5 |
ÀÄmain |
ÀÄmain 0/27 Ram=0 |
ÃÄ??0?? |
ÃÄdelay_ms 0/21 Ram=1 |
ÀÄdelay_ms 0/21 Ram=1 |
/programy/PIC_C/motory/hodinovy/prg.bat |
---|
0,0 → 1,6 |
call picpgr stop |
call picpgr erase pic16f84 |
call picpgr program main.hex hex pic16f84 |
call picpgr run |
pause |
call picpgr stop |
/programy/PIC_C/motory/hodinovy/vssver.scc |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/PIC_C/motory/krokac/A.BAT |
---|
0,0 → 1,3 |
call picpgr erase pic16f88 |
call picpgr program krokac.hex hex pic16f88 |
call picpgr run |
/programy/PIC_C/motory/krokac/KROKAC.C |
---|
0,0 → 1,139 |
#include "C:\MIHO_DAT\KROKAC\krokac.h" |
unsigned int StepState; // Vnitrni promenna kroku |
signed int StepDirection; // Smer +1/0/-1 |
byte const StepTab[8]={ // Tabulka pro krokovy motor |
0b0001, // 0 |
0b0101, // 1 |
0b0100, // 2 |
0b0110, // 3 |
0b0010, // 4 |
0b1010, // 5 |
0b1000 // 6 |
0b1001, // 7 |
}; |
#INT_TIMER2 |
void StepNext() |
{ |
unsigned int i; |
StepState+=StepDirection; // posun se na dalsi krok |
i=StepState&0b111; // vezmi spodni 3 bity stavu |
i=StepTab[i]; // prekoduj pomoci tabulky |
output_bit(MOTORA,i&0b0001); // aktivuj jednotlive vystupy |
output_bit(MOTORB,i&0b0010); |
output_bit(MOTORC,i&0b0100); |
output_bit(MOTORD,i&0b1000); |
} |
void StepSetDirection(signed int Direction) |
{ |
if(Direction> 1) Direction= 1; |
if(Direction<-1) Direction=-1; |
StepDirection=Direction; |
} |
void StepSetTime(unsigned int16 Time) |
{ |
} |
void Delay(unsigned int16 Time) |
{ |
while(Time>255) {Time-=256;delay_us(256);}; |
if(Time!=0) delay_us(Time); |
} |
void main() |
{ |
unsigned int16 T; |
unsigned long int i; |
// Nastav pracovni frekvenci procesoru |
setup_oscillator(OSC_4MHZ); |
// Vypni motorovy vystup |
output_low(MOTORA); |
output_low(MOTORB); |
output_low(MOTORC); |
output_low(MOTORD); |
// Vstupy s pull-up odporem |
port_b_pullups(TRUE); |
// Inicializace A/D prevodniku |
setup_adc_ports(sAN0|VSS_VDD); |
setup_adc(ADC_CLOCK_INTERNAL); |
set_adc_channel(0); |
// Dalsi inicializace |
setup_spi(FALSE); |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
setup_timer_1(T1_DISABLED); |
setup_comparator(NC_NC_NC_NC); |
setup_vref(FALSE); |
// Inicializace stavovych promennych |
StepState=0; |
// Nastaveni casovace |
setup_timer_2(T2_DIV_BY_16,0xFF,1); |
// Nastveni preruseni od casovace |
enable_interrupts(global); |
enable_interrupts(int_timer2); |
for(;;) |
{ |
T=read_adc(ADC_READ_ONLY); // Prectu hodnotu |
read_adc(ADC_START_ONLY); // Ostartuji dalsi prevod (na pozadi) |
//setup_timer_2(T2_DIV_BY_16,T,1); |
if(T>0) *0x92=T; // Preload register casovace |
// Podle prepinacu se hybu |
if(input(PIN_B5)) |
{ |
if(input(PIN_B4)) StepSetDirection(1); else StepSetDirection(-1); |
} |
else |
{ int1 x; // pomocna promenna aby se volalo spozdeni jen 1x |
if (StepState>230) { |
if (!input(PIN_B4) && (x)) |
{ |
StepSetDirection(0); |
delay_ms(500); |
x=0; |
}; |
StepSetDirection(-1); |
} |
if (StepState<30) { |
StepSetDirection( 1); |
x=1; |
} |
} |
//StepDirection=2; |
//for(i=0;i<800;i++) |
//{ |
// StepNext(); |
// Delay(T); |
//} |
//delay_ms(10); |
//StepDirection=-1; |
//for(i=0;i<800;i++) |
//{ |
// StepNext(); |
// Delay(T); |
//} |
//delay_ms(10); |
} // Cyklus for |
} |
/programy/PIC_C/motory/krokac/KROKAC.H |
---|
0,0 → 1,23 |
#include <16F88.h> |
//#device ICD=TRUE |
#device adc=8 |
#FUSES NOWDT //No Watch Dog Timer |
#FUSES RC //Resistor/Capacitor Osc with CLKOUT |
#FUSES NOPUT //No Power Up Timer |
#FUSES MCLR //Master Clear pin enabled |
#FUSES NOBROWNOUT //No brownout reset |
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
#FUSES NOCPD //No EE protection |
#FUSES NOWRT //Program memory not write protected |
//#FUSES DEBUG //Debug mode for use with ICD |
#FUSES NOPROTECT //Code not protected from reading |
#FUSES FCMEN //Fail-safe clock monitor enabled |
#FUSES IESO //Internal External Switch Over mode enabled |
#use delay(clock=4000000) |
#define MOTORA PIN_B0 |
#define MOTORB PIN_B1 |
#define MOTORC PIN_B2 |
#define MOTORD PIN_B3 |
/programy/PIC_C/motory/krokac/KROKAC.HEX |
---|
0,0 → 1,44 |
:1000000000308A0098280000FF00030E8301A10041 |
:100010007F08A0000A08A8008A01A00E0408A20018 |
:100020007708A3007808A4007908A5007A08A6003C |
:100030007B08A700831383128C308400801C222845 |
:100040008C183528220884002308F7002408F800BB |
:100050002508F9002608FA002708FB0028088A006E |
:10006000210E8300FF0E7F0E09008A1143280A101B |
:100070008A100A118207013405340434063402342C |
:100080000A34083409342A082907A900290807393D |
:10009000B20032083720F800B2003218512806109A |
:1000A00052280614831606108312B2185928861097 |
:1000B0005A28861483168610831232196128061175 |
:1000C00062280615831606118312B2196928861153 |
:1000D0006A2886158316861183128C108A112228AD |
:1000E000B01B78283008013C031878280130B00094 |
:1000F0003008803A7E3C031C7F28FF30B000300877 |
:10010000AA00003431308400000803199628013019 |
:10011000F800F701F70B8A28F80B89284A30F70016 |
:10012000F70B902800000000800B87288A113029E7 |
:1001300084011F30830583161F129F121B0880390C |
:100140009B0007309C001C0883120D13603083163F |
:100150008F000610831206108316861083128610F5 |
:1001600083160611831206118316861183128611D7 |
:10017000831681131F129F121B08803901389B00C0 |
:100180001F1383121F179F1783169F1383121F14A9 |
:100190000030F8001F08C73978049F0094128316B6 |
:1001A0000611861406120030831294008316940000 |
:1001B0000108C7390838810083129001073083167F |
:1001C0009C0005080330F700F70BE4281C08831295 |
:1001D0000D1383169D018312A9010030F800063823 |
:1001E0009200FF3083169200C03083128B04831676 |
:1001F0008C1483121F1DFE288316F9281E08AC01DB |
:10020000AB001F15AB08031D0829AC0803190C2906 |
:100210002B08831692008312831686168312861E7D |
:100220001E29831606168312061E1A290130B000F5 |
:1002300070201D29FF30B00070203E292908E63CBF |
:1002400003183629831606168312061A33292F1C23 |
:100250003329B00170200230B000FA30B10082289A |
:10026000B00B2D292F10FF30B000702029081D3C45 |
:10027000031C3E290130B00070202F148316F9288A |
:02028000630019 |
:04400E003B3FFF3FF6 |
:00000001FF |
;PIC16F88 |
/programy/PIC_C/motory/krokac/KROKAC.LST |
---|
0,0 → 1,495 |
CCS PCM C Compiler, Version 3.234, 27853 16-X-05 21:12 |
Filename: C:\MIHO_DAT\KROKAC\krokac.LST |
ROM used: 321 words (8%) |
Largest free fragment is 2048 |
RAM used: 21 (12%) at main() level |
24 (14%) worst case |
Stack: 3 worst case (1 in main + 2 for interrupts) |
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 098 |
0003: NOP |
0004: MOVWF 7F |
0005: SWAPF 03,W |
0006: CLRF 03 |
0007: MOVWF 21 |
0008: MOVF 7F,W |
0009: MOVWF 20 |
000A: MOVF 0A,W |
000B: MOVWF 28 |
000C: CLRF 0A |
000D: SWAPF 20,F |
000E: MOVF 04,W |
000F: MOVWF 22 |
0010: MOVF 77,W |
0011: MOVWF 23 |
0012: MOVF 78,W |
0013: MOVWF 24 |
0014: MOVF 79,W |
0015: MOVWF 25 |
0016: MOVF 7A,W |
0017: MOVWF 26 |
0018: MOVF 7B,W |
0019: MOVWF 27 |
001A: BCF 03.7 |
001B: BCF 03.5 |
001C: MOVLW 8C |
001D: MOVWF 04 |
001E: BTFSS 00.1 |
001F: GOTO 022 |
0020: BTFSC 0C.1 |
0021: GOTO 035 |
0022: MOVF 22,W |
0023: MOVWF 04 |
0024: MOVF 23,W |
0025: MOVWF 77 |
0026: MOVF 24,W |
0027: MOVWF 78 |
0028: MOVF 25,W |
0029: MOVWF 79 |
002A: MOVF 26,W |
002B: MOVWF 7A |
002C: MOVF 27,W |
002D: MOVWF 7B |
002E: MOVF 28,W |
002F: MOVWF 0A |
0030: SWAPF 21,W |
0031: MOVWF 03 |
0032: SWAPF 7F,F |
0033: SWAPF 7F,W |
0034: RETFIE |
0035: BCF 0A.3 |
0036: GOTO 043 |
.................... #include "C:\MIHO_DAT\KROKAC\krokac.h" |
.................... #include <16F88.h> |
.................... //////// Standard Header file for the PIC16F88 device //////////////// |
.................... #device PIC16F88 |
.................... #list |
.................... |
.................... //#device ICD=TRUE |
.................... #device adc=8 |
.................... |
.................... #FUSES NOWDT //No Watch Dog Timer |
.................... #FUSES RC //Resistor/Capacitor Osc with CLKOUT |
.................... #FUSES NOPUT //No Power Up Timer |
.................... #FUSES MCLR //Master Clear pin enabled |
.................... #FUSES NOBROWNOUT //No brownout reset |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
.................... #FUSES NOCPD //No EE protection |
.................... #FUSES NOWRT //Program memory not write protected |
.................... //#FUSES DEBUG //Debug mode for use with ICD |
.................... #FUSES NOPROTECT //Code not protected from reading |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
.................... |
.................... #use delay(clock=4000000) |
* |
0082: MOVLW 31 |
0083: MOVWF 04 |
0084: MOVF 00,W |
0085: BTFSC 03.2 |
0086: GOTO 096 |
0087: MOVLW 01 |
0088: MOVWF 78 |
0089: CLRF 77 |
008A: DECFSZ 77,F |
008B: GOTO 08A |
008C: DECFSZ 78,F |
008D: GOTO 089 |
008E: MOVLW 4A |
008F: MOVWF 77 |
0090: DECFSZ 77,F |
0091: GOTO 090 |
0092: NOP |
0093: NOP |
0094: DECFSZ 00,F |
0095: GOTO 087 |
0096: BCF 0A.3 |
0097: GOTO 130 (RETURN) |
.................... #define MOTORA PIN_B0 |
.................... #define MOTORB PIN_B1 |
.................... #define MOTORC PIN_B2 |
.................... #define MOTORD PIN_B3 |
.................... |
.................... |
.................... |
.................... |
.................... unsigned int StepState; // Vnitrni promenna kroku |
.................... signed int StepDirection; // Smer +1/0/-1 |
.................... |
.................... byte const StepTab[8]={ // Tabulka pro krokovy motor |
.................... 0b0001, // 0 |
.................... 0b0101, // 1 |
.................... 0b0100, // 2 |
.................... 0b0110, // 3 |
.................... 0b0010, // 4 |
.................... 0b1010, // 5 |
.................... 0b1000 // 6 |
.................... 0b1001, // 7 |
.................... }; |
.................... |
.................... #INT_TIMER2 |
.................... void StepNext() |
.................... { |
.................... unsigned int i; |
.................... |
.................... StepState+=StepDirection; // posun se na dalsi krok |
* |
0043: MOVF 2A,W |
0044: ADDWF 29,W |
0045: MOVWF 29 |
.................... i=StepState&0b111; // vezmi spodni 3 bity stavu |
0046: MOVF 29,W |
0047: ANDLW 07 |
0048: MOVWF 32 |
.................... i=StepTab[i]; // prekoduj pomoci tabulky |
0049: MOVF 32,W |
004A: CALL 037 |
004B: MOVWF 78 |
004C: MOVWF 32 |
.................... output_bit(MOTORA,i&0b0001); // aktivuj jednotlive vystupy |
004D: BTFSC 32.0 |
004E: GOTO 051 |
004F: BCF 06.0 |
0050: GOTO 052 |
0051: BSF 06.0 |
0052: BSF 03.5 |
0053: BCF 06.0 |
.................... output_bit(MOTORB,i&0b0010); |
0054: BCF 03.5 |
0055: BTFSC 32.1 |
0056: GOTO 059 |
0057: BCF 06.1 |
0058: GOTO 05A |
0059: BSF 06.1 |
005A: BSF 03.5 |
005B: BCF 06.1 |
.................... output_bit(MOTORC,i&0b0100); |
005C: BCF 03.5 |
005D: BTFSC 32.2 |
005E: GOTO 061 |
005F: BCF 06.2 |
0060: GOTO 062 |
0061: BSF 06.2 |
0062: BSF 03.5 |
0063: BCF 06.2 |
.................... output_bit(MOTORD,i&0b1000); |
0064: BCF 03.5 |
0065: BTFSC 32.3 |
0066: GOTO 069 |
0067: BCF 06.3 |
0068: GOTO 06A |
0069: BSF 06.3 |
006A: BSF 03.5 |
006B: BCF 06.3 |
.................... } |
.................... |
.................... |
006C: BCF 03.5 |
006D: BCF 0C.1 |
006E: BCF 0A.3 |
006F: GOTO 022 |
.................... void StepSetDirection(signed int Direction) |
.................... { |
.................... if(Direction> 1) Direction= 1; |
0070: BTFSC 30.7 |
0071: GOTO 078 |
0072: MOVF 30,W |
0073: SUBLW 01 |
0074: BTFSC 03.0 |
0075: GOTO 078 |
0076: MOVLW 01 |
0077: MOVWF 30 |
.................... if(Direction<-1) Direction=-1; |
0078: MOVF 30,W |
0079: XORLW 80 |
007A: SUBLW 7E |
007B: BTFSS 03.0 |
007C: GOTO 07F |
007D: MOVLW FF |
007E: MOVWF 30 |
.................... StepDirection=Direction; |
007F: MOVF 30,W |
0080: MOVWF 2A |
.................... } |
0081: RETLW 00 |
.................... |
.................... |
.................... void StepSetTime(unsigned int16 Time) |
.................... { |
.................... |
.................... } |
.................... |
.................... void Delay(unsigned int16 Time) |
.................... { |
.................... while(Time>255) {Time-=256;delay_us(256);}; |
.................... if(Time!=0) delay_us(Time); |
.................... } |
.................... |
.................... |
.................... void main() |
.................... { |
* |
0098: CLRF 04 |
0099: MOVLW 1F |
009A: ANDWF 03,F |
009B: BSF 03.5 |
009C: BCF 1F.4 |
009D: BCF 1F.5 |
009E: MOVF 1B,W |
009F: ANDLW 80 |
00A0: MOVWF 1B |
00A1: MOVLW 07 |
00A2: MOVWF 1C |
00A3: MOVF 1C,W |
00A4: BCF 03.5 |
00A5: BCF 0D.6 |
.................... unsigned int16 T; |
.................... unsigned long int i; |
.................... |
.................... // Nastav pracovni frekvenci procesoru |
.................... setup_oscillator(OSC_4MHZ); |
00A6: MOVLW 60 |
00A7: BSF 03.5 |
00A8: MOVWF 0F |
.................... |
.................... // Vypni motorovy vystup |
.................... output_low(MOTORA); |
00A9: BCF 06.0 |
00AA: BCF 03.5 |
00AB: BCF 06.0 |
.................... output_low(MOTORB); |
00AC: BSF 03.5 |
00AD: BCF 06.1 |
00AE: BCF 03.5 |
00AF: BCF 06.1 |
.................... output_low(MOTORC); |
00B0: BSF 03.5 |
00B1: BCF 06.2 |
00B2: BCF 03.5 |
00B3: BCF 06.2 |
.................... output_low(MOTORD); |
00B4: BSF 03.5 |
00B5: BCF 06.3 |
00B6: BCF 03.5 |
00B7: BCF 06.3 |
.................... |
.................... // Vstupy s pull-up odporem |
.................... port_b_pullups(TRUE); |
00B8: BSF 03.5 |
00B9: BCF 01.7 |
.................... |
.................... // Inicializace A/D prevodniku |
.................... setup_adc_ports(sAN0|VSS_VDD); |
00BA: BCF 1F.4 |
00BB: BCF 1F.5 |
00BC: MOVF 1B,W |
00BD: ANDLW 80 |
00BE: IORLW 01 |
00BF: MOVWF 1B |
.................... setup_adc(ADC_CLOCK_INTERNAL); |
00C0: BCF 1F.6 |
00C1: BCF 03.5 |
00C2: BSF 1F.6 |
00C3: BSF 1F.7 |
00C4: BSF 03.5 |
00C5: BCF 1F.7 |
00C6: BCF 03.5 |
00C7: BSF 1F.0 |
.................... set_adc_channel(0); |
00C8: MOVLW 00 |
00C9: MOVWF 78 |
00CA: MOVF 1F,W |
00CB: ANDLW C7 |
00CC: IORWF 78,W |
00CD: MOVWF 1F |
.................... |
.................... // Dalsi inicializace |
.................... setup_spi(FALSE); |
00CE: BCF 14.5 |
00CF: BSF 03.5 |
00D0: BCF 06.2 |
00D1: BSF 06.1 |
00D2: BCF 06.4 |
00D3: MOVLW 00 |
00D4: BCF 03.5 |
00D5: MOVWF 14 |
00D6: BSF 03.5 |
00D7: MOVWF 14 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
00D8: MOVF 01,W |
00D9: ANDLW C7 |
00DA: IORLW 08 |
00DB: MOVWF 01 |
.................... setup_timer_1(T1_DISABLED); |
00DC: BCF 03.5 |
00DD: CLRF 10 |
.................... setup_comparator(NC_NC_NC_NC); |
00DE: MOVLW 07 |
00DF: BSF 03.5 |
00E0: MOVWF 1C |
00E1: MOVF 05,W |
00E2: MOVLW 03 |
00E3: MOVWF 77 |
00E4: DECFSZ 77,F |
00E5: GOTO 0E4 |
00E6: MOVF 1C,W |
00E7: BCF 03.5 |
00E8: BCF 0D.6 |
.................... setup_vref(FALSE); |
00E9: BSF 03.5 |
00EA: CLRF 1D |
.................... |
.................... // Inicializace stavovych promennych |
.................... StepState=0; |
00EB: BCF 03.5 |
00EC: CLRF 29 |
.................... |
.................... // Nastaveni casovace |
.................... setup_timer_2(T2_DIV_BY_16,0xFF,1); |
00ED: MOVLW 00 |
00EE: MOVWF 78 |
00EF: IORLW 06 |
00F0: MOVWF 12 |
00F1: MOVLW FF |
00F2: BSF 03.5 |
00F3: MOVWF 12 |
.................... |
.................... // Nastveni preruseni od casovace |
.................... enable_interrupts(global); |
00F4: MOVLW C0 |
00F5: BCF 03.5 |
00F6: IORWF 0B,F |
.................... enable_interrupts(int_timer2); |
00F7: BSF 03.5 |
00F8: BSF 0C.1 |
.................... |
.................... for(;;) |
.................... { |
.................... |
.................... T=read_adc(ADC_READ_ONLY); // Prectu hodnotu |
00F9: BCF 03.5 |
00FA: BTFSS 1F.2 |
00FB: GOTO 0FE |
00FC: BSF 03.5 |
00FD: GOTO 0F9 |
00FE: MOVF 1E,W |
00FF: CLRF 2C |
0100: MOVWF 2B |
.................... read_adc(ADC_START_ONLY); // Ostartuji dalsi prevod (na pozadi) |
0101: BSF 1F.2 |
.................... |
.................... //setup_timer_2(T2_DIV_BY_16,T,1); |
.................... if(T>0) *0x92=T; // Preload register casovace |
0102: MOVF 2B,F |
0103: BTFSS 03.2 |
0104: GOTO 108 |
0105: MOVF 2C,F |
0106: BTFSC 03.2 |
0107: GOTO 10C |
0108: MOVF 2B,W |
0109: BSF 03.5 |
010A: MOVWF 12 |
010B: BCF 03.5 |
.................... |
.................... // Podle prepinacu se hybu |
.................... if(input(PIN_B5)) |
010C: BSF 03.5 |
010D: BSF 06.5 |
010E: BCF 03.5 |
010F: BTFSS 06.5 |
0110: GOTO 11E |
.................... { |
.................... if(input(PIN_B4)) StepSetDirection(1); else StepSetDirection(-1); |
0111: BSF 03.5 |
0112: BSF 06.4 |
0113: BCF 03.5 |
0114: BTFSS 06.4 |
0115: GOTO 11A |
0116: MOVLW 01 |
0117: MOVWF 30 |
0118: CALL 070 |
0119: GOTO 11D |
011A: MOVLW FF |
011B: MOVWF 30 |
011C: CALL 070 |
.................... } |
.................... else |
011D: GOTO 13E |
.................... { int1 x; // pomocna promenna aby se volalo spozdeni jen 1x |
.................... if (StepState>230) { |
011E: MOVF 29,W |
011F: SUBLW E6 |
0120: BTFSC 03.0 |
0121: GOTO 136 |
.................... if (!input(PIN_B4) && (x)) |
0122: BSF 03.5 |
0123: BSF 06.4 |
0124: BCF 03.5 |
0125: BTFSC 06.4 |
0126: GOTO 133 |
0127: BTFSS 2F.0 |
0128: GOTO 133 |
.................... { |
.................... StepSetDirection(0); |
0129: CLRF 30 |
012A: CALL 070 |
.................... delay_ms(500); |
012B: MOVLW 02 |
012C: MOVWF 30 |
012D: MOVLW FA |
012E: MOVWF 31 |
012F: GOTO 082 |
0130: DECFSZ 30,F |
0131: GOTO 12D |
.................... x=0; |
0132: BCF 2F.0 |
.................... }; |
.................... StepSetDirection(-1); |
0133: MOVLW FF |
0134: MOVWF 30 |
0135: CALL 070 |
.................... } |
.................... if (StepState<30) { |
0136: MOVF 29,W |
0137: SUBLW 1D |
0138: BTFSS 03.0 |
0139: GOTO 13E |
.................... StepSetDirection( 1); |
013A: MOVLW 01 |
013B: MOVWF 30 |
013C: CALL 070 |
.................... x=1; |
013D: BSF 2F.0 |
.................... } |
.................... } |
.................... //StepDirection=2; |
.................... //for(i=0;i<800;i++) |
.................... //{ |
.................... // StepNext(); |
.................... // Delay(T); |
.................... //} |
.................... //delay_ms(10); |
.................... //StepDirection=-1; |
.................... //for(i=0;i<800;i++) |
.................... //{ |
.................... // StepNext(); |
.................... // Delay(T); |
.................... //} |
.................... //delay_ms(10); |
.................... |
.................... } // Cyklus for |
013E: BSF 03.5 |
013F: GOTO 0F9 |
.................... |
.................... } |
.................... |
0140: SLEEP |
Configuration Fuses: |
Word 1: 3F3B NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT RC |
Word 2: 3FFF FCMEN IESO |
/programy/PIC_C/motory/krokac/KROKAC.PJT |
---|
0,0 → 1,39 |
[PROJECT] |
Target=krokac.HEX |
Development_Mode= |
Processor=0x688F |
ToolSuite=CCS |
[Directories] |
Include=C:\PROGRAM FILES\PICC_3_234\devices\;C:\PROGRAM FILES\P |
Library= |
LinkerScript= |
[Target Data] |
FileList=krokac.c; |
BuildTool=C-COMPILER |
OptionString=+FM |
AdditionalOptionString= |
BuildRequired=1 |
[krokac.c] |
Type=4 |
Path= |
FileList= |
BuildTool= |
OptionString= |
AdditionalOptionString= |
[mru-list] |
1=krokac.c |
[Windows] |
0=0000 krokac.c 0 0 796 451 3 0 |
[Opened Files] |
1=C:\MIHO_DAT\KROKAC\krokac.c |
2=C:\MIHO_DAT\KROKAC\krokac.h |
3=C:\PROGRAM FILES\PICC_3_234\devices\16F88.h |
4=C:\MIHO_DAT\KROKAC\krokac.lst |
5= |
/programy/PIC_C/motory/menice/Run.BAT |
---|
0,0 → 1,8 |
@echo off |
:loop |
picpgr reset PIC16F84 |
picpgr run |
pause |
picpgr stop |
pause |
goto loop |
/programy/PIC_C/motory/menice/main.BAK |
---|
0,0 → 1,21 |
#include "D:\@Kaklik\programy\PIC_C\motory\menice\main.h" |
#DEFINE L1 pin_A0 |
#DEFINE L2 pin_A1 |
void main() |
{ |
output_low(L1); |
output_low(L2); |
while(true) |
{ |
output_high(L1); |
output_low(L2); |
Delay_ms(16); |
output_low(L1); |
output_high(L2); |
Delay_ms(16); |
} |
} |
/programy/PIC_C/motory/menice/main.HEX |
---|
0,0 → 1,11 |
:1000000000308A00192800000F308400000803190E |
:10001000182801308D008C018C0B0C288D0B0B28BF |
:100020004A308C008C0B122800000000800B09283D |
:10003000003484011F3083058316051083120510D8 |
:100040008316851083128510831685108312851000 |
:10005000831605108312051411308F0004208316B7 |
:100060000510831205108316851083128514113034 |
:080070008F0004202428630026 |
:02400E00FE3F73 |
:00000001FF |
;PIC16F84 |
/programy/PIC_C/motory/menice/main.LST |
---|
0,0 → 1,102 |
CCS PCW C Compiler, Version 3.110, 15448 |
Filename: d:\@kaklik\programy\pic_c\motory\menice\main.LST |
ROM used: 60 (6%) |
Largest free fragment is 964 |
RAM used: 2 (3%) at main() level |
3 (4%) worst case |
Stack: 1 locations |
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 019 |
0003: NOP |
.................... #include "D:\@Kaklik\programy\PIC_C\motory\menice\main.h" |
.................... #include <16F84.h> |
.................... //////// Standard Header file for the PIC16F84 device //////////////// |
.................... #device PIC16F84 |
.................... #list |
.................... |
.................... #use delay(clock=4000000) |
0004: MOVLW 0F |
0005: MOVWF 04 |
0006: MOVF 00,W |
0007: BTFSC 03.2 |
0008: GOTO 018 |
0009: MOVLW 01 |
000A: MOVWF 0D |
000B: CLRF 0C |
000C: DECFSZ 0C,F |
000D: GOTO 00C |
000E: DECFSZ 0D,F |
000F: GOTO 00B |
0010: MOVLW 4A |
0011: MOVWF 0C |
0012: DECFSZ 0C,F |
0013: GOTO 012 |
0014: NOP |
0015: NOP |
0016: DECFSZ 00,F |
0017: GOTO 009 |
0018: RETLW 00 |
.................... #fuses HS,WDT |
.................... |
.................... |
.................... |
.................... #DEFINE L1 pin_A0 |
.................... #DEFINE L2 pin_A1 |
.................... |
.................... void main() |
.................... { |
0019: CLRF 04 |
001A: MOVLW 1F |
001B: ANDWF 03,F |
.................... output_low(L1); |
001C: BSF 03.5 |
001D: BCF 05.0 |
001E: BCF 03.5 |
001F: BCF 05.0 |
.................... output_low(L2); |
0020: BSF 03.5 |
0021: BCF 05.1 |
0022: BCF 03.5 |
0023: BCF 05.1 |
.................... |
.................... while(true) |
.................... { |
.................... output_low(L2); |
0024: BSF 03.5 |
0025: BCF 05.1 |
0026: BCF 03.5 |
0027: BCF 05.1 |
.................... output_high(L1); |
0028: BSF 03.5 |
0029: BCF 05.0 |
002A: BCF 03.5 |
002B: BSF 05.0 |
.................... Delay_ms(17); |
002C: MOVLW 11 |
002D: MOVWF 0F |
002E: CALL 004 |
.................... output_low(L1); |
002F: BSF 03.5 |
0030: BCF 05.0 |
0031: BCF 03.5 |
0032: BCF 05.0 |
.................... output_high(L2); |
0033: BSF 03.5 |
0034: BCF 05.1 |
0035: BCF 03.5 |
0036: BSF 05.1 |
.................... Delay_ms(17); |
0037: MOVLW 11 |
0038: MOVWF 0F |
0039: CALL 004 |
.................... |
.................... } |
003A: GOTO 024 |
.................... } |
.................... |
003B: SLEEP |
/programy/PIC_C/motory/menice/main.PJT |
---|
0,0 → 1,32 |
[PROJECT] |
Target=main.HEX |
Development_Mode= |
Processor=0x684A |
ToolSuite=CCS |
[Directories] |
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr; |
Library= |
LinkerScript= |
[Target Data] |
FileList=main.c; |
BuildTool=C-COMPILER |
OptionString=+FM |
AdditionalOptionString= |
BuildRequired=1 |
[main.c] |
Type=4 |
Path= |
FileList= |
BuildTool= |
OptionString= |
AdditionalOptionString= |
[mru-list] |
1=main.c |
[Windows] |
0=0000 main.c 0 0 796 451 3 0 |
/programy/PIC_C/motory/menice/main.SYM |
---|
0,0 → 1,13 |
00C @SCRATCH |
00D @SCRATCH |
00D _RETURN_ |
00F delay_ms.P1 |
delay_us.P1 |
0004 delay_ms |
0019 main |
Project Files: |
d:\@kaklik\programy\pic_c\motory\menice\main.c |
D:\@Kaklik\programy\PIC_C\motory\menice\main.h |
C:\PROGRAM FILES\PICC\devices\16F84.h |
/programy/PIC_C/motory/menice/main.c |
---|
0,0 → 1,21 |
#include "D:\@Kaklik\programy\PIC_C\motory\menice\main.h" |
#DEFINE L1 pin_A0 |
#DEFINE L2 pin_A1 |
void main() |
{ |
output_low(L1); |
output_low(L2); |
while(true) |
{ |
output_low(L2); |
output_high(L1); |
Delay_ms(17); |
output_low(L1); |
output_high(L2); |
Delay_ms(17); |
} |
} |
/programy/PIC_C/motory/menice/main.cod |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/PIC_C/motory/menice/main.err |
---|
0,0 → 1,0 |
No Errors |
/programy/PIC_C/motory/menice/main.h |
---|
0,0 → 1,4 |
#include <16F84.h> |
#use delay(clock=4000000) |
#fuses HS,WDT |
/programy/PIC_C/motory/menice/main.sta |
---|
0,0 → 1,28 |
ROM used: 60 (6%) |
964 (94%) including unused fragments |
0 Average locations per line |
6 Average locations per statement |
RAM used: 2 (3%) at main() level |
3 (4%) worst case |
Lines Stmts % Files |
----- ----- --- ----- |
22 10 100 d:\@kaklik\programy\pic_c\motory\menice\main.c |
5 0 0 D:\@Kaklik\programy\PIC_C\motory\menice\main.h |
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h |
----- ----- |
276 20 Total |
Page ROM % RAM Functions: |
---- --- --- --- ---------- |
0 21 35 1 delay_ms |
0 35 58 0 main |
Segment Used Free |
--------- ---- ---- |
0000-0003 4 0 |
0004-03FF 56 964 |
/programy/PIC_C/motory/menice/main.tre |
---|
0,0 → 1,5 |
ÀÄmain |
ÀÄmain 0/35 Ram=0 |
ÃÄ??0?? |
ÃÄdelay_ms 0/21 Ram=1 |
ÀÄdelay_ms 0/21 Ram=1 |
/programy/PIC_C/motory/menice/prg.bat |
---|
0,0 → 1,6 |
call picpgr stop |
call picpgr erase pic16f84 |
call picpgr program main.hex hex pic16f84 |
call picpgr run |
pause |
call picpgr stop |
/programy/PIC_C/motory/menice/vssver.scc |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |