Hi guys
I am attempting to learn assembly and program a switched timer for a fishing torpedo.
I am using MPLAB IDE v8.56 to write the assembly code and debug it
I have read the datasheet, although it hasn't all sunk in and gone through several of the tutorials available on the net but I need some examples or someone to steer me in the right direction please.
This is not homework, it is a hobby project I am building at home.
My circuit works like this
I have a 12v battery attached to GP4 via a 7805 and a resistor divider to reduce the voltage below 5v for the pic to read the voltage
I have one reed switch on GP2 as the circuit will be activated by a magnet from outside the body of the torpedo as it is fully contained and waterproofed.
I have 1 led and resistor. on GP0
I also have a mosfet grounded on GP1 and switched by GP5
The timer will work like this
psuedo code
is switch open on powering unit
if yes light led steady for 1 second then flash to indicate low voltage cutoff setting
if low voltage setting done save to EEPROM
is switch not open on powering unit
if not then blink led up to 6 times to indicate setting of motor timer. ie 5 blinks equals 5x5 minutes or25 minutes
then light led steady to indicate ready to run
when switch next opened start 1 minute timer to allow time to get the torpedo in the water then start saved motor timer and activate mosfet to switch on motor
when set motor timer elapses or low voltage cutoff setting reached stop motor
if switch held open for longer than 10 seconds after timer indication then power off circuit
I intend to write all the code and debug it to the best of my ability but will need some help(other than saying look in the data sheet) in order to correct anything I haven't quite worked out
The order I will write the program I think would be in this order
1. Implement the interrupt on change features of the chip so the chip can be put into low power sleep mode and also power on when the switch is activated
2. Write the code for the adc feature so I can read the lvc(low voltage cutoff) setting and store it in EEPROM
3. Write the subroutine for the 5 minute delay and how to store that in EEPROM
4. Write the code with all the timers etc to blink, light and flash the led and activate the motor.
Does anyone have any suggestions for me on a better way to do things or a better order to write it?
Thanks for reading this
Steve
I am attempting to learn assembly and program a switched timer for a fishing torpedo.
I am using MPLAB IDE v8.56 to write the assembly code and debug it
I have read the datasheet, although it hasn't all sunk in and gone through several of the tutorials available on the net but I need some examples or someone to steer me in the right direction please.
This is not homework, it is a hobby project I am building at home.
My circuit works like this
I have a 12v battery attached to GP4 via a 7805 and a resistor divider to reduce the voltage below 5v for the pic to read the voltage
I have one reed switch on GP2 as the circuit will be activated by a magnet from outside the body of the torpedo as it is fully contained and waterproofed.
I have 1 led and resistor. on GP0
I also have a mosfet grounded on GP1 and switched by GP5
The timer will work like this
psuedo code
is switch open on powering unit
if yes light led steady for 1 second then flash to indicate low voltage cutoff setting
if low voltage setting done save to EEPROM
is switch not open on powering unit
if not then blink led up to 6 times to indicate setting of motor timer. ie 5 blinks equals 5x5 minutes or25 minutes
then light led steady to indicate ready to run
when switch next opened start 1 minute timer to allow time to get the torpedo in the water then start saved motor timer and activate mosfet to switch on motor
when set motor timer elapses or low voltage cutoff setting reached stop motor
if switch held open for longer than 10 seconds after timer indication then power off circuit
I intend to write all the code and debug it to the best of my ability but will need some help(other than saying look in the data sheet) in order to correct anything I haven't quite worked out
The order I will write the program I think would be in this order
1. Implement the interrupt on change features of the chip so the chip can be put into low power sleep mode and also power on when the switch is activated
2. Write the code for the adc feature so I can read the lvc(low voltage cutoff) setting and store it in EEPROM
3. Write the subroutine for the 5 minute delay and how to store that in EEPROM
4. Write the code with all the timers etc to blink, light and flash the led and activate the motor.
Does anyone have any suggestions for me on a better way to do things or a better order to write it?
Thanks for reading this
Steve