mr|repel Geplaatst: 9 januari 2008 Geplaatst: 9 januari 2008 Hoi allemaal, ik ben eens begonnen met een PIC programmeren maar ik loop tegen het volgende probleem op, als ik de HEX rechtstreeks programmeer dan werkt het, maar ik wil de HEX aanpassen zodat het looplichtje anders loopt. De source is in asm, maar als ik deze omzet krijg ik errors. Hieronder zie je de ASM code : Code: ;********************************************************;; The LED flash control processing;; Author : Seiichi Inoue;******************************************************** list p=pic16f84a include p16f84a.inc __config _hs_osc & _wdt_off & _pwrte_on & _cp_off errorlevel -302 ;Eliminate bank warning;**************** Label Definition ********************ra0 equ 00 ;RA0 bitra1 equ 01 ;RA1 bitra2 equ 02 ;RA2 bitra3 equ 03 ;RA3 bitra4 equ 04 ;RA4 bitcnt500u equ 0c ;500usec counter Addresscnt1m equ 0d ;1msec counter Addresscnt100m equ 0e ;100msec counter Addresscnt500m equ 0f ;500msec counter Addresscnt1s equ 10 ;1sec counter Address;************* Pattern Data Definition ****************; '1':OFF '0':ON;****** Pattern 0 ******p00 equ b'11111110'p01 equ b'11111101'p02 equ b'11111011'p03 equ b'11110111'p04 equ b'11101111'p05 equ b'11011111'p06 equ b'10111111'p07 equ b'01111111';****** Pattern 1 ******p10 equ b'01111111'p11 equ b'10111111'p12 equ b'11011111'p13 equ b'11101111'p14 equ b'11110111'p15 equ b'11111011'p16 equ b'11111101'p17 equ b'11111110';****** Pattern 2 ******p20 equ b'01111110'p21 equ b'10111101'p22 equ b'11011011'p23 equ b'11100111'p24 equ b'11011011'p25 equ b'10111101'p26 equ b'01111110';****** Pattern 3 ******p30 equ b'11111110'p31 equ b'11111101'p32 equ b'11111010'p33 equ b'11110101'p34 equ b'11101010'p35 equ b'11010101'p36 equ b'10101010'p37 equ b'01010101'p38 equ b'10101011'p39 equ b'01010111'p3a equ b'10101111'p3b equ b'01011111'p3c equ b'10111111'p3d equ b'01111111';****** Pattern 4 ******p40 equ b'00000000'p41 equ b'11111111'p42 equ b'00000000'p43 equ b'11111111'p44 equ b'00000000'p45 equ b'11111111'p46 equ b'00000000'p47 equ b'11111111'p48 equ b'00000000';**************** Program Start *********************** org 0 ;Reset Vector goto init org 4 ;Interrupt Vector goto init;**************** Initial Process ********************* org 5init bsf status,rp0 ;Change to Bank1 movlw h'ff' ;Set input mode data movwf trisa ;Set PORTA to Input mode clrf trisb ;Set PORTB to Output mode bcf status,rp0 ;Change to Bank0 movlw h'ff' ;Set LED off data movwf portb ;Output data;**************** Key Scan Process ********************keyscan btfss porta,ra0 ;RA0 ON(Low lebel) ? call ptn0 ;Yes. Call Pattern 0 btfss porta,ra1 ;RA1 ON ? call ptn1 ;Yes. Call Pattern 1 btfss porta,ra2 ;RA2 ON ? call ptn2 ;Yes. Call Pattern 2 btfss porta,ra3 ;RA3 ON ? call ptn3 ;Yes. Call Pattern 3 btfss porta,ra4 ;RA4 ON ? call ptn4 ;Yes. Call Pattern 4 goto keyscan ;Retry;*********** Pattern 0 Output Subroutine ***************ptn0 movlw p00 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p01 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p02 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p03 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p04 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p05 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p06 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p07 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return;*********** Pattern 1 Output Subroutine ***************ptn1 movlw p10 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p11 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p12 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p13 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p14 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p15 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p16 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p17 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return;*********** Pattern 2 Output Subroutine ***************ptn2 movlw p20 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p21 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p22 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p23 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p24 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p25 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p26 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return;*********** Pattern 3 Output Subroutine ***************ptn3 movlw p30 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p31 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p32 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p33 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p34 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p35 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p36 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p37 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p38 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p39 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3a ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3b ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3c ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3d ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return;*********** Pattern 4 Output Subroutine ***************ptn4 movlw p40 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p41 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p42 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p43 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p44 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p45 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p46 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p47 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p48 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw h'ff' ;Set LED off data movwf portb ;Output data call t1s ;Wait 1sec return;********************************************************; Timer Subroutine for 10MHz clock;********************************************************;************* 1msec Timer Subroutine *****************t1m movlw d'2' ;(1) Set loop cnt1 movwf cnt1m ;(1) Save loop cnt1tm1lp1 movlw d'249' ;(1)*2 Set loop cnt2 movwf cnt500u ;(1)*2 Save loop cnt2tm1lp2 nop ;(1)*249*2 Time adjust nop ;(1)*249*2 Time adjust decfsz cnt500u,f ;(1)*249*2 cnt500u-1=0 ? goto tm1lp2 ;(2)*248*2 No, continue decfsz cnt1m,f ;(1)*2 cnt1m-1=0 ? goto tm1lp1 ;(2) No. Continue return ;(2) Yes. Cnt end ;Total 2501*0.4usec=1msec;************* 100msec Timer Subroutine ***************t100m movlw d'100' ;Set loop counter movwf cnt100m ;Save loop countertm2lp call t1m ;1msec subroutine decfsz cnt100m,f ;cnt100m - 1 = 0 ? goto tm2lp ;No. Continue return ;Yes. Count end;************* 500msec Timer Subroutine ***************t500m movlw d'5' ;Set loop counter movwf cnt500m ;Save loop countertm3lp call t100m ;100msec subroutine decfsz cnt500m,f ;cnt500m - 1 = 0 ? goto tm3lp ;No. Continue return ;Yes. Count end;************** 1sec Timer Subroutine *****************t1s movlw d'2' ;Set loop counter movwf cnt1s ;Save loop countertm4lp call t500m ;500msec subroutine decfsz cnt1s,f ;cnt1s - 1 = 0 ? goto tm4lp ;No. Continue return ;Yes. Count end;********************************************************; END of LED flash control processing;******************************************************** end Als ik deze wil compilen naar een HEX bestand ( met MPLAB )krijg ik de volgende foutmeldingen Code: Clean: Deleting intermediary and output files.Clean: Done.Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F628 "led.asm" /l"led.lst" /e"led.err"Warning[215] C:\RGB\KNIPPER\SOURCE\LED.ASM 8 : Processor superseded by command line. Verify processor symbol.Message[301] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F84A.INC 35 : MESSAGE: (Processor-header file mismatch. Verify selected processor.)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 10 : Symbol not previously defined (_hs_osc)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 10 : Symbol not previously defined (_wdt_off)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 10 : Symbol not previously defined (_pwrte_on)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 10 : Symbol not previously defined (_cp_off)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 93 : Symbol not previously defined (status)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 93 : Symbol not previously defined (rp0)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 95 : Symbol not previously defined (trisa)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 96 : Symbol not previously defined (trisb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 97 : Symbol not previously defined (status)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 97 : Symbol not previously defined (rp0)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 99 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 102 : Symbol not previously defined (porta)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 104 : Symbol not previously defined (porta)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 106 : Symbol not previously defined (porta)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 108 : Symbol not previously defined (porta)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 110 : Symbol not previously defined (porta)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 116 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 119 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 122 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 125 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 128 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 131 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 134 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 137 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 140 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 146 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 149 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 152 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 155 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 158 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 161 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 164 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 167 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 170 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 176 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 179 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 182 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 185 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 188 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 191 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 194 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 197 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 203 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 206 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 209 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 212 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 215 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 218 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 221 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 224 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 227 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 230 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 233 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 236 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 239 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 242 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 245 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 251 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 254 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 257 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 260 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 263 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 266 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 269 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 272 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 275 : Symbol not previously defined (portb)Error[113] C:\RGB\KNIPPER\SOURCE\LED.ASM 278 : Symbol not previously defined (portb)Halting build on first failure as requested.BUILD FAILED: Wed Jan 09 17:13:49 2008 De hex code ziet als volgt uit : Code: :020000000528D1:0800080005288316FF30850076:1000100086018312FF308600051C1720851C3320C3:10002000051D4F20851D6820051E96200C28FE30DA:100030008600C020FD308600C020FB308600C02036:10004000F7308600C020EF308600C020DF30860009:10005000C020BF308600C0207F308600C020FF3027:100060008600C02008007F308600C020BF30860098:10007000C020DF308600C020EF308600C020F7307F:100080008600C020FB308600C020FD308600C020E6:10009000FE308600C020FF308600C02008007E3081:1000A0008600C020BD308600C020DB308600C02026:1000B000E7308600C020DB308600C020BD308600DF:1000C000C0207E308600C020FF308600C02008009F:1000D000FE308600C020FD308600C020FA30860049:1000E000C020F5308600C020EA308600C020D53020:1000F0008600C020AA308600C02055308600C0206F:10010000AB308600C02057308600C020AF3086005C:10011000C0205F308600C020BF308600C0207F3006:100120008600C020FF308600C02008000030860016:10013000CC20FF308600CC2000308600CC20FF3061:100140008600CC2000308600CC20FF308600CC20FA:1001500000308600CC20FF308600CC2000308600A6:10016000CC20FF308600CC20080002308D00F93012:100170008C00000000008C0BB9288D0BB7280800FC:1001800064308E00B5208E0BC228080005308F0029:10019000C0208F0BC828080002309000C620900BAA:0401A000CE2808005D:02400E00F23F7F:00000001FF Als ik de hex dus rechtstreeks programmeer dan werkt het allemaal. Wie weet wat ik fout doe ? Het betreft een PIC 16F84A Greetz Mr|Repel There are 10 kinds of people in the world Those who understand binairy and those who don't
mr|repel Geplaatst: 9 januari 2008 Auteur Geplaatst: 9 januari 2008 het werkt <img src="/forums/images/graemlins/laugh.gif" alt="" />:D , wat blijkt, je moet HOOFDLETTERS typen Greetz Mr|Repel There are 10 kinds of people in the world Those who understand binairy and those who don't
Aanbevolen berichten
Maak een account aan of log in om te reageren
Je moet een lid zijn om een reactie te kunnen achterlaten
Account aanmaken
Registreer voor een nieuwe account in onze community. Het is erg gemakkelijk!
Registreer een nieuwe accountInloggen
Heb je reeds een account? Log hier in.
Nu inloggen