/programy/C/PIC_C/mereni/PS2mys/PIC16F84/RUN.PIF |
---|
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/C/PIC_C/mereni/PS2mys/PIC16F84/Run.BAT |
---|
0,0 → 1,8 |
@echo off |
:loop |
picpgr reset PIC16F84 lpt2 |
picpgr run lpt2 |
pause |
picpgr stop lpt2 |
pause |
goto loop |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.BAK |
---|
0,0 → 1,57 |
#include "main.h" |
#include "c:\library\kaklik\CSS\PS2.c" |
#define SIGN_X 4 |
void trigger() |
{ |
output_high(PIN_A0); |
output_low(PIN_A0); |
delay_us(100); |
output_high(PIN_A0); |
} |
void flash_red() // blikne ledkou |
{ |
output_high(LED_red); |
Delay_ms(BLIK); |
output_low(LED_red); |
} |
void flash_yellow() // blikne ledkou |
{ |
output_high(LED_yellow); |
Delay_ms(BLIK); |
output_low(LED_yellow); |
} |
void main() |
{ |
int8 X,y,tl=0; |
int8 X_old,y_old,tl_old=0; |
Delay_ms(500); |
send(ENABLE_DATA_REPORTING); |
while(true) |
{ |
tl = read_byte(PRVNI); |
x = read_byte(DRUHY); |
y = read_byte(TRETI); |
trigger(); |
if (bit_test(tl, SIGN_X)) |
{ |
output_high(LED_red); |
output_low(LED_yellow); |
} |
else |
{ |
output_high(LED_yellow); |
output_low(LED_red); |
} |
} |
} |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.HEX |
---|
0,0 → 1,38 |
:1000000000308A00D128000016308400000803194F |
:10001000182801308D008C018C0B0C288D0B0B28BF |
:100020004A308C008C0B122800000000800B09283D |
:10003000DB28970183160614861083128610213060 |
:100040008C008C0B212883160610831206100630B4 |
:100050008C008C0B29280000831686148312861CC2 |
:100060002C2896011608073C031C52288316861478 |
:1000700083128618362815080139003A031D4228D4 |
:10008000061043280614831606108312150801393A |
:1000900097070310950C831686148312861C4B2831 |
:1000A000960A322883168614831286185228170857 |
:1000B000FF3A0139003A031D5F2806106028061434 |
:1000C0008316061086148312861868288316622801 |
:1000D00069288316861483128618692806148316E5 |
:1000E00006108614831286187728831671287828BC |
:1000F000831606148312E0289601160203188D2831 |
:10010000831686148312861C8A288316061483128B |
:1001100006188B289601960A7D288316861483126A |
:1001200086188D2883160614831206188D288316C8 |
:1001300086148312861C9728950196011608073CA1 |
:10014000031CBD288316861483128618A228031068 |
:10015000950C8316061400308312061801308C00AB |
:100160000C0C8C0103188C170C089504831686144C |
:100170008312861CB628960A9E2815088D00003426 |
:1001800083160510831205148316051083120510BB |
:1001900021308C008C0BCA2883160510831205149D |
:1001A000FC2884011F3083059101940102309500E1 |
:1001B000FA3096000428950BD828F43095001928B9 |
:1001C000E83083160317FF00831203137C200D0809 |
:1001D0009100023083160317FF00831203137C2063 |
:1001E0000D088F00023083160317FF0083120313DC |
:1001F0007C200D089000C028111E072983160511C8 |
:100200008312051583168511831285110F29831614 |
:100210008511831285158316051183120511E028B7 |
:02022000630079 |
:02400E00F93F78 |
:00000001FF |
;PIC16F84 |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.LST |
---|
0,0 → 1,474 |
CCS PCW C Compiler, Version 3.110, 15448 |
Filename: d:\@kaklik\programy\pic_c\ps2mys\main.LST |
ROM used: 273 (27%) |
Largest free fragment is 751 |
RAM used: 9 (13%) at main() level |
12 (18%) worst case |
Stack: 1 locations |
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 0D1 |
0003: NOP |
.................... #include "D:\@Kaklik\programy\PIC_C\PS2mys\main.h" |
.................... #include <16F84.h> |
.................... //////// Standard Header file for the PIC16F84 device //////////////// |
.................... #device PIC16F84 |
.................... #list |
.................... |
.................... #use delay(clock=4000000) |
0004: MOVLW 16 |
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: GOTO 0DB (RETURN) |
.................... #fuses XT,NOWDT |
.................... |
.................... #DEFINE DATA PIN_B0 // musi byt definovan kanal DATA |
.................... #DEFINE CLK PIN_B1 // a taky hodiny CLK |
.................... |
.................... #define PRVNI 1000 // nastaveni prodlevy pred zacatkem vysilani bajtu |
.................... #define DRUHY 2 |
.................... #define TRETI DRUHY |
.................... |
.................... // prikazy |
.................... #define RESET 0xFF |
.................... #define ENABLE_DATA_REPORTING 0xF4 |
.................... #define READ_DATA 0xEB |
.................... #define STATUS_REQUEST 0xE9 |
.................... #define SET_REMOTE_MODE 0xF0 |
.................... #define SET_STREAM_MODE 0xEA |
.................... #define GET_DEVICE_ID 0xF2 |
.................... |
.................... #DEFINE LED_yellow PIN_A3 |
.................... #DEFINE LED_red PIN_A2 |
.................... |
.................... #DEFINE BLIK 120 // doba rozsviceni led |
.................... |
.................... #include "PS2.c" |
.................... // Modul pro komunikaci s Mysi |
.................... |
.................... void send(byte command) |
.................... { |
.................... int n; |
0019: CLRF 17 |
.................... int parity=0; |
.................... |
.................... //Request-to-send |
.................... output_float(DATA); |
001A: BSF 03.5 |
001B: BSF 06.0 |
.................... output_low(CLK); |
001C: BCF 06.1 |
001D: BCF 03.5 |
001E: BCF 06.1 |
.................... delay_us(100); |
001F: MOVLW 21 |
0020: MOVWF 0C |
0021: DECFSZ 0C,F |
0022: GOTO 021 |
.................... // start bit |
.................... output_low(DATA); |
0023: BSF 03.5 |
0024: BCF 06.0 |
0025: BCF 03.5 |
0026: BCF 06.0 |
.................... delay_us(20); |
0027: MOVLW 06 |
0028: MOVWF 0C |
0029: DECFSZ 0C,F |
002A: GOTO 029 |
002B: NOP |
.................... while(!input(CLK)); |
002C: BSF 03.5 |
002D: BSF 06.1 |
002E: BCF 03.5 |
002F: BTFSS 06.1 |
0030: GOTO 02C |
.................... // 8 bitu |
.................... for(n=0; n<8; n++) |
0031: CLRF 16 |
0032: MOVF 16,W |
0033: SUBLW 07 |
0034: BTFSS 03.0 |
0035: GOTO 052 |
.................... { |
.................... while(input(CLK)); |
0036: BSF 03.5 |
0037: BSF 06.1 |
0038: BCF 03.5 |
0039: BTFSC 06.1 |
003A: GOTO 036 |
.................... output_bit(DATA, command & 1); |
003B: MOVF 15,W |
003C: ANDLW 01 |
003D: XORLW 00 |
003E: BTFSS 03.2 |
003F: GOTO 042 |
0040: BCF 06.0 |
0041: GOTO 043 |
0042: BSF 06.0 |
0043: BSF 03.5 |
0044: BCF 06.0 |
.................... parity += command & 1; |
0045: BCF 03.5 |
0046: MOVF 15,W |
0047: ANDLW 01 |
0048: ADDWF 17,F |
.................... command>>=1; |
0049: BCF 03.0 |
004A: RRF 15,F |
.................... while(!input(CLK)); |
004B: BSF 03.5 |
004C: BSF 06.1 |
004D: BCF 03.5 |
004E: BTFSS 06.1 |
004F: GOTO 04B |
.................... }; |
0050: INCF 16,F |
0051: GOTO 032 |
.................... // parita |
.................... while(input(CLK)); |
0052: BSF 03.5 |
0053: BSF 06.1 |
0054: BCF 03.5 |
0055: BTFSC 06.1 |
0056: GOTO 052 |
.................... output_bit(DATA, ~parity & 1); |
0057: MOVF 17,W |
0058: XORLW FF |
0059: ANDLW 01 |
005A: XORLW 00 |
005B: BTFSS 03.2 |
005C: GOTO 05F |
005D: BCF 06.0 |
005E: GOTO 060 |
005F: BSF 06.0 |
0060: BSF 03.5 |
0061: BCF 06.0 |
.................... while(!input(CLK)); |
0062: BSF 06.1 |
0063: BCF 03.5 |
0064: BTFSC 06.1 |
0065: GOTO 068 |
0066: BSF 03.5 |
0067: GOTO 062 |
0068: GOTO 069 |
.................... // stop bit |
.................... while(input(CLK)); |
0069: BSF 03.5 |
006A: BSF 06.1 |
006B: BCF 03.5 |
006C: BTFSC 06.1 |
006D: GOTO 069 |
.................... output_bit(DATA, 1); |
006E: BSF 06.0 |
006F: BSF 03.5 |
0070: BCF 06.0 |
.................... while(!input(CLK)); |
0071: BSF 06.1 |
0072: BCF 03.5 |
0073: BTFSC 06.1 |
0074: GOTO 077 |
0075: BSF 03.5 |
0076: GOTO 071 |
0077: GOTO 078 |
.................... output_float(DATA); |
0078: BSF 03.5 |
0079: BSF 06.0 |
007A: BCF 03.5 |
007B: GOTO 0E0 (RETURN) |
.................... } |
.................... |
.................... |
.................... int8 read_byte(int8 const poradi) |
.................... { |
.................... int8 bajt; |
.................... int8 i; |
.................... |
.................... // cekani na komunikacni klid |
.................... for (i=0; i<poradi; i++) |
007C: CLRF 16 |
007D: SUBWF 16,W |
007E: BTFSC 03.0 |
007F: GOTO 08D |
.................... { |
.................... if (!input(CLK) || !input(DATA)) i=0; |
0080: BSF 03.5 |
0081: BSF 06.1 |
0082: BCF 03.5 |
0083: BTFSS 06.1 |
0084: GOTO 08A |
0085: BSF 03.5 |
0086: BSF 06.0 |
0087: BCF 03.5 |
0088: BTFSC 06.0 |
0089: GOTO 08B |
008A: CLRF 16 |
.................... }; |
008B: INCF 16,F |
008C: GOTO 07D |
.................... |
.................... // cekani na startbit |
.................... while(input(CLK) || input(DATA)); |
008D: BSF 03.5 |
008E: BSF 06.1 |
008F: BCF 03.5 |
0090: BTFSC 06.1 |
0091: GOTO 08D |
0092: BSF 03.5 |
0093: BSF 06.0 |
0094: BCF 03.5 |
0095: BTFSC 06.0 |
0096: GOTO 08D |
.................... while(!input(CLK)); |
0097: BSF 03.5 |
0098: BSF 06.1 |
0099: BCF 03.5 |
009A: BTFSS 06.1 |
009B: GOTO 097 |
.................... |
.................... bajt = 0; |
009C: CLRF 15 |
.................... for(i=0; i<8; i++) |
009D: CLRF 16 |
009E: MOVF 16,W |
009F: SUBLW 07 |
00A0: BTFSS 03.0 |
00A1: GOTO 0BD |
.................... { |
.................... while(input(CLK)); // ceka na nulu hodin |
00A2: BSF 03.5 |
00A3: BSF 06.1 |
00A4: BCF 03.5 |
00A5: BTFSC 06.1 |
00A6: GOTO 0A2 |
.................... |
.................... bajt >>= 1; |
00A7: BCF 03.0 |
00A8: RRF 15,F |
.................... bajt |= input(DATA) << 7; |
00A9: BSF 03.5 |
00AA: BSF 06.0 |
00AB: MOVLW 00 |
00AC: BCF 03.5 |
00AD: BTFSC 06.0 |
00AE: MOVLW 01 |
00AF: MOVWF 0C |
00B0: RRF 0C,W |
00B1: CLRF 0C |
00B2: BTFSC 03.0 |
00B3: BSF 0C.7 |
00B4: MOVF 0C,W |
00B5: IORWF 15,F |
.................... |
.................... while(!input(CLK)); // ceka na jednicku hodin |
00B6: BSF 03.5 |
00B7: BSF 06.1 |
00B8: BCF 03.5 |
00B9: BTFSS 06.1 |
00BA: GOTO 0B6 |
.................... }; |
00BB: INCF 16,F |
00BC: GOTO 09E |
.................... return (bajt); |
00BD: MOVF 15,W |
00BE: MOVWF 0D |
00BF: RETLW 00 |
.................... } |
.................... |
.................... |
.................... /*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty |
.................... { |
.................... int8 i; |
.................... |
.................... // *st=read_byte(1st); |
.................... |
.................... // cekani na startbit |
.................... while(input(CLK) || input(DATA)); |
.................... while(!input(CLK)); |
.................... *nd = 0; |
.................... for(i=0; i<8; i++) |
.................... { |
.................... while(input(CLK)); // ceka na nulu hodin |
.................... |
.................... *nd |= input(DATA) << 7; |
.................... *nd >>= 1; |
.................... |
.................... while(!input(CLK)); // ceka na jednicku hodin |
.................... }; |
.................... |
.................... // cekani na startbit |
.................... while(input(CLK) || input(DATA)); |
.................... while(!input(CLK)); |
.................... *rd = 0; |
.................... for(i=0; i<8; i++) |
.................... { |
.................... while(input(CLK)); // ceka na nulu hodin |
.................... |
.................... *rd |= input(DATA) << 7; |
.................... *rd >>= 1; |
.................... |
.................... while(!input(CLK)); // ceka na jednicku hodin |
.................... }; |
.................... }*/ |
.................... |
.................... |
.................... #define SIGN_X 4 |
.................... |
.................... void trigger() |
.................... { |
.................... output_high(PIN_A0); |
00C0: BSF 03.5 |
00C1: BCF 05.0 |
00C2: BCF 03.5 |
00C3: BSF 05.0 |
.................... output_low(PIN_A0); |
00C4: BSF 03.5 |
00C5: BCF 05.0 |
00C6: BCF 03.5 |
00C7: BCF 05.0 |
.................... delay_us(100); |
00C8: MOVLW 21 |
00C9: MOVWF 0C |
00CA: DECFSZ 0C,F |
00CB: GOTO 0CA |
.................... output_high(PIN_A0); |
00CC: BSF 03.5 |
00CD: BCF 05.0 |
00CE: BCF 03.5 |
00CF: BSF 05.0 |
00D0: GOTO 0FC (RETURN) |
.................... } |
.................... |
.................... void flash_red() // blikne ledkou |
.................... { |
.................... output_high(LED_red); |
.................... Delay_ms(BLIK); |
.................... output_low(LED_red); |
.................... } |
.................... |
.................... void flash_yellow() // blikne ledkou |
.................... { |
.................... output_high(LED_yellow); |
.................... Delay_ms(BLIK); |
.................... output_low(LED_yellow); |
.................... } |
.................... |
.................... void main() |
.................... { |
.................... int8 X,y,tl=0; |
* |
00D4: CLRF 11 |
00D5: CLRF 14 |
.................... int8 X_old,y_old,tl_old=0; |
* |
00D1: CLRF 04 |
00D2: MOVLW 1F |
00D3: ANDWF 03,F |
.................... |
.................... Delay_ms(500); |
* |
00D6: MOVLW 02 |
00D7: MOVWF 15 |
00D8: MOVLW FA |
00D9: MOVWF 16 |
00DA: GOTO 004 |
00DB: DECFSZ 15,F |
00DC: GOTO 0D8 |
.................... send(ENABLE_DATA_REPORTING); |
00DD: MOVLW F4 |
00DE: MOVWF 15 |
00DF: GOTO 019 |
.................... |
.................... while(true) |
.................... { |
.................... tl = read_byte(PRVNI); |
00E0: MOVLW E8 |
00E1: BSF 03.5 |
00E2: BSF 03.6 |
00E3: MOVWF 7F |
00E4: BCF 03.5 |
00E5: BCF 03.6 |
00E6: CALL 07C |
00E7: MOVF 0D,W |
00E8: MOVWF 11 |
.................... x = read_byte(DRUHY); |
00E9: MOVLW 02 |
00EA: BSF 03.5 |
00EB: BSF 03.6 |
00EC: MOVWF 7F |
00ED: BCF 03.5 |
00EE: BCF 03.6 |
00EF: CALL 07C |
00F0: MOVF 0D,W |
00F1: MOVWF 0F |
.................... y = read_byte(TRETI); |
00F2: MOVLW 02 |
00F3: BSF 03.5 |
00F4: BSF 03.6 |
00F5: MOVWF 7F |
00F6: BCF 03.5 |
00F7: BCF 03.6 |
00F8: CALL 07C |
00F9: MOVF 0D,W |
00FA: MOVWF 10 |
.................... trigger(); |
00FB: GOTO 0C0 |
.................... |
.................... |
.................... if (bit_test(tl, SIGN_X)) |
00FC: BTFSS 11.4 |
00FD: GOTO 107 |
.................... { |
.................... output_high(LED_red); |
00FE: BSF 03.5 |
00FF: BCF 05.2 |
0100: BCF 03.5 |
0101: BSF 05.2 |
.................... output_low(LED_yellow); |
0102: BSF 03.5 |
0103: BCF 05.3 |
0104: BCF 03.5 |
0105: BCF 05.3 |
.................... } |
.................... else |
0106: GOTO 10F |
.................... { |
.................... output_high(LED_yellow); |
0107: BSF 03.5 |
0108: BCF 05.3 |
0109: BCF 03.5 |
010A: BSF 05.3 |
.................... output_low(LED_red); |
010B: BSF 03.5 |
010C: BCF 05.2 |
010D: BCF 03.5 |
010E: BCF 05.2 |
.................... } |
.................... } |
010F: GOTO 0E0 |
.................... } |
.................... |
0110: SLEEP |
.................... |
.................... |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.PJT |
---|
0,0 → 1,37 |
[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 |
[Opened Files] |
1=D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F84\main.c |
2=C:\PROGRAM FILES\PICC\devices\16F84.h |
3=c:\library\kaklik\CCS\PS2.c |
4= |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.SYM |
---|
0,0 → 1,32 |
00C @SCRATCH |
00D @SCRATCH |
00D _RETURN_ |
00F main.X |
010 main.y |
011 main.tl |
012 main.X_old |
013 main.y_old |
014 main.tl_old |
015 send.command |
015 read_byte.bajt |
015 main.@SCRATCH |
016 delay_ms.P1 |
016 send.n |
016 read_byte.i |
017 send.parity |
017 read_byte.@SCRATCH |
018 send.@SCRATCH |
delay_us.P1 |
read_byte.poradi |
0004 delay_ms |
0019 send |
007C read_byte |
00C0 trigger |
00D1 main |
Project Files: |
d:\@kaklik\programy\pic_c\ps2mys\main.c |
D:\@Kaklik\programy\PIC_C\PS2mys\main.h |
C:\PROGRAM FILES\PICC\devices\16F84.h |
d:\@kaklik\programy\pic_c\ps2mys\PS2.c |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.c |
---|
0,0 → 1,57 |
#include "main.h" |
#include "c:\library\kaklik\CCS\PS2.c" |
#define SIGN_X 4 |
void trigger() |
{ |
output_high(PIN_A0); |
output_low(PIN_A0); |
delay_us(100); |
output_high(PIN_A0); |
} |
void flash_red() // blikne ledkou |
{ |
output_high(LED_red); |
Delay_ms(BLIK); |
output_low(LED_red); |
} |
void flash_yellow() // blikne ledkou |
{ |
output_high(LED_yellow); |
Delay_ms(BLIK); |
output_low(LED_yellow); |
} |
void main() |
{ |
int8 X,y,tl=0; |
int8 X_old,y_old,tl_old=0; |
Delay_ms(500); |
send(ENABLE_DATA_REPORTING); |
while(true) |
{ |
tl = read_byte(PRVNI); |
x = read_byte(DRUHY); |
y = read_byte(TRETI); |
trigger(); |
if (bit_test(tl, SIGN_X)) |
{ |
output_high(LED_red); |
output_low(LED_yellow); |
} |
else |
{ |
output_high(LED_yellow); |
output_low(LED_red); |
} |
} |
} |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/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/C/PIC_C/mereni/PS2mys/PIC16F84/main.err |
---|
0,0 → 1,0 |
Error[51] c:\library\kaklik\CCS\PS2.c 48 : A numeric expression must appear here |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.h |
---|
0,0 → 1,24 |
#include <16F84.h> |
#use delay(clock=4000000) |
#fuses XT,NOWDT |
#DEFINE DATA PIN_B0 // musi byt definovan kanal DATA |
#DEFINE CLK PIN_B1 // a taky hodiny CLK |
#define PRVNI 1000 // nastaveni prodlevy pred zacatkem vysilani bajtu |
#define DRUHY 2 |
#define TRETI DRUHY |
// prikazy |
#define RESET 0xFF |
#define ENABLE_DATA_REPORTING 0xF4 |
#define READ_DATA 0xEB |
#define STATUS_REQUEST 0xE9 |
#define SET_REMOTE_MODE 0xF0 |
#define SET_STREAM_MODE 0xEA |
#define GET_DEVICE_ID 0xF2 |
#DEFINE LED_yellow PIN_A3 |
#DEFINE LED_red PIN_A2 |
#DEFINE BLIK 120 // doba rozsviceni led |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.sta |
---|
0,0 → 1,32 |
ROM used: 273 (27%) |
751 (73%) including unused fragments |
1 Average locations per line |
4 Average locations per statement |
RAM used: 9 (13%) at main() level |
12 (18%) worst case |
Lines Stmts % Files |
----- ----- --- ----- |
58 25 34 d:\@kaklik\programy\pic_c\ps2mys\main.c |
25 0 0 D:\@Kaklik\programy\PIC_C\PS2mys\main.h |
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h |
100 48 49 d:\@kaklik\programy\pic_c\ps2mys\PS2.c |
----- ----- |
588 146 Total |
Page ROM % RAM Functions: |
---- --- --- --- ---------- |
0 21 8 1 delay_ms |
0 99 36 4 send |
0 68 25 4 read_byte |
0 17 6 0 trigger |
0 64 23 7 main |
Segment Used Free |
--------- ---- ---- |
0000-0003 4 0 |
0004-03FF 269 751 |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.tre |
---|
0,0 → 1,9 |
ÀÄmain |
ÀÄmain 0/64 Ram=7 |
ÃÄ??0?? |
ÃÄdelay_ms 0/21 Ram=1 |
ÃÄsend 0/99 Ram=4 |
ÃÄread_byte 0/68 Ram=4 |
ÃÄread_byte 0/68 Ram=4 |
ÃÄread_byte 0/68 Ram=4 |
ÀÄtrigger 0/17 Ram=0 |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/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/C/PIC_C/mereni/PS2mys/PIC16F84/ps2.BAK |
---|
0,0 → 1,99 |
// Modul pro komunikaci s Mysi |
void send(byte command) |
{ |
int n; |
int parity=0; |
//Request-to-send |
// output_float(DATA); |
output_low(CLK); |
delay_us(100); |
// start bit |
output_low(DATA); |
delay_us(20); |
while(!input(CLK)); |
// 8 bitu |
for(n=0; n<8; n++) |
{ |
while(input(CLK)); |
output_bit(DATA, command & 1); |
parity += command & 1; |
command>>=1; |
while(!input(CLK)); |
}; |
// parita |
while(input(CLK)); |
output_bit(DATA, ~parity & 1); |
while(!input(CLK)); |
// stop bit |
while(input(CLK)); |
output_bit(DATA, 1); |
while(!input(CLK)); |
output_float(DATA); |
} |
int8 read_byte(int8 const poradi) |
{ |
int8 bajt; |
int8 i; |
// cekani na komunikacni klid |
for (i=0; i<poradi; i++) |
{ |
if (!input(CLK) || !input(DATA)) i=0; |
}; |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
bajt = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
bajt >>= 1; |
bajt |= input(DATA) << 7; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
return (bajt); |
} |
/*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty |
{ |
int8 i; |
// *st=read_byte(1st); |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
*nd = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
*nd |= input(DATA) << 7; |
*nd >>= 1; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
*rd = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
*rd |= input(DATA) << 7; |
*rd >>= 1; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
}*/ |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/ps2mouse.BAK |
---|
0,0 → 1,100 |
#include "main.h" |
#include "ps2mouse.h" |
void send(byte command) |
{ |
int n; |
int parity=0; |
//Request-to-send |
input(DATA); |
output_low(CLK); |
delay_us(100); |
// start bit |
output_low(DATA); |
delay_us(20); |
while(!input(CLK)); |
// 8 bitu |
for(n=0; n<8; n++) |
{ |
while(input(CLK)); |
output_bit(DATA, command & 1); |
parity += command & 1; |
command>>=1; |
while(!input(CLK)); |
}; |
// parita |
while(input(CLK)); |
output_bit(DATA, ~parity & 1); |
while(!input(CLK)); |
// stop bit |
while(input(CLK)); |
output_bit(DATA, 1); |
while(!input(CLK)); |
output_float(DATA); |
} |
int8 read_byte(int8 const poradi) |
{ |
int8 bajt; |
int8 i; |
// cekani na komunikacni klid |
for (i=0; i<poradi; i++) |
{ |
if (!input(CLK) || !input(DATA)) i=0; |
}; |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
bajt = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
bajt >>= 1; |
bajt |= input(DATA) << 7; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
return (bajt); |
} |
/*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty |
{ |
int8 i; |
// *st=read_byte(1st); |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
*nd = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
*nd |= input(DATA) << 7; |
*nd >>= 1; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
*rd = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
*rd |= input(DATA) << 7; |
*rd >>= 1; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
}*/ |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/ps2mouse.c |
---|
0,0 → 1,97 |
void send(byte command) |
{ |
int n; |
int parity=0; |
//Request-to-send |
input(DATA); |
output_low(CLK); |
delay_us(100); |
// start bit |
output_low(DATA); |
delay_us(20); |
while(!input(CLK)); |
// 8 bitu |
for(n=0; n<8; n++) |
{ |
while(input(CLK)); |
output_bit(DATA, command & 1); |
parity += command & 1; |
command>>=1; |
while(!input(CLK)); |
}; |
// parita |
while(input(CLK)); |
output_bit(DATA, ~parity & 1); |
while(!input(CLK)); |
// stop bit |
while(input(CLK)); |
output_bit(DATA, 1); |
while(!input(CLK)); |
output_float(DATA); |
} |
int8 read_byte(int8 const poradi) |
{ |
int8 bajt; |
int8 i; |
// cekani na komunikacni klid |
for (i=0; i<poradi; i++) |
{ |
if (!input(CLK) || !input(DATA)) i=0; |
}; |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
bajt = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
bajt >>= 1; |
bajt |= input(DATA) << 7; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
return (bajt); |
} |
/*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty |
{ |
int8 i; |
// *st=read_byte(1st); |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
*nd = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
*nd |= input(DATA) << 7; |
*nd >>= 1; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
// cekani na startbit |
while(input(CLK) || input(DATA)); |
while(!input(CLK)); |
*rd = 0; |
for(i=0; i<8; i++) |
{ |
while(input(CLK)); // ceka na nulu hodin |
*rd |= input(DATA) << 7; |
*rd >>= 1; |
while(!input(CLK)); // ceka na jednicku hodin |
}; |
}*/ |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/ps2mouse.h |
---|
0,0 → 1,18 |
#define PRVNI 1000 // nastaveni prodlevy pred zacatkem vysilani bajtu |
#define DRUHY 2 |
#define TRETI DRUHY |
// prikazy |
#define RESET 0xFF |
#define ENABLE_DATA_REPORTING 0xF4 |
#define READ_DATA 0xEB |
#define STATUS_REQUEST 0xE9 |
#define SET_REMOTE_MODE 0xF0 |
#define SET_STREAM_MODE 0xEA |
#define GET_DEVICE_ID 0xF2 |
void send(byte command); |
int8 read_byte(int8 const poradi); |
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/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 |