Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I see no reason why the above would not work though :roll: .antoni1 said:TSTA= 11100100
RCSTA=10010000
bmcculla said:You can't have bit string constants in C. You have to convert the binary data to hex.
TSTA=0b11100100;
RCSTA=0b10010000;
antoni1 said:HI spirosd
I'm using MPLAB with CC5X compiler
How can i find which Baud rate should i use? There's a formula
Baud Rate = FOSC/(16(X+1)) (I ll use BRGH = 1 (High Speed))
I know the fosc=4Mhz but what about X=????
X = value in SPBRG (0 to 255) how i decide about X=???
Also for TSTA i set the bit 6=1 (1 = Selects 9-bit transmission) because bits TRISC<7:6> have to be set in order to configure pins RC6/TX/CK
but for RCSTA i set the bit 6=0 (0 = Selects 8-bit reception)
but i don't know if this will work--> using 9 bit transmission for TSTA and 8 bit recieve for RCSTA
Shall i set both TSTA and RCSTA to 9 bit transmission?
thanks
SER_INIT
BSF STATUS, RP0 ;select bank 1
MOVLW d'129' ;9600 baud @ 20 Mhz Fosc +0.16 err
MOVWF SPBRG
MOVLW b'00100100' ;brgh = 1
MOVWF TXSTA ;enable Async Transmission, set brgh
BCF STATUS, RP0 ;select bank 0
MOVLW b'10010000'
MOVWF RCSTA ;enable Async Reception
RETURN
SPBRG=12;
BRGH=1; // high data rate for sending
SYNC=0; //asynchronous
SPEN=1; //enable serial port pins
CREN=1; //enable reception
TXIE=0; //disable tx interrupts
RCIE=1; //enable rx interrupts
TX9=0; //8-bit transmission
RX9=0; //8-bit reception
TXEN=0; //reset transmitter
TXEN=1; //enable the transmitter