Days???Really sorry for the late reply, has been one of those days today.
I have been having one of those weeks![]()
Days???Really sorry for the late reply, has been one of those days today.
I have been having one of those weeks![]()
Dave
Always wear safety glasses while programming.
Hi mackrackit,
Lol..... Nice to know I'm not alone, you do have my sympathy though.I have been having one of those weeks![]()
Here's what I thought was a silly question, now I'm not so sure it is:
When you declare a VAR WORD, I thought that the value would automatically be set at zero, now I'm not so sure it is. Do you have to have to re-set it to zero before you start a count program or is it zero already?
I know it's Friday tomorrow but I hope your week gets better.
Dave
Sometimes it will be zero at power up but you never know.
You can use CLEAR, in the manual
or
VAR_IN_QUESTION = 0
Not a stupid question at all![]()
Dave
Always wear safety glasses while programming.
Cheers mackrackit, I'm feeling better already I hope you are too!Not a stupid question at all![]()
So probably good practice to set VAR_IN_QUESTION = 0 just in case.
Hopefully I'll have moved the program on tomorrow, fingers x'd.
Right, time for me bed.
See you tomorrow.
Dave
Hint
COUNT is for pulses in a time period.
Maybe
if switch goes high
then
var = var + 1
Dave
Always wear safety glasses while programming.
Hi mackrackit,
Question: How long does it take LEDave to wire a push_button_switch to a PIC16F684?
Answer: About 48hrs
I think the program below should work ok:
LEDave current status: Eyes going, mind boarderline!Code:Total var word clear MAIN: if PORTA.5 = 0 then count_up: IF PORTA.5 = 1 THEN MAIN: Count_up: let Total = Total + 1 pauseus 25 LCDOUT $FE,1 LCDOUT $FE,$C0,DEC Total PAUSE 500 GOTO MAIN:
Dvae
So the next thing it to WRITE 'Total' to EEPROM address, then READ that value and put it back into 'Total'.
The theory is that when the PIC power supply is turned off then restarted last 'Total' reappears on the LCD.
Dave
Yup, that is the mission![]()
Dave
Always wear safety glasses while programming.
From the manual:
So looking at the 16F684.PDF it says:Code:WRITE Address,Value
So would:The PIC16F684 has 256 bytes of data EEPROM
with an address range from 0h to FFh.work? Not quite as simple as that he says! For one thing these are EEPROM BYTES and 'Total' is a WORD two BYTES for a starter.Code:WRITE 0h,Total
Dvae
Bookmarks