Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mats Engstrom
committed
Sep 14, 2011
0 parents
commit bcf8a75
Showing
24 changed files
with
18,562 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[HEADER] | ||
magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13} | ||
file_version=1.0 | ||
device=PIC10F202 | ||
[PATH_INFO] | ||
BuildDirPolicy=BuildDirIsProjectDir | ||
dir_src= | ||
dir_bin= | ||
dir_tmp= | ||
dir_sin= | ||
dir_inc= | ||
dir_lib= | ||
dir_lkr= | ||
[CAT_FILTERS] | ||
filter_src=*.asm | ||
filter_inc=*.h;*.inc | ||
filter_obj=*.o | ||
filter_lib=*.lib | ||
filter_lkr=*.lkr | ||
[CAT_SUBFOLDERS] | ||
subfolder_src= | ||
subfolder_inc= | ||
subfolder_obj= | ||
subfolder_lib= | ||
subfolder_lkr= | ||
[FILE_SUBFOLDERS] | ||
file_000=. | ||
[GENERATED_FILES] | ||
file_000=no | ||
[OTHER_FILES] | ||
file_000=no | ||
[FILE_INFO] | ||
file_000=main.asm | ||
[SUITE_INFO] | ||
suite_guid={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484} | ||
suite_state=generate-absolute-code | ||
[TOOL_SETTINGS] | ||
TS{DD2213A8-6310-47B1-8376-9430CDFC013F}= | ||
TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/o"$(BINDIR_)$(TARGETBASE).cof" /M"$(BINDIR_)$(TARGETBASE).map" /W | ||
TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}= | ||
[INSTRUMENTED_TRACE] | ||
enable=0 | ||
transport=0 | ||
format=0 | ||
[CUSTOM_BUILD] | ||
Pre-Build= | ||
Pre-BuildEnabled=1 | ||
Post-Build= | ||
Post-BuildEnabled=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Header] | ||
MagicCookie={0b13fe8c-dfe0-40eb-8900-6712719559a7} | ||
Version=1.0 | ||
[TOOL_LOC_STAMPS] | ||
tool_loc{49D3CA3F-D9A3-4518-9943-226A347E8CC7}=C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe | ||
tool_loc{96C98149-AA1B-4CF9-B967-FAE79CAB663C}=C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,316 @@ | ||
; | ||
; tris | ||
; 1=Input 0=Output | ||
; | ||
; | ||
; OPTION | ||
; bit 7 GPWU: Enable Wake-up on Pin Change bit (GP0, GP1, GP3) 1 = Disabled 0 = Enabled | ||
; bit 6 GPPU: Enable Weak Pull-ups bit (GP0, GP1, GP3) 1 = Disabled 0 = Enabled | ||
; bit 5 T0CS: Timer0 Clock Source Select bit 1 = Transition on T0CKI pin (overrides tris on the T0CKI pin) 0 = Transition on internal instruction cycle clock, FOSC/4 | ||
; bit 4 T0SE: Timer0 Source Edge Select bit 1 = Increment on high-to-low transition on the T0CKI pin 0 = Increment on low-to-high transition on the T0CKI pin | ||
; bit 3 PSA: Prescaler Assignment bit 1 = Prescaler assigned to the WDT 0 = Prescaler assigned to Timer0 | ||
; bit 2-0 PS<2:0>: Prescaler Rate Select bits | ||
; 000 1 : 2 1 : 1 | ||
; 001 1 : 4 1 : 2 | ||
; 010 1 : 8 1 : 4 | ||
; 011 1 : 16 1 : 8 | ||
; 100 1 : 32 1 : 16 | ||
; 101 1 : 64 1 : 32 | ||
; 110 1 : 128 1 : 64 | ||
; 111 1 : 256 1 : 128 | ||
; | ||
|
||
list p=10F202 ; list directive to define processor | ||
#include <p10F202.inc> ; processor specific variable definitions | ||
errorlevel -227 | ||
|
||
; __CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF | ||
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF | ||
|
||
|
||
cblock 0x08 | ||
count1 | ||
count2 | ||
randHi | ||
randLo | ||
statustemp | ||
temp | ||
endc | ||
|
||
|
||
ORG 0x1FF ; processor reset vector | ||
|
||
; Internal RC calibration value is placed at location 0x1FF by Microchip | ||
; as a movlw k, where the k is a literal value. | ||
|
||
ORG 0x000 ; Start of code | ||
movwf OSCCAL ; update register with factory cal value | ||
|
||
movlw B'11000111' ; NoWake, NoPullup, F/4, LoHi, PreT0, 1:256 | ||
OPTION | ||
|
||
movlw 0x30 | ||
movwf randHi | ||
movlw 0x45 | ||
movwf randLo | ||
|
||
; | ||
; | ||
; | ||
; | ||
call Led1 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led2 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led3 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led4 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led5 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led6 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
|
||
touch | ||
movlw 0x10 | ||
call DelayWms | ||
call LedOff | ||
movlw 0x80 | ||
call DelayWms | ||
movf GPIO, W | ||
andlw 0x08 | ||
btfsc STATUS,Z | ||
goto touch2 | ||
call Led3 | ||
goto touch | ||
touch2 | ||
call Led4 | ||
goto touch | ||
|
||
|
||
RandomFlashLoop | ||
movlw 0x05 | ||
call DelayWms | ||
call LedOff | ||
movlw 0x80 | ||
call DelayWms | ||
|
||
RedoRandom | ||
call Random16 | ||
movf randLo, W | ||
andlw 0x07 | ||
movwf temp | ||
btfsc STATUS,Z | ||
goto R1 | ||
|
||
decf temp, F | ||
btfsc STATUS,Z | ||
goto R2 | ||
|
||
decf temp, F | ||
btfsc STATUS,Z | ||
goto R3 | ||
|
||
decf temp, F | ||
btfsc STATUS,Z | ||
goto R4 | ||
|
||
decf temp, F | ||
btfsc STATUS,Z | ||
goto R5 | ||
|
||
decf temp, F | ||
btfsc STATUS,Z | ||
goto R6 | ||
|
||
goto RedoRandom | ||
|
||
R1 | ||
call Led1 | ||
goto RandomFlashLoop | ||
R2 | ||
call Led2 | ||
goto RandomFlashLoop | ||
R3 | ||
call Led3 | ||
goto RandomFlashLoop | ||
R4 | ||
call Led4 | ||
goto RandomFlashLoop | ||
R5 | ||
call Led5 | ||
goto RandomFlashLoop | ||
R6 | ||
call Led6 | ||
goto RandomFlashLoop | ||
|
||
|
||
Loop1 | ||
call Led1 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led2 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led3 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led4 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led5 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
call Led6 | ||
movlw 0xFF | ||
call DelayWms | ||
|
||
goto Loop1 | ||
|
||
|
||
LedOff | ||
clrf GPIO ; GP0=Low GP1=Low GP2=Low | ||
movlw B'11111111' ; All GP Input | ||
tris GPIO | ||
return | ||
|
||
Led1 | ||
movlw B'00000001' ; GP0=Hi GP1=Low | ||
movwf GPIO | ||
movlw B'11111100' ; GP0 & GP1 Output | ||
tris GPIO | ||
return | ||
|
||
Led2 | ||
movlw B'00000010' ; GP0=Low GP1=Hi | ||
movwf GPIO | ||
movlw B'11111100' ; GP0 & GP1 Output | ||
tris GPIO | ||
return | ||
|
||
Led3 | ||
movlw B'00000001' ; GP0=Hi GP2=Low | ||
movwf GPIO | ||
movlw B'11111010' ; GP0 & GP2 Output | ||
tris GPIO | ||
return | ||
|
||
Led4 | ||
movlw B'00000100' ; GP0=Low GP2=Hi | ||
movwf GPIO | ||
movlw B'11111010' ; GP0 & GP2 Output | ||
tris GPIO | ||
return | ||
|
||
Led5 | ||
movlw B'00000010' ; GP1=Hi GP2=Low | ||
movwf GPIO | ||
movlw B'11111001' ; GP1 & GP2 Output | ||
tris GPIO | ||
return | ||
|
||
Led6 | ||
movlw B'00000100' ; GP1=Low GP2=Hi | ||
movwf GPIO | ||
movlw B'11111001' ; GP1 & GP2 Output | ||
tris GPIO | ||
return | ||
|
||
|
||
|
||
;******************************************************************* | ||
; | ||
; Delay for "w" ms | ||
; | ||
; This should be really be implemented as a TMR0 based delay with | ||
; cpu sleep mode. | ||
; | ||
;******************************************************************* | ||
DelayWms ;variable delay | ||
movwf count1 | ||
incf count1, F ;because 0 would give long delay | ||
loopw1 | ||
|
||
movlw 0xFF | ||
movwf count2 | ||
loopw2 | ||
decfsz count2,F | ||
goto loopw2 | ||
|
||
decfsz count1,F | ||
goto loopw1 | ||
return | ||
|
||
|
||
|
||
|
||
;******************************************************************* | ||
; | ||
; Random Number Generator | ||
; | ||
; This routine generates a 16 Bit Pseudo Sequence Random Generator | ||
; It is based on Linear shift register feedback. The sequence | ||
; is generated by (Q15 xorwf Q14 xorwf Q12 xorwf Q3 ) | ||
; | ||
; The 16 bit random number is in location RandHi(high byte) | ||
; & RandLo (low byte) | ||
; | ||
; Before calling this routine, make sure the initial values | ||
; of RandHi & RandLo are NOT ZERO | ||
; A good choise of initial random number is 0x3045 | ||
;******************************************************************* | ||
; | ||
Random16 | ||
rlf randHi,W | ||
xorwf randHi,W | ||
movwf temp | ||
rlf temp, W ; carry bit = xorwf(Q15,14) | ||
swapf randHi, F | ||
swapf randLo, W | ||
movf STATUS, W | ||
movwf statustemp | ||
|
||
bcf STATUS, C | ||
movwf temp | ||
rlf temp, F | ||
btfsc STATUS, C | ||
bsf temp, 0 | ||
|
||
movf statustemp, W | ||
movwf STATUS | ||
|
||
|
||
movf temp, W | ||
|
||
|
||
xorwf randHi,W ; LSB = xorwf(Q12,Q3) | ||
swapf randHi, F | ||
andlw 0x01 | ||
|
||
rlf randLo, F | ||
xorwf randLo, F | ||
rlf randHi, F | ||
return | ||
|
||
|
||
|
||
|
||
END |
Binary file not shown.
Oops, something went wrong.