Couple days ago I ordered basic programming tool and ten Pic 16F616 controllers. Pictured here is the first test circuit running short program I made earlier today. Here Pickit2 is used as programming device and also it provided the power for running the test circuit. LED with current limiting resistor is connected from RC0 (Pin10) to ground, and the one small capacitor is located between 16F616:s ground (Pin 14) and operating voltage (Pin1) for filtering the power fluctuations at the circuit.
Prototype board with Pic 16F616 connected to Pickit2 programmer |
Making assembler code for these cheap-class (about one Euro, in small numbers) controllers is a bit like driving a bike, you have learned it once and you'll have the skill rest of your life. Of course it can take few hours to get all necessary manuals and data sheets, and some time will be spend on software and tools playing nicely together.
My bit kludgish asm-source follows, in case anyone is interested. :-)
; Not so nice example.
; PortC pins:
; RC:0 = digital out, led active high
#include p16f616.inc
__config _INTOSCIO & _WDT_OFF ; 8 Mhz int-osc with IO:s
; Start from reset vector
org 0x00 ; obvious, but just in case.
goto Main ; Skip over interrupt vector
org 0x20 ; main program
Main
BCF STATUS,RP0 ;Bank 0
CLRF PORTC ;Init PORTC
BSF STATUS,RP0 ;Bank 1
CLRF ANSEL ;digital I/O (disable Analog Inputs)
MOVLW 0xFE ;Set RC<5:1> as input
MOVWF TRISC ;and set RC<0> as outputs
BCF STATUS,RP0 ;Bank 0
Loop
incf PORTC,F ;Read PORTC, add 1 and save back
goto Loop ;Like forever
end ;All things must end someday
(*) PS: As a footnote I'll want to show you one thingy I designed couple days ago. It's a kitchen towel hook, made to fit at two centimeter thick cabinet doors. Drawings and prints are available at request.
No comments:
Post a Comment