- MultiPlus Wechselrichter Insel und Nulleinspeisung Conrad         
Ergebnis 1 bis 2 von 2

Thema: 16F876, RA4 will nix ausgeben. Warum???

  1. #1
    Benutzer Stammmitglied
    Registriert seit
    19.12.2005
    Ort
    Wang-Dong-Township
    Alter
    53
    Beiträge
    67

    16F876, RA4 will nix ausgeben. Warum???

    Anzeige

    Powerstation Test
    Hi @ all,

    ich habe gerade an einem 16F876 an alle Portpins LEDs mit Vorwiderstand mit GND verbunden und mit einem Programm lediglich alle Pins auf Ausgang geschaltet und diese eingeschaltet.

    Alle LEDs sind an, bis auf RA4, obwohl ich wie bei Sprut alle Ausgänge auf digital umgeschaltet habe. Siehe beiliegendes Programm.

    Kann mir jemand erklären, warum RA4 nicht leuchten will?

    Hat das möglicherweise mit dieser Open-Drain-Geschichte zu tun, dass ich die LED mit Vdd verbinden müsste, weil bei Sprut da etwas steht von "Der Open-Drain-Ausgang kann sein Ausgangspin nur sauber auf Vss (0V) ziehen. "

    Ist das so zu verstehen, dass das nur mit Pull Up-Widerstand funktioniert???

    Code:
    	list		p=16f876	; list directive to define processor
    	#include	<p16f876.inc>	; processor specific variable definitions
    	
    	__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _LVP_OFF & _CPD_OFF
    
    ; '__CONFIG' directive is used to embed configuration data within .asm file.
    ; The lables following the directive are located in the respective .inc file.
    ; See respective data sheet for additional information on configuration word.
    
    
    
    
    
    
    ;***** VARIABLE DEFINITIONS
    w_temp		EQU	0x7D		; variable used for context saving 
    status_temp	EQU	0x7E		; variable used for context saving
    pclath_temp	EQU	0x7F		; variable used for context saving			
    
    
    
    
    
    
    ;**********************************************************************
    	ORG     0x000             ; processor reset vector
    
    	nop			  ; nop required for icd
      	goto    main              ; go to beginning of program
    
    
    	ORG     0x004             ; interrupt vector location
    
    	movwf   w_temp            ; save off current W register contents
    	movf	STATUS,w          ; move status register into W register
    	movwf	status_temp       ; save off contents of STATUS register
    	movf	PCLATH,w	  ; move pclath register into w register
    	movwf	pclath_temp	  ; save off contents of PCLATH register
    
    ; isr code can go here or be located as a call subroutine elsewhere
    
    	movf	pclath_temp,w	  ; retrieve copy of PCLATH register
    	movwf	PCLATH		  ; restore pre-isr PCLATH register contents
    	movf    status_temp,w     ; retrieve copy of STATUS register
    	movwf	STATUS            ; restore pre-isr STATUS register contents
    	swapf   w_temp,f
    	swapf   w_temp,w          ; restore pre-isr W register contents
    	retfie                    ; return from interrupt
    
    
    
    main
    
    ; remaining code goes here
    
    	BSF      STATUS, RP0       ; auf Bank 1 umschalten 
        BCF      ADCON1, PCFG3     ; PCFG3=0 
    	BSF      ADCON1, PCFG2     ; PCFG2=1 
    	BSF      ADCON1, PCFG1     ; PCFG1=1 
    	BCF      ADCON1, PCFG0     ; PCFG0=0 
    	BCF      STATUS, RP0       ; auf Bank 0 zurückschalten
    
    	bcf		STATUS,6
    	bsf		STATUS,5
    	movlw	0x00
    	movwf	TRISA
    	movwf	TRISB
    	movwf	TRISC
    	bcf		STATUS,5
    	movlw	0xFF
    	movwf	PORTA
    	movwf	PORTB
    	movwf	PORTC
    
    loop	goto	loop

  2. #2
    Erfahrener Benutzer Lebende Robotik Legende Avatar von PICture
    Registriert seit
    10.10.2005
    Ort
    Freyung bei Passau in Bayern
    Alter
    72
    Beiträge
    11.077
    Hallo JayCool!

    Der RA4 ist laut Datenblatt ein "open drain" Ausgang und kann nur mit GND verbinden. Ein "H" Pegel ist somit nur mit pull-up Widerstand möglich.

    MfG

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

fchao-Sinus-Wechselrichter AliExpress