Subversion Repositories Programming Utils

Compare Revisions

Ignore whitespace Rev 72 → Rev 73

/trunk/TurnSignal/main.asm
0,0 → 1,146
; This is the main file for the turn signal
; rm5248
;
 
 
#define GPIO 0
#include "p16F690.inc"
 
; CONFIG
; __config 0xFFFC
__CONFIG _FOSC_INTRCIO & _WDTE_ON & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_ON & _IESO_ON & _FCMEN_ON
 
cblock 0x20
GPR0
GPR1
GPR2
GPR3
GPR4
GPR5
GPR6
GPR7
GPR8
GPR9
GPR10
GPR11
GPR12
GPR13
GPR14
GPR15
endc
 
 
 
; GPR10-GPR15 act as a poor man's counter, if they all overflow X number of seconds have passed,
; so turn on the turn signal.
 
; START
 
ORG 0x00
 
movlw b'11111100' ; GP3/GP2 = input, GP1/GP0 = output
//tris GPIO ; load GPIO TRIS register with the above values
 
; clear our counters
clrf GPR15
clrf GPR14
clrf GPR13
clrf GPR12
clrf GPR11
clrf GPR10
 
; okay, now that we have our inputs/outputs done correctly,
; let's go and read the pins
mainloop:
 
; clear our data
clrf GPR0
clrf GPR1
 
movf GPIO, 1 ; get input, put in wreg
movwf GPR0 ; put input in GPR0
 
btfsc GPR0, 3 ; check to see if we have a brake light(GPIO3)
bsf GPR1, 0 ; if we're here, the brake light is set, so set that flag
btfsc GPR0, 2 ; check to see if we have a turn signal
bsf GPR1, 1 ; if we're here, the turn signal is running, so set that flag
 
 
; if( turnSignal == on ){
; turn_signal_output = on;
; } else if( turnSignal == off ){
; if( no_turn_signal_in_past_2_seconds ){
; bake_output = on;
; }else{
; turn_signal_output = on;
; }
; }
btfsc GPR0, 2 ; Check to see if we have a turn signal
goto turn_signal ; nope, turn the turn signal on
 
; if we're here, the turn signal must be off
call increment_counter
; wreg is 1 if we should turn the brake input on,
; else 0
movwf GPR2
btfsc GPR2, 0 ; test to see if we should turn the turn signal on
goto turn_signal ; yes, we should turn the turn signal on
 
call brakes_on ; turn the brakes on
goto mainloop ; all done with the loop, start again. should only get here if brakes on
 
turn_signal:
call turn_signal_on
goto mainloop ;continue on the main loop
 
turn_signal_on:
bsf GPIO, 0 ; GPIO0 = turn signals
retlw 0
 
brakes_on:
bsf GPIO, 1 ; GPIO1 = brake
retlw 0
 
increment_counter:
movlw 1 ; wreg = 1
addwf GPR15, GPR15 ; add 1 to GPR15
btfsc STATUS, 0 ; check the status register, did we overflow?
goto add_to_GPR14 ; if we're here, we overflowed
retlw 0 ; we have not timed out
 
add_to_GPR14:
movlw 1
addwf GPR14, GPR14
btfsc STATUS, 0
goto add_to_GPR13
retlw 0
 
add_to_GPR13:
movlw 1
addwf GPR13, GPR13
btfsc STATUS, 0
goto add_to_GPR12
retlw 0
 
add_to_GPR12:
movlw 1
addwf GPR12, GPR12
btfsc STATUS, 0
goto add_to_GPR11
retlw 0
 
add_to_GPR11:
movlw 1
addwf GPR11, GPR11
btfsc STATUS, 0
goto add_to_GPR10
retlw 0
 
add_to_GPR10:
movlw 1
addwf GPR10, GPR10
btfsc STATUS, 0
nop
retlw 1
 
END
/trunk/TurnSignal/nbproject/project.properties
--- TurnSignal/nbproject/project.xml (nonexistent)
+++ TurnSignal/nbproject/project.xml (revision 73)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>com.microchip.mplab.nbide.embedded.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>TurnSignal</name>
+ <creation-uuid>0c375946-1629-4c17-b692-75200da850ee</creation-uuid>
+ <make-project-type>0</make-project-type>
+ <c-extensions/>
+ <cpp-extensions/>
+ <header-extensions/>
+ <sourceEncoding>ISO-8859-1</sourceEncoding>
+ <make-dep-projects/>
+ </data>
+ </configuration>
+</project>
/trunk/TurnSignal/nbproject/configurations.xml
0,0 → 1,65
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="62">
<logicalFolder name="root" displayName="root" projectFiles="true">
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
projectFiles="true">
</logicalFolder>
<logicalFolder name="SourceFiles"
displayName="Source Files"
projectFiles="true">
<itemPath>main.asm</itemPath>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false">
<itemPath>Makefile</itemPath>
</logicalFolder>
</logicalFolder>
<projectmakefile>Makefile</projectmakefile>
<confs>
<conf name="default" type="2">
<toolsSet>
<developmentServer>localhost</developmentServer>
<targetDevice>PIC16F690</targetDevice>
<targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard>
<platformTool>PICkit2PlatformTool</platformTool>
<languageToolchain>MPASMWIN</languageToolchain>
<languageToolchainVersion>5.49</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<compileType>
<linkerTool>
<linkerLibItems>
</linkerLibItems>
</linkerTool>
<loading>
<useAlternateLoadableFile>false</useAlternateLoadableFile>
<alternateLoadableFile></alternateLoadableFile>
</loading>
</compileType>
<makeCustomizationType>
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
<makeCustomizationPreStep></makeCustomizationPreStep>
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
<makeCustomizationPostStep></makeCustomizationPostStep>
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>
</makeCustomizationType>
<MPASMWIN-AS>
</MPASMWIN-AS>
<MPASMWIN-LD>
</MPASMWIN-LD>
<PICkit2PlatformTool>
</PICkit2PlatformTool>
<mpasmsuite>
</mpasmsuite>
</conf>
</confs>
</configurationDescriptor>
/trunk/TurnSignal/Makefile
0,0 → 1,108
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL
 
 
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
 
 
# build
build: .build-post
 
.build-pre:
# Add your pre 'build' code here...
 
.build-post: .build-impl
# Add your post 'build' code here...
 
 
# clean
clean: .clean-post
 
.clean-pre:
# Add your pre 'clean' code here...
 
.clean-post: .clean-impl
# Add your post 'clean' code here...
 
 
# clobber
clobber: .clobber-post
 
.clobber-pre:
# Add your pre 'clobber' code here...
 
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
 
 
# all
all: .all-post
 
.all-pre:
# Add your pre 'all' code here...
 
.all-post: .all-impl
# Add your post 'all' code here...
 
 
# help
help: .help-post
 
.help-pre:
# Add your pre 'help' code here...
 
.help-post: .help-impl
# Add your post 'help' code here...
 
 
 
# include project implementation makefile
include nbproject/Makefile-impl.mk
 
# include project make variables
include nbproject/Makefile-variables.mk