Hi folks,
I've been learning how to set up the '628A for synchronous comms.
Initially I have coded to send a continuous 9600bd signal with data set as 00h, basically just to confirm the Clock generation.
In this condition I would have expected to see (on the CRO) continuous Clock pulses, and zero data.
The Clocks are OK, but there is a Mark bit on the data line at the start of each byte.
I noted that the data line is normally high when not in use.
First thought was I hadn't set it to Sync, but that is not so.
I have been working from the Microchip data sheets, but can't see why these extra pulses are there.
The reason will probably be obvious to others more experienced in handling this area of programming.
kenmac
I've been learning how to set up the '628A for synchronous comms.
Initially I have coded to send a continuous 9600bd signal with data set as 00h, basically just to confirm the Clock generation.
In this condition I would have expected to see (on the CRO) continuous Clock pulses, and zero data.
The Clocks are OK, but there is a Mark bit on the data line at the start of each byte.
I noted that the data line is normally high when not in use.
First thought was I hadn't set it to Sync, but that is not so.
Code:
; ***set up Ports ****
bsf STATUS,RP0 ; bank1
movlw 02h ; b'00000010' PORTB.1 set
movwf TRISB ; set up portB
clrf TRISA ; set PORTA as outputs (not used)
;
;***set bits SYN,CSRC ***
bsf TXSTA,4 ; set SYNC - selects Sync mode
bsf TXSTA,7 ; set CSRC - selects Master mode
;
;*** Set up baudrate ***
movlw 67h ; required value for 9600bd/4mhz
movwf SPBRG ; set baud rate
bcf STATUS,RP0 ; bank0
;
;*** set bit SPEN ***
bsf RCSTA,7 ; set SPEN - configures data/clock
;
;*** enable Tx ****
bsf STATUS,RP0 ; bank1
bsf TXSTA,5 ; set TXEN
bcf STATUS,RP0 ; bank0
;
movlw 0x00 ; data (00h)
loop1
movwf TXREG ; load data - this will trigger Tx if TXEN is set
goto loop1 ; continue sending data (00h)
I have been working from the Microchip data sheets, but can't see why these extra pulses are there.
The reason will probably be obvious to others more experienced in handling this area of programming.
kenmac