Code:
LIST P=16F628, R=DEC
#include "P16F628.INC"
CBLOCK 0x20 ; Declare variable addresses starting at 0x20
dataL
ENDC
ORG 0x000 ; Program starts at 0x000
;
; --------------------------------
; SET ANALOG/DIGITAL INPUTS PORT A
; --------------------------------
;
movlw 7
movwf CMCON
; ----------------
; INITIALIZE PORTS
; ----------------
;
movlw b'00000000'
movwf PORTA
movlw b'00000100'
movwf PORTB
bsf STATUS,RP0
movlw 0xFF
movwf TRISA
movlw b'11110010'
movwf TRISB
; ------------------------------------
; SET BAUD RATE TO COMMUNICATE WITH PC
; ------------------------------------
; Boot Baud Rate = 9600, No Parity, 1 Stop Bit
;
movlw 0x19 ; 0x19=9600 bps (0x0C=19200 bps)
movwf SPBRG
movlw b'00000100' ; brgh = high (2)
movwf TXSTA ; schaltet brgh high ein
bcf STATUS,RP0 ; RAM PAGE 0
movlw b'10010000' ; schaltet seriellen port ein
movwf RCSTA
;
; ------------------------------------
; PROVIDE A SETTLING TIME FOR START UP
; ------------------------------------
;
clrf dataL
settle decfsz dataL,F
goto settle
movf RCREG,W
movf RCREG,W
movf RCREG,W ; flush receive buffer
;
; ---------
; MAIN LOOP
; ---------
;
loop call receive ; wait for a char
call vergleich
goto loop
;
; -------------------------------------------
; SIGNALE VON DER RSR232 SCHNITTSTELLE EMPFANGEN
; -------------------------------------------
; This routine does not return until a character is received.
;
receive btfss PIR1,RCIF ; (5) check for received data
goto receive
movf RCREG,W ; speichert das empfangende in W
return
;
; -------------------------------------------------------------
;AUSWERTEN
; -------------------------------------------------------------
;
vergleich
BTFSS W,b'00000001'
goto receive
bsf PORTA,b'00000001'
goto vergleich
END
da ich ja das eingangs signal bestimmen kann hab ich es so gelöst ![Zwinkern](https://www.roboternetz.de/phpBB2/images/smiles/icon_wink.gif)
allerdings habe ich noch ne verständniss frage undzwar:
habe ja datenblatt durchforstet habe soweit alle register verstanden allerdings noch nicht ganz was folgendes soll:
Code:
movlw 7
movwf CMCON
was iss das CMCON genau verstehe das was sie im datenblatt sagen wolle nicht genau im datenblatt steht auch nur When CM2:CM0: = 001 und einmal 010 aber in dem beispiel sind alle auf 111.
Und selbst wenn nun 010 wäre was soll heißen C1 Vin- connetcs to RA0
und das mit den muss ich noch rausfinden
bsf STATUS,RP0
aber das finde ich selbst noch raus ![Zwinkern](https://www.roboternetz.de/phpBB2/images/smiles/icon_wink.gif)
mfg vielen dank schonmal für die letzte hilfe oxmox
Lesezeichen