Any chance we can see that 12-byte cylon scanner?
Any chance we can see that 12-byte cylon scanner?
Sure,
The 12-byte version is toward the end on page 2.
http://www.sfcompiler.co.uk/forum/viewtopic.php?t=72
Edit: Hey, you were there to.
<br>
DT
Yipes I totally forgot that one. That was way interesting and the end result was really creative.
Nice work DT..;o}
Tim B and I got into one of these a long time back, and here's one he came up with.
Can we beat this without EEPROM?
Standard cyclone thingie moving the LED back & forth with ~1S delay periods.
Code:list p=16F628A #include "P16F628A.inc" errorlevel -302 ; suppress message 302 from list file __CONFIG _CP_OFF & _BODEN_ON & _MCLRE_ON & _WDT_ON & _PWRTE_ON & _LVP_OFF & _INTOSC_OSC_NOCLKOUT movlw 0x01 movwf PORTB ; Set Portb,0 bsf STATUS,RP0 ; Bank 1 clrf TRISB ; RB all outputs bcf OPTION_REG,0 ; 1:64 prescaler to WDT bcf STATUS,RP0 ; Bank 0 Left sleep ; go to sleep for 64 * 18mS ~1 second rlf PORTB,F ; rotate bit across portb from lsb to msb btfss PORTB,7 ; jump to Right after Portb,7 = 1 goto Left Right sleep ; go to sleep for 64 * 18mS ~1 second rrf PORTB,F ; rotate bit across Portb from msb to lsb btfss PORTB,0 ; jump back to left after Portb,0 = 1 goto Right ; loop until Portb,0 = 1 goto Left ; now rotate back to the left. End
seems to be hardly optimized to me
food for thought... let's see...
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Tim's compiled to 15 words.
Here's 13 ... Note: LED's go to VDD
EDIT: Rats!Code:list p=16F628A #include "P16F628A.inc" errorlevel -302 ; suppress message 302 from list file __CONFIG _CP_OFF & _BODEN_ON & _MCLRE_ON & _WDT_ON & _PWRTE_ON & _LVP_OFF & _INTOSC_OSC_NOCLKOUT clrf PORTB ; PORTB all 0's bsf STATUS,RP0 ; Bank 1 bcf OPTION_REG, 0 ; 1:64 prescaler to WDT bcf TRISB, 0 ; set RB0 to output bsf STATUS, C ; set carry flag for rotation Loop btfss TMR2, 3 ; switch Left/Right every 8 times rlf TRISB,F ; rotate Left across TRISB btfsc TMR2, 3 rrf TRISB,F ; rotate Right across TRISB btfsc STATUS, C ; No sleep if output rotated into carry sleep ; nite nite incf TMR2 ; Timer2 used for it's 00 value on reset. goto Loop ; Repeat
While it works in MPSIM, it's not going to do it on the real thing.
Time for a breadboard.
<br>
DT
OK, ignore the last one. That's what I get for using a simulator.
This is 14 WORDS, 1 less than Tim's.
At least it beats him
LED's go to VDD.Code:list p=16F88 #include "P16F88.inc" errorlevel -302 ; suppress message 302 from list file __CONFIG _CONFIG1, _XT_OSC & _CP_OFF & _BODEN_ON & _MCLR_ON & _WDT_ON & _PWRTE_ON & _LVP_OFF clrf PORTB ; PORTB all 0's bsf STATUS,RP0 ; Bank 1 bcf OPTION_REG, 0 ; 1:64 prescaler to WDT bcf TRISB, 0 ; RB0 output Loop sleep ; nite nite btfss SPBRG,0 ; SPBRG used for it's 00 reset value rlf TRISB,F ; rotate Left across TRISB btfsc SPBRG,0 rrf TRISB,F ; rotate Right across TRISB btfss TRISB, 7 ; At LED7? - go the other way incf SPBRG,F btfss TRISB, 0 ; At LED0? - go the other way incf SPBRG,F goto Loop ; Repeat
Tested, working on 16F88, should be the same (except configs) on 16F628A.
<br>
DT
yup.. hence why i never trust sim...
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks