Hey Michi,
beschäftige mich mit PICs ca. 1 Jahr.
Habe paar kleinere Projekte gemacht bissel Spannungsmessung LCD One-Wire Chip auslesen und so Spielereien hauptsächlich mit 16F628 und 16F819 mit AD Wandler.
Ist auch mein erster 18F will auch mit USB kommunizieren wie ich mir dsa vorstellt habe ... naja erstmal werde ich noch versuchen den Bootloader von Microchip auf den PIC zu bekommen und dann in Java oder so ne Software schreiben mit der ich mit dem PIC kommunizieren kann.
Allerdings komme ich mit Java API für Windows nich so klar.
Oder ich schaue mir C an ist ja alles "recht" ähnlich.
Und C lohnt sich ja auch für PICs weil Bootloader und USB Firmware komplett in C geschrieben ist von Microchip.
Kann übrigens brennen (lag am Brenner hab nun meinen guten alten genommen ^^ ) allerdings bekomme ich nen Rechteck an dem Pin heißt das der Interrupt sich immer wieder setzt sobald ich ihn einmal gesetzt habe...
Habe auch mal verzögerung eingebaut aber das macht die Frequenz des Rechtecks nur kleiner ^^
Vielleicht fällt euch ja was aufCode:LIST P=18F2550, R=DEC ; Use the PIC16F819 and decimal system #include <P18f2550.INC> ;****************************************************************************** ;Variable definitions ; These variables are only needed if low priority interrupts are used. ; More variables may be needed to store other special function registers used ; in the interrupt routines. CBLOCK 0x080 WREG_TEMP ;variable used for context saving STATUS_TEMP ;variable used for context saving BSR_TEMP ;variable used for context saving loops loops1 loops2 ENDC CBLOCK 0x000 EXAMPLE ;example of a variable in access RAM ENDC org 0x00 goto Init ;****************************************************************************** ;High priority interrupt vector ; This code will start executing when a high priority interrupt occurs or ; when any interrupt occurs if interrupt priorities are not enabled. ORG 0x0008 bra HighInt ;go to high priority interrupt routine ;****************************************************************************** ;Low priority interrupt vector and routine ; This code will start executing when a low priority interrupt occurs. ; This code can be removed if low priority interrupts are not used. ORG 0x0018 movff STATUS,STATUS_TEMP ;save STATUS register movff WREG,WREG_TEMP ;save working register movff BSR,BSR_TEMP ;save BSR register ; *** low priority interrupt code goes here *** movff BSR_TEMP,BSR ;restore BSR register movff WREG_TEMP,WREG ;restore working register movff STATUS_TEMP,STATUS ;restore STATUS register retfie ;****************************************************************************** ;High priority interrupt routine ; The high priority interrupt code is placed here to avoid conflicting with ; the low priority interrupt vector. HighInt: btfsc PORTA, 0 ;Led invertieren goto aus goto ein aus ;Led aus bcf PORTA,0 bcf INTCON,RBIF call verz retfie ein ;Led ein bsf PORTA,0 bcf INTCON,RBIF call verz retfie Init ;Frequenzeinstellung ; movlw B'00001111' ;Maximum Frequency Tuning ; movwf OSCTUNE movlw B'01100010' ;4 MHz System/Clock Internalt Osc/ movwf OSCCON clrf PORTA movlw 0x0F movwf ADCON1 ;A/D auf Digital movlw 0x07 ;Komperator aus movwf CMCON clrf TRISA movlw B'00000010' movwf TRISB clrf TRISC movlw B'11001000' movwf INTCON bsf INTCON2,RBIP bcf INTCON2,RBPU movlw B'01001000' movwf INTCON3 Main goto Main ; --------------- ; Verzögerung Einstellbar 250ms ; --------------- verz movlw 4 ; einstellbar 1 = 250ms 4 = 1s movwf loops verz2 movlw 250 movwf loops1 verz3 movlw 200 movwf loops2 verz4 nop nop decfsz loops2,1 goto verz4 ; verz4 loop = 5us decfsz loops1,1 goto verz3 ; verz3 loop = 1000us decfsz loops,1 goto verz2 ; verz2 loop = 250000us x verz1 return end
MfG der Daniel
Edit: Wird der Interrupt eigentlich ausgelöst sobald einer der RB0:4 sich ändern (falling edge also von 5V auf Masse) oder kann ich das einstellen mit dem INT0 INT1 .... enable/disable ?
Lesezeichen