Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Generating and receiving two signals with a pic simultaneously

Status
Not open for further replies.

osoloco3

Newbie
Joined
Aug 24, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,331
Greetings :

I turn to you in order to see if you can advise me on the implementation of a circuit with PIC. I have done small projects, but in this circuit I would like some guidance on how to create the program:

The case is as follows:

I require that a PIC simultaneously generate 2 pulse signals of different frequencies (example 1khz and 2khz) and these go to infrared emitters and at the same time the same PIC in other 2 pins has 2 infrared receivers that receive it, in such a way that If one of the signals is interrupted, tell me which of the 2 it was. It is mandatory that the frequencies be different.

I thought about using PIC with 2 PWM modules to generate the frequencies but the idea of monitoring them simultaneously is a bit complicated for me.

Also, I don't know if you could do the same with smaller PICs without using PWM.

Thanks in advance to anyone who could help me

A big greeting !!
 

It wouldn't be impossible to monitor PWM but it would be difficult, especially if more than one signal was being monitored at the same time. If you wanted to try it, set up two (or more) PWM signals from the internal generators and link the PWM output back to one of the port inputs. Connect the receiver signals to inputs on the same port. Then read the port in a loop and XOR the sending and receiving bits together. If the result is zero, the signal is being received, if it is '1' there is a difference in the signals. You have to be careful of delays between the outgoing and received signals as these will result in brief pulses in the XOR result.

A different method is to use a timer to generate interrupts, for example every few hundred uS. You can then use software counters inside the ISR to turn port pins on or off. That allows you to generate any frequency within the capability of the PIC speed and no PWM is needed. As before, you monitor the send and receive signals and look for differences in them.

Brian.
 
Hi,

Generating two PWMs is not the problem.
Configure the hardware and let it run. No processing power for this.
But you may generate interrupts on every PWM state change.

In the ISR poll the according input. Use ( input XOR PWM_state). The output of the XOR should be constant.

Another less processing power consuming solution may be to feed the input to a counter.
Then check - maybe every 100ms - whether the counter is 100 for 1kHz or 200 for 2kHz.

Klaus
 
What is the latency of the missing pulses you can tolerate ? Eg. hom manjy
cycles of missing pulse stream before you are notified the stream is comp-
romised ? What is the accuracy of the generated signals ? 1%, 10%.....xx%


Regards, Dana.
 
Greeting
Thank you very much to all of you for your contributions .... you give me an excellent vision of the way
in which I should focus the design of the program ... thank you very much again !!!

A great greeting !!!
 

This is basically a HW approach.

Two channels, single chip, most resources still available for other tasks, see right hand window.
Window to its immediate left other capabilities / resources on the chip for use.

The LED and R are offchip, the rest onchip.

Basically a timer is constantly reloaded by the input stream, when that fails the timer overflows
and fires another timer to generate a known pulse or reset or ........whatever. You may
not need that secondary timer if you do not care about the width of detect missing pulse used
by rest of system for control/notification. The edge detector used to control which edge the
system is reset on.

The control of the receivers and emitters can also be done onchip via use of onchip OpAmps
and comparators.

The IDE (PSOC Creator) and Compiler free, a good board to start with is $ 10, including debug.

1609353599798.png



Regards, Dana.
 
Last edited:

    osoloco3

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top