PDA

View Full Version : SERIN2 WAIT problem



iw2fvo
- 16th June 2020, 21:19
good day to all in this forum,
I am currently using PIC18f252 for receiving a data stream via UART connected to portc.6 .
I use the following method: SERIN2 RX_12,396,3000,WARNE ,[WAIT("T="),STR TE\4 ] . Mode is 0.
Everything work well but the WARNE label is not fired if the portc.6 pin is stack LOW.. It works correctly if the pin stays HIGH all the time .
Just to summarize the timeout label is fired in case of "T=" is not received within 3 secs and the line stays HIGH.
"T=" could not be received for the following reasons:
> because not transmitted
> because the line is staked LOW
> because the line is stacked HIGH.
I am asking if there is a possibility to jump to timeout label in all three condition.
Any assistance is appreciated.
Thanks in advance.
Regards,

richard
- 17th June 2020, 05:19
two thoughts
1 investigate why rx line is being held low and stop it from happening
2 change strategy and use the usart

iw2fvo
- 17th June 2020, 14:27
Thanks Richard,
I am going to try to consider all the possible failures of the radio receiver.
Do you mean to use the HW UART pin RC7 ?
The point is that i am using two UART in this project.
Any other possibilty to consider ?
Thanks again for your interest on the matter.
regards
Ambro

Ioannis
- 17th June 2020, 21:02
If you can use another PIC there are some with 2 uarts. Either 16F or 18F like these:

16F19175
16F19176
18F43K22
18F44K22
18F45K22

and many other pin compatible with your chip.

Ioannis

richard
- 18th June 2020, 00:39
Do you mean to use the HW UART pin RC7 ?

yes , you did not indicate the uart was already in use



Any other possibilty to consider ?


as ionis says a better chip with 2 eusarts
or
check pin status before using serin
or
write your own serin routine that can detect a permanent spacing condition

Dave
- 18th June 2020, 14:52
I have to ask, What is the serial input port connected to? Does the receiver have a CMOS output meaning it can sink and source voltage for the input pin? If it is an open collector output from the receiver then I would connect a pullup resistor of about 10K ohms from +5 to the input pin of the micro. I have never had issues with the SERIN command if used with a pullup resistor.

iw2fvo
- 18th June 2020, 16:11
Thanks very much for all the suggestions received.
I did solve the problem by checking the pin state before launch SERIN2: it is working now.
All the best to all of you,
regards