Oh Yeah! Very nice Bruce.
Now that's going to be hard to beat.
If you don't hear from me for a month.
You'll know what happened.![]()
Oh Yeah! Very nice Bruce.
Now that's going to be hard to beat.
If you don't hear from me for a month.
You'll know what happened.![]()
DT
I just checked on my '628A on my breadboard...about a ba-zillion times...
I set up code/hardware to do nothing but RESET, and put Port B onto a bank of LEDs, Vdd on the other side of the LED.
EACH time, Port B came up ZERO...no LEDs lit up, until I set a TRIS bit for output.
So, my submission...
Coming in at 12 bytes...
Code:list p=16F628A #include "P16F628A.inc" errorlevel -302 __CONFIG _CP_OFF & _BODEN_ON & _MCLRE_OFF & _WDT_ON & _PWRTE_ON & _LVP_OFF & _INTOSC_OSC_NOCLKOUT ; clrf PORTB ; clear port - not required on my breadboard, might be different on others bsf STATUS,RP0 ; Bank 1 bcf TRISB,0 ; RB0 = output bcf OPTION_REG,0 ; 1:64 prescaler to WDT Left sleep ; go to sleep for 64 * 18mS ~1 second rlf TRISB,F ; rotate bit across portb from lsb to msb btfsc TRISB,7 goto Left Right sleep ; go to sleep for 64 * 18mS ~1 second rrf TRISB,F ; rotate bit across Portb from msb to lsb btfsc TRISB,0 goto Right goto Left ; now rotate back to the left. End
Somebody else check this out and see what happens.
As I stated, maybe it's my breadboard, maybe it's my 628A (I've only got 1 left), maybe it's the rise time on my PSU.
EDIT: Datasheet says that the port registers come up in an unknown state. Apparently, in this case, I now know my state...
Last edited by skimask; - 19th December 2007 at 21:23.
It might work on one series, but I wouldn't count on it as being reliable across the board.
I have seen various PICs come up with totally random values in port latches at POR, so
you really do need to clear portb latches first if it's to be reliable.
i'm thinking of something using interrupt.. not sure if it could reduce things to 8-10 words... mmm..
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I had considered that approach too, but more than half of your code space (or more) would
be eaten up with interrupt configuration setup.
Making it "reliable" with less than 13 words is going to be a real task.
yup, but where is it stated that it has to be reliable, where it is stated that we need to use the same PIC and hardware ?
i still believe it's doable... but with some hair lost![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I think that's a given. It has to work when you turn on the power.
As for the rest of the rules, well, I'm assuming No EEPROM is the only one. Edit: with a 16F628A
I'm starting to believe NO.i still believe it's doable... but with some hair lost![]()
But I haven't given up yet.
I've got 3 completely different versions at 13 words now.
1 using external circuitry to TMR0
1 using external circuitry to a comparator
and another that simply shaves a word off my 14 word program. (wish I'd done that to begin with)
It seems that no matter what you do to save a word, you end up having to add something to make it work.
I'm sure getting some "Quality Time" in with the datasheets though.All kinds of stuff I didn't know before.
<br>
Last edited by Darrel Taylor; - 21st December 2007 at 02:24. Reason: 628a
DT
Bookmarks