Wednesday, 22 January 2014

Slenduino Tutorial 02 [The Larson Scanner]


C/D tutorial number 2, the Larson Scanner with some simple lines of code.

Some people may have known already about the Larson Scanner for other microcontroller platforms, we would like to take advantage to increase the knowledge with an important register in our Slenduino, that's GPIO.

The GPIO register controls all configuration pins in our board; there is more than one way to set it, lots users use to write a specific sector by initializing:
GPIO.x = xxx
But it's possible to write into it directly as shown by our little quick walkthrough.

Right after, we report the schematic of Larson Scanner, it's easly to see the difference from it and the schematic into video.


Don't worry, we use to connect the Slenduino to a 3.3 voltage regulator only for our personal confort, but the basics are the same. Now the code:
;Chip Settings
#chip 12F683,8
#config OSC=INTRC_OSC_NOCLKOUT

;Variables
Dim out As byte

out = b'00000001'

start:
ShiftLeft
back:
ShiftRight
Goto start

Sub Write
    GPIO = out
    If out <> b'00001000' Then
        Wait 80 ms
    End If
End Sub

Sub ShiftLeft
    Write
    out = out*2
    If out <> b'00100000' Then
        Goto start
    End If
End Sub

Sub ShiftRight
    Write
    out = out/2
    If out <> b'00000001' Then
        Goto back
    End If
End Sub
Follow the video of tutorial, keep you in touch for some updates. Have fun!


No comments:

Post a Comment

Hi at all, leave me a feedback for this post. Thx