'**************************************************************** '* knightrider * '* * '* Auteur : Stijn Coenen [Stynus] * '* Notice : Copyright (c) 2008 Stijn Coenen * '* : All Rights Reserved * '* Datum : 29/05/2008 * '* Version : 1.0 * '* Website : www.elektronicastynus.be * '**************************************************************** 'Config Device 16F628A Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_OFF ALL_DIGITAL TRUE ;Alle ingangen digitaal '**************************************************************** 'Ingangen declareren Symbol switch = PORTA Symbol sw1 = PORTA.7 Symbol sw2 = PORTA.6 Symbol sw3 = PORTA.5 Symbol sw4 = PORTA.4 Symbol sw5 = PORTA.3 Symbol sw6 = PORTA.2 Symbol sw7 = PORTA.1 Symbol sw8 = PORTA.0 'TrisA register instellen (alles ingang) TRISA = 255 '**************************************************************** 'Uitgangen declareren Symbol ledjes = PORTB Symbol led1 = PORTB.7 Symbol led2 = PORTB.6 Symbol led3 = PORTB.5 Symbol led4 = PORTB.4 Symbol led5 = PORTB.3 Symbol led6 = PORTB.2 Symbol led7 = PORTB.1 Symbol led8 = PORTB.0 'TrisB register instellen (alles uitgang) TRISB = 0 '**************************************************************** 'Decraraties voor programma: Symbol LedTijd = 70 'doorschuif snelheid LED Dim index As Byte ledjes = %10000000 '1 led aanzetten '**************************************************************** 'Hoofdprogramma While 1 = 1 'Oneindige loop 'Links schuiven For index = 0 To 6 'Uitvoren tot dat index 6 is ledjes = ledjes >> 1 'Ledjes naar rechts doorschuiven DelayMS LedTijd 'Wachten Next 'Rechts schuiven For index = 0 To 6 'Uitvoren tot dat index 6 is ledjes = ledjes << 1 'Ledjes naar links doorschuiven DelayMS LedTijd 'Wachten Next Wend '**************************************************************** End
Dit programma is getest op mijn PIC ontwikkelbordje.