• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Oshonsoft 'OR'

camerart

Active 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
------------------------------------------------------------------------
 

sagor1

Active Member
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.
 

camerart

Active Member
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.
 

Latest threads

EE World Online Articles

Loading
Top