PDA

View Full Version : Tricks for monitoring RX



JoelMurphy
- 9th March 2008, 01:37
hello fellows,

i've got a general question and comment that i hope generates some discussion. how the heck do you make sure that you don't miss a serial signal when you are using UART? sure, each application is specific, and if you're looking for a signal, you're likely able to control each end of the transmission [any snoopers out there?] so the suit fits as well as the tailor is good. but what i'm after is examples of what did and didn't work in your experience with certain situations.

here's mine.

i'm developing a wireless doo-hickey. i want it to be 'universal' in the sense that the way it functions should be useful in most situations. my user will have all the details about how my device works, and they will tailor their transmission/reception to my protocol. [for advanced users, there will be an ICSP connection to load their own firmware].

the doo-hickey will mostly be handling transmissions, so the PIC on it will act like a buffer. i've had some luck with a short MAIN loop and putting the SERIN2 command in a subroutine that gets called once a loop. in that situation i use the timeout/label option. i've had some slightly glitchy results and tweeking the timeout value does and doesn't work.

another option that i'm going to try is just to check the state of the RX pin and see if it's low. that would mean there's some data there, but i'm wondering about the timing of that query. has anyone tried other options besides the old 'initialize the serial input and wait to see if there's readable data there'?

thanks, joel

definitely, definitely, smarter than yesterday.
altho' i did smack my thumb with a hammer before lunch...

Archangel
- 9th March 2008, 02:37
Hello JoelMurphy
look at this thread, Darrel's post #16 the code includes a ring buffer.
http://www.picbasic.co.uk/forum/showthread.php?t=4972

JoelMurphy
- 10th March 2008, 04:09
hi joe,

finally got a chance to get through that thread. sounds like you got your project to work in a few different ways.

i'm not jazzed on using interrupts in my project because i may be handling a different routine like sending parallel bytes through a port and not want to be interrupted while doing that. sure, i could suspend the interrupt, but then what's the use? i'm also not able to use the hardware UART [at least on the chip i've currently got] because i have that port dedicated to parallel out, and i also want to have access to the ICSP pins on a different port. I will have to dig through the PIC series more diligently if i want to use the hardware buffer...
I'm also interested in making the thing work without interrupts. i think PBP can handle it without the 'funky commands'.

does the WHILE command work kind of like an interrupt? in other words, when you're in a WHILE/WEND situation, how often does the condition get checked? every loop? every step of the loop?
even if it does check only once during the WEND, it may be fast enough to feel a low going bit on the RX pin...?

Jerson
- 10th March 2008, 05:26
Joel

I do not understand your reservation about using interrupts. Interrupts should be short and sweet. Then, they dont bite. That is the only way you can ensure keeping your date with the incoming data stream.

Jerson

JoelMurphy
- 10th March 2008, 21:22
ok, i'm getting a handle on the interrupt handler. the DT_INTS is very powerful!

i'm not sure if i can use it, because my hardware USART is located on a port that i'm dedicating to parallel in/out data stream.

i will try using an interrupt on the pin that i'm dedicating to serial in, but i'm not sure it will react fast enough to catch the data. perhaps what i really need to do is get a bigger chip.
seems like over-kill, though.

back to the lab.

JoelMurphy
- 28th March 2008, 01:16
haven't been by in a while. i'm working on about 4 different things right now, but life is good, even though life with electronics is slow. i would read a book on time management if i could find the damn time.
results do look promising, however.
j