Stap 4: Programmeren met behulp van H1 ICSP poort picLink
Zoeken versie firmware in URFC.zip pakket opgenomen pakket unzip en situeren URFC.hex vijl.
het URFC.hex-bestand bevindt in de map van de Release van de ingebouwde programmatuur te bouwen. Als een moet veranderen van de software die u moet installeren van Eclipse SDCC (CDT) compiler plugin versie 1.0.0 als goed asGNU Win32 bestand kern, bestandsserver utils en GPLINK. Dit kan worden gedaan op Linux, XP en Vista en ik adviseer gebruikend de Eclipse-platform versie: 3.4.0 (Ganymedes) en de C/C++-CDT. Ik heb ook de SDCC-projectbestanden die eenvoudig kunnen worden geïmporteerd in een bestaande werkruimte.
SDCC GPUTILS kan worden gedownload van sourceforge en is royalty vrije en gepubliceerd onder de GNU GPL. Alle C bronnen verstrekt werden gecompileerd met behulp van SDCC en omvat een master makefile die wordt verondersteld SDCC en GPUTILS beide zijn geïnstalleerd onder station C:\. Als dit niet het geval is zal u moeten edit de makefile (SDCCDIR en GPUTILSDIR) aan de juiste locaties van deze hulpmiddelen.
Video van hoe ik de picLink RS232-controller gebruiken voor het meten van de afstand met behulp van de Sonar
URF 1000 Sonar DSM Module en picLink
SDCC bouwen Makefile
###############################################################################
# Ingesloten Build Script voor gebruik met SDCC en GPUTILS
# voor PIC14 abd PIC16 reeksenapparaten
# Maak Project Hex en ASM bestanden van C-bronbestand
# DEP LIBS = crt0i.o libsdcc.lib pic$ (CPU) .lib
# CLI bouwen: sdcc--debug - mpic14-p16f84 source.c
# CLI compile: sdcc -V-mpic14-p16f84 - c source.c
#
# SDCC MAKEFILE voor PIC16 & PIC18 serie bouwt
# Project: PICLink lichtgewicht ingebed systeem (Rev 1.1) voor URFC (ultrasone Bereikindicatie Controller)
# Datum: 2 februari 2011
# Auth: TuxMicro Devices (C) 2010-2011
#----------------------------------------------------------------------------
# Vlaggen sdcc:
# - c: compileren alleen
# -S: stop na montage
# -V: Toon werkelijke opdrachtregel uitvoeren van de compiler
#--verbose: toont de verschillendeacties is het uitvoeren van de compiler
#
# Vlaggen voor gplink:
# - c:-m: -w: - r:-ik dir: -s bestand: het linker bestand
#----------------------------------------------------------------------------
#
# De omgevingsinstellingen
#
# SDCC_HOME
# SDCC_INCLUDE
# SDCC_LIB
# GPUTILS_HEADER_PATH
# GPUTILS_LKR_PATH
# GPUTILS_LIB_PATH
#
# Genereert project hexadecimaal bestand
#
# Tools
RM: rm -f =
MV: = mv -f
#
#PROJECT
PRJ = urfc
DOELSTELLING = $(PRJ) hexadecimaal
# CPU Target opties
ARCH = pic14
CPU = 16f628a
# GPUTILS bouwen milieu
SDCCDIR: = c:\sdcc
GPUTILSDIR: = c:\gputils
GPASM: = $(GPUTILSDIR) \bin\gpasm
GPLINK: = $(GPUTILSDIR) \bin\gplink
SDCC: = $(SDCCDIR) \bin\sdcc
GPUTILS_HEADER_PATH: = $(GPUTILSDIR) \header
GPUTILS_LKR_PATH: = $(GPUTILSDIR) \lkr
LIBDIR: = $(SDCCDIR) \lib\pic
# Hex uitvoerbestandsindeling (inhx8m, inhx8s, inhx16, inhx32)
LINKFMT = inhx8m
LINKOPTS =--hex-formaat $(LINKFMT) -m
#SDCC vlaggen
CC: = $(SDCC)
# GPASM vlaggen
GPASM_FLAGS =
#SDCC debug
#SDCC_FLAGS = -S-m$(ARCH)-p$(CPU)--debug -c
#SDCC compileren
SDCC_FLAGS = -S-m$(ARCH)-p$(CPU) - c
# Linker opties
GPLINK_FLAGS - c -m -w - r =-ik $(LIBDIR) -s $(GPUTILSDIR) \lkr\$ (CPU) .lkr
# C bronnen
SRCS_C: = urfc.c RS232Serial.c
OBJS_C: = $(SRCS_C:.c=.o)
OBJS_ASM = $(SRCS_ASM:.asm=.o)
OBJS = $(OBJS_C) $(OBJS_ASM)
# Afhankelijkheden Libs
LIBS: = libsdcc.lib pic$ (CPU) .lib
# Alle Target
alle: $(TARGET)
# Bouwen Tool evocaties
$(TARGET): $(OBJS)
' Gebouw doel: $
' Inroepen: SDCC Linker'
$(GPLINK) $(GPLINK_FLAGS) $(LINKOPTS) -o $(TARGET) $(OBJS) $(LIBS)
' Afgewerkt gebouw doel: $
' '
'Het vrijgeven van bestanden'
-$(MV) $(PRJ) .cod. / Release
-$(MV) $(PRJ) .cof. / Release
-$(MV) $(PRJ) .hex. / Release
-$(MV) $(PRJ) .lst. / Release
-$(MV) $(PRJ) .map. / Release
%.o: %.c
' Gebouw bestand: $< '
' Inroepen: SDCC Compiler'
$(CC) $(SDCC_FLAGS) $<
' Inroepen: GPASM'
$(GPASM) $(GPASM_FLAGS) - c $*.asm
' Gebouw klaar: $< '
' '
##############################################################################
# standalone asm bestanden in object bestand te compileren indien nodig
#
%.o: %.asm
$(GPASM) $(GPASM_FLAGS) - c $<
# Andere doelen
schoon:
-$(RM) *.o
-$(RM) *.asm
-$(RM) *.lst
-$(RM) *.sym
-$(RM) *.map
-$(RM) *.cof
-$(RM) *.cod
-$(RM) *.hex
-$(RM) release/*.map
-$(RM) release/*.cof
-$(RM) release/*.cod
-$(RM) release/*.lst
-$(RM) release/*.hex
"---Projectmap gereinigd."
. NEP: alle schone doelcellen
. SECUNDAIR:
-opnemen... /Makefile.targets
URFC. HEX (inhx8m)
: 1000000000007C2B00340034F200030E8301F10069
: 100010000A088A01F000040883120313C200831245
: 1000200003138B128C1E15282421831203138B1C9F
: 100030001A28A221831203130C1F1F28CA2183121E
: 1000400003130B1D2428CE21831203130C1C292813
: 10005000D221831203138C1C2E28DA21831203135E
: 100060008B16831203134208840070088A008301F0
: 10007000710E8300F20E720E0900B02083228312EB
: 100080000313B70183120313201C4928831203139F
: 10009000B70A831203133708003003190130B80080
: 1000A000B70183120313061C582883120313B70ADF
: 1000B000831203133708003003190130B900B80563
: 1000C0003808031DCF2083120313B70183120313D3
: 1000D000201C6D2883120313B70A83120313B8017F
: 1000E00083120313A01C772883120313B80A831208
: 1000F00003133808B900B705370803193F288312DE
: 10010000031306183F281010213083120313B70081
: 10011000B801B901831203130F08FD008312031302
: 100120003708FE000030FF00003023242230831205
: 100130000313B700B801B901831203130E08FD00C1
: 10014000831203133708FE000030FF000030232421
: 10015000831203132010A0100D30E9203F2808005F
: 100160004430831603138100E030831203138B00A5
: 100170000730831603138500C 33086008112811176
: 10018000831203139001831603130C1483120313B9
: 100190008F018E01A001A101A20186150800FC308B
: 1001A0008312031381000B118B12831203130B199B
: 1001B000DC2886112014D528831203130B118B160B
: 1001C0008615201CE8288F018E010C1010140B16C8
: 1001D000080083120313B40083120313010883126F
: 1001E0000313B500831203138B120B11003083121B
: 1001F000031334040319FF280130B60002298312C7
: 100200000313B601003083120313360403191929AE
: 1002100064308312031381006430831203130102DC
: 10022000031C1529013075220C2983120313B40312
: 10023000F628831203130B1183120313350883125C
: 10024000031381008B160800831203130B13043071
: 1002500083120313B200F630B1008030B3003108CE
: 10026000FE003208FF0033082322043083120313F8
: 10027000B2007130B1008030B3003108FE003208A6
: 10028000FF0033082322043083120313B2005030DE
: 10029000B1008030B3003108FE003208FF0033089F
: 1002A0002322043083120313B200AD30B10080303A
: 1002B000B3003108FE003208FF0033082322043067
: 1002C00083120313B200F630B1008030B30031085E
: 1002D000FE003208FF003308232204308312031388
: 1002E000B200E330B1008030B3003108FE003208C4
: 1002F000FF00330823220230FD002130FE000030D1
: 10030000FF000030A52283120313B3007F08B20060
: 100310007E08B100FE003208FF00330823220430BB
: 1003200083120313B200F630B1008030B3003108FD
: 10033000FE003208FF0033082322502283120313E9
: 100340000B170800831203138B1083120313AF01E2
: 1003500083120313201CAF2983120313AF0A8312E5
: 100360000313B00183120313061CB929831203136C
: 10037000B00A831203133008AF052F080319C929E7
: 100380008312031310108F018E010C100B12A01496
: 1003900010140800831203130C13080083120313B4
: 1003A0000B110800831203130C1010100B122010F5
: 1003B000A0100800831203138C1008000130831270
: 1003C0000317CB002030CA00CC01831203138C1A10
: 1003D000EB295A307522831203138C1E222A8316AE
: 1003E00003138C12103083120317CD0083120317EE
: 1003F0004D08803E7F3E031C1F2A502283120317A4
: 10040000CE00FD004A08FE004B08FF004C082324E4
: 10041000831203174E080D3A03191F2A4A08FE00DB
: 100420004B08FF004C08102483120317CE004E081F
: 1004300003191F2ACA0A0319CB0ACD03F62983160A
: 1004400003138C16080083120317C8007F08C70027
: 100450007E08C600831203174608FE004708FF0007
: 100460004808102483120317C900490803194F2AAA
: 1004700049086422831203174608FE004708FF005C
: 100480004808102483120317C9000D3A03194F2A94
: 10049000490803194F2AC60A0319C70A2A2A08005D
: 1004A00083120317C501831203138C1E5B2A1A08DB
: 1004B00083120317C50083120313981C602A6E224F
: 1004C000831203174508080083120313990083164B
: 1004D000031398186D2A5A307522080083120313EB
: 1004E000981C742A18121816080083120317C500E6
: 1004F0000A30FF004508902483120317AF00000064
: 10050000AF0B7F2A080083160313861406150A30E2
: 1005100099000430980080308312031398008316EA
: 1005200003138C16831203131816831603130C126D
: 10053000981298161030FD00831203133F08FE0036
: 100540004008FF0041085423080083120317BB0032
: 100550007F08BA007E08B9007D08BC00BD011030DC
: 10056000FD00831203133F08FE004008FF0041080E
: 1005700054231030831203173C02BE01031C3E14A7
: 10058000BF01831203173C083F0203184C2B3E089F
: 1005900003194C2B3908FE003A08FF003B081024D1
: 1005A00083120317C000400E0F39C1001030FF0046
: 1005B0004108902483120317C200C0020A3041028E
: 1005C0000318F62A3D08C200BD0A4208203EC200B8
: 1005D00001300318013EC30030304107C400420817
: 1005E0008400831343188317440880000A30831261
: 1005F00003174102031C0F2B3D08C200BD0A42082D
: 10060000203EC20001300318013EC3003730C1074D
: 1006100042088400831343188317410880000A307E
: 10062000831203174002C101031C411403182C2B31
: 100630003D08C200BD0A4208203EC2000130031836
: 10064000013EC30030304007C400420884008313D9
: 1006500043188317440880000030831203174104B5
: 10066000031D452B3D08C100BD0A4108203EC100C5
: 1006700001300318013EC2003730C0074108840032
: 100680008313421883174008800083120317B90AA6
: 100690000319BA0ABF0AC12A831203133F08FE00D6
: 1006A0004008FF004108080083120317B3007F08C9
: 1006B000B2007E08B1007D08B400B50183120317B3
: 1006C0003408350203187B2B35083107B600320891
: 1006D0000318013EB70033080318013EB80000308C
: 1006E000FD003608FE003708FF0038082324831277
: 1006F0000317B50A5E2B0800C930FE000430FF0066
: 100700008030000000002F2400000000831203133B
: 10071000A4007F08A300CB30A5000430A6008312FC
: 1007200003132308A7002408A800FF30A307031C15
: 10073000A4032708280403190C2C04302507A7005C
: 10074000A801A80D2608A8072708FE002808FF0012
: 100750008030000000002F240000000083120313EB
: 10076000AA007F08A9002508FE002608FF008030A7
: 10077000000000002F240000000083120313AC00CF
: 10078000A8007F08AB00A70002302507A700A8013A
: 10079000A80D2608A8072708FE002808FF008030BB
: 1007A000000000002F240000000083120313A800A3
: 1007B000AE007F08A700AD00831203132908AD0027
: 1007C0002A08AE00FF30A907031CAA032D082E0437
: 1007D0000319052C2B08FE002C08FF0080300000B8
: 1007E000000010240000000083120313AD0027084E
: 1007F00084008313281883172D088000AB0A03197F
: 10080000AC0AA70A0319A80ADC2B063083120313CB
: 10081000A5070318A60A8F2B000000003D2808003A
: 10082000003A0319172C803A03191E2C00347E0855
: 10083000840083137F188317000808007F088A004C
: 100840007E0882000800003A0319272C08007E0861
: 10085000840083137F1883177D0880000800003A06
: 100860000319372C803A0319412CFF0100347E080C
: 10087000840083137F1883170008FF00840A000890
: 100880000800000000001E24FD00FE0FFF03FF0A09
: 10089000000000001E24FC007D08FF007C0808000A
: 1008A0005434753478344D346934633472346F346D
: 1008B00020344434653476346934633465347334B5
: 1008C 0002034283443342934203432343034313421
: 1008D00030342D3432343034313431340A340D3440
: 1008E000003455346C3474347234613473346F347E
: 1008F0006E34693463342034523461346E34673476
: 1009000065342034463469346E346434653472346A
: 10091000203455345234463443340A340D340034D0
: 1009200083120313BA007F08BB00BC010830BD006E
: 10093000831203133A1C9E2C3B08BC07831203133B
: 100940003A08BE0003103E0CBA0003103B0DBE0077
: 10095000BB00BD0B982C3C08080046346934723447
: 100960006D347734613472346534203456346534F0
: 100970007234733469346F346E343A3420344C3406
: 1009800045345334203431342E3431340A340D3468
: 10099000003404340034023400342134003402348E
: 1009A0000034FC3404342F34013401340034F9347D
: 1009B00004343F34003403340034FD34043443340D
: 1009C00000340134003409345434313449344E3461
: 1009D0002034443469347334743461346E34633491
: 1009E00065343A3420343034783400340A340D34E9
: 0C09F000003420340134003400340034A2
: 02400E00223F4F
: 00000001FF