Hmm, low complexity. If you knew anything about modern microcontrollers
they pretty much pack everything you could ask for inside the silicon.
Once what was a jumble of glue logic and such is now self contained.
From RAM, FLASH, EEPROM, output drivers, A/D converters, USARTS,
Oscillators are now all contained in a tiny chip that sells for only a
few dollars. That easy to build Firefly & PIC16F88 has more processing
power than those old home computers from the 70s. When combined with
the ICD2 (Inchworm) you could do thousands of projects on the board,
and countless more with the expansion connectors.
Here's a simple program that runs on Firefly and PIC16F88, to a
beginner it might appear complex, but with a debugger it's easy to
understand.
;Blinky VR1 requires the use of VR1 (DIP switch VR1 = ON)
LIST p=16F88
INCLUDE "p16f88.inc"
ERRORLEVEL 0, -302
__CONFIG _CONFIG1, 0x2F30
__CONFIG _CONFIG2, 0x3FFC
movlf macro x,y ;MACRO movlf <literal>,
<register>
movlw x ;W = literal
banksel y ;make sure it's in the right
bank
movwf y ;register = W
endm
cblock 0x20 ;start of general purpose
registers
Delay_Count ;delay loop counter
endc
org 0x000 ;this is where the program
starts running
Init movlf 0x07, CMCON ;turn comparators off (make it
like a 16F84)
movlf b'00000010', ANSEL ;select RA1/AN1 as analog
input
movlf b'11001101', ADCON0 ;AD enabled, RC clock, AN1
selected (VR1) & begin conversion
Red1 movlf b'01000000', PORTA ;LED1 RED
movlf b'10111110', TRISA
call Delay
Red2 movlf b'10000000', PORTA ;LED2 RED
movlf b'00111111', TRISA
call Delay
Red3 movlf b'00000001', PORTA ;LED3 RED
movlf b'01111110', TRISA
call Delay
Green3 movlf b'10000000', PORTA ;LED3 GREEN
movlf b'01111110', TRISA
call Delay
Green2 movlf b'01000000', PORTA ;LED2 GREEN
movlf b'00111111', TRISA
call Delay
Green1 movlf b'00000001', PORTA ;LED1 GREEN
movlf b'10111110', TRISA
call Delay
goto Red1 ;repeat forever
Delay
bcf STATUS, RP0 ;bank 0
movf ADRESH, W ;W = VR1 value 0x00-0xFF
bsf ADCON0, GO ;start next conversion
movwf Delay_Count ;Delay_Count = W
btfsc STATUS, Z ;if ADRESH = 0 (Z flag is set)
return ;then return (no need to delay)
Loop
nop ;32KHz Clock (default internal
OSC speed) decfsz
Delay_Count, f
decfsz Delay_Count, f ;
goto Loop
return
END