PDA

View Full Version : a problem RF Signal with PULSIN



muskut
- 21st July 2005, 09:38
Hi,

I am working on a project. I have a problem. I must measure some RF signals with some pic's ports. I am using PULSIN command for this. But I cannot measure any signals. Some parts of my code is here;

*********************************
...
TRISA=%11000011
RFCOD VAR PORTA.0

temp var word
temp = 0
lcdout $fe, 1
lcdout "test"
pause 500

START:

if RFCOD = 1 then
pulsin RFCOD, 1, temp
GOSUB CODECONTROL
endif
goto START

CODECONTROL:
lcdout $fe, $c0, #temp
pause 500
resume

*********************************

I have a 433 mhz hybrid on my board and it is connected my Pic's PORTA.0 and I am using PIC 16F876A. When I push my transmitter's button I can receive the signal from my hybrid. Because I can see the signal with my scope. But my codes;

if RFCOD = 1 then
pulsin RFCOD, 1, temp
GOSUB CODECONTROL
endif

never works. I can see the signals on my scope but I the "IF statement" doesnt work. The variable of RFCOD is 0 (zero) everytime. So I cannot read the signals. If somebody has any ideas I am waiting for. What the problem can be?

Have a nice day.

Acetronics2
- 21st July 2005, 09:59
Hi,

Solution is evident:

pulsin measures a pulse, beginning with the Low to high transition ... in your example, the signal is already high when Pulsin begins ...

No L>H transition ... Pulsin = 0 !!! ( cause overflow ...)

The solution : Use RC Time command and add to the result the time needed by the test on RFCOD ...

Alain

PS: take care to carefully verify the PULSIN_MAX define ...

muskut
- 21st July 2005, 10:18
Thank you Acetronics,

But I am new on PBP. How can I do your solution? So if you have some example codes about your solution and if you send it to examine , I will be happy.

Thank you so much again.

Acetronics2
- 21st July 2005, 11:16
Hi, Muskut

You're new with PBP ... that's the worst reason I ever heard to ask for a "ready cooked" solution !!!

I think the first thing you should do is understand what the different functions do and how they do it.

For that first step, reading carefully the manual is not too much ... see what RCTime can do for you and we will be talking about that one next time.

Learning is NOT a shame, it's the beginning of intelligence ... begging might be prohibited here !!!

Alain

Ioannis
- 21st July 2005, 19:52
What is your transmited signal? What baud rate? How many bits?

Are you transmiting with some kind of Serout like command?

Ioannis

muskut
- 22nd July 2005, 15:39
I solved it by TMR0 and I changed the RF pin. The pin was PortA.0 but I cannot get any signals from here. Then I decided to chage port and the new port was PortC.5. And the result was Ok. I could read signals. Why I didnt read any signals from PortA.0 ? (16F876) Does anybody has an idea? Thank you so much again.

Bruce
- 22nd July 2005, 16:42
PORTA on the F876 is configured to A/D inputs by default on power-up due to
the default value in the ADCON1 register on power-up.

ADCON1 = 7 ' configures A/D pins as digital I/O.

Also, PORTC.5 is a schmitt trigger input. RA0 is TTL.