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>


Note: LED's go to VDD


Bookmarks