Oshonsoft 'OR'

Status
Not open for further replies.

camerart

Well-Known Member
Hi,
I have asked similar questions about 'AND' and 'OR' etc before, but I would like to clear up an 'OR' question this time.

Does the OR here do what I hope, and check either RCSTA.OERR = 1 Or RCSTA.FERR = 1 then do till the ENDIF?
Camerart
-----------------------------------------------------------------------------------
If RCSTA.OERR = 1 Or RCSTA.FERR = 1 Then
RCSTA.CREN = 0
RCSTA.CREN = 1 'BIT4 ENABLES RECEIVER
char = RCREG '1
char = RCREG '2
err = 1 'ERROR
Endif
------------------------------------------------------------------------
 
Yes, that is what it is supposed to do. If either of those conditions are set (=1), it does the IF statement "then".
The only time it does not do the contents of the IF statement is when both are clear (=0).

You have to remember that a FERR is only for the next character in the RCREG buffer. A second character may in fact be valid. However, you can reset the UART if you wish with a FERR, which forces a total clearing and reset of the UART.
 
Hi S,
I was only checking because I had a case with an Oshonsoft program, where I had to use 'something like' an AND instead of an OR, I can't remember actually what it was but, it was something I didn't understand.
Thanks, C.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…