da ich ja das eingangs signal bestimmen kann hab ich es so gelöstCode: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![]()
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:
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.Code:movlw 7 movwf CMCON
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![]()
mfg vielen dank schonmal für die letzte hilfe oxmox







Zitieren

Lesezeichen